Update: 2026-05-07 23:06:22
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../app/routes/app_pages.dart';
|
||||
import '../controllers/dashboard_controller.dart';
|
||||
import '../../../core/utils/app_snackbar.dart';
|
||||
|
||||
class DashboardView extends GetView<DashboardController> {
|
||||
const DashboardView({super.key});
|
||||
@@ -38,7 +39,7 @@ class DashboardView extends GetView<DashboardController> {
|
||||
icon: const Icon(Icons.notifications_outlined,
|
||||
color: Colors.white),
|
||||
onPressed: () =>
|
||||
Get.snackbar('قريباً', 'الإشعارات ستتوفر قريباً'),
|
||||
AppSnackbar.showInfo('قريباً', 'الإشعارات ستتوفر قريباً'),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh, color: Colors.white),
|
||||
@@ -69,6 +70,10 @@ class DashboardView extends GetView<DashboardController> {
|
||||
_buildWelcomeHeader(role, isDark),
|
||||
const SizedBox(height: 24),
|
||||
_buildQuickActions(isDark),
|
||||
if (role == 'admin' || role == 'super_admin') ...[
|
||||
const SizedBox(height: 24),
|
||||
_buildAdminQuickActions(role, isDark),
|
||||
],
|
||||
const SizedBox(height: 32),
|
||||
const Text('إحصائيات الفواتير',
|
||||
style: TextStyle(
|
||||
@@ -185,6 +190,101 @@ class DashboardView extends GetView<DashboardController> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAdminQuickActions(String role, bool isDark) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('إدارة الأعمال',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 12),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
_buildAdminActionCard(
|
||||
'الشركات',
|
||||
Icons.business_rounded,
|
||||
Colors.indigo,
|
||||
isDark,
|
||||
() => Get.toNamed(AppRoutes.COMPANIES_MANAGEMENT),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildAdminActionCard(
|
||||
'الموظفين',
|
||||
Icons.people_rounded,
|
||||
Colors.purple,
|
||||
isDark,
|
||||
() => Get.toNamed(AppRoutes.USERS_MANAGEMENT),
|
||||
),
|
||||
if (role == 'super_admin') ...[
|
||||
const SizedBox(width: 12),
|
||||
_buildAdminActionCard(
|
||||
'المكاتب',
|
||||
Icons.account_balance_rounded,
|
||||
Colors.teal,
|
||||
isDark,
|
||||
() => Get.toNamed(AppRoutes.TENANTS_MANAGEMENT),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 12),
|
||||
_buildAdminActionCard(
|
||||
'الاشتراك',
|
||||
Icons.workspace_premium_rounded,
|
||||
const Color(0xFFD4AF37),
|
||||
isDark,
|
||||
() => Get.toNamed(AppRoutes.SUBSCRIPTION),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAdminActionCard(String title, IconData icon, Color color,
|
||||
bool isDark, VoidCallback onTap) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
width: 100,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF1E1E2E) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border:
|
||||
Border.all(color: isDark ? Colors.white10 : Colors.grey.shade200),
|
||||
boxShadow: [
|
||||
if (!isDark)
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.03),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withValues(alpha: 0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, color: color, size: 24),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 13),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInvoiceStats(Map stats, bool isDark) {
|
||||
final inv = stats['invoices'] ?? {'total': 0, 'pending': 0, 'approved': 0};
|
||||
return Row(
|
||||
|
||||
Reference in New Issue
Block a user