Update: 2026-05-08 02:22:45

This commit is contained in:
Hamza-Ayed
2026-05-08 02:22:45 +03:00
parent b49af44139
commit 189382e065
9 changed files with 510 additions and 74 deletions

View File

@@ -194,24 +194,43 @@ class UsersManagementView extends StatelessWidget {
),
),
const Spacer(),
// Toggle active
IconButton(
icon: Icon(isActive ? Icons.toggle_on : Icons.toggle_off, color: isActive ? const Color(0xFF10B981) : Colors.grey, size: 28),
onPressed: () => controller.toggleUserActive(user['id'], !isActive),
tooltip: isActive ? 'تعطيل' : 'تفعيل',
),
// Edit
IconButton(
icon: const Icon(Icons.edit, size: 20, color: Color(0xFF0F4C81)),
onPressed: () => _showEditDialog(context, user, controller),
tooltip: 'تعديل',
),
// Delete
IconButton(
icon: const Icon(Icons.delete_outline, size: 20, color: Colors.red),
onPressed: () => _confirmDelete(context, controller, user['id'], user['name'] ?? ''),
tooltip: 'حذف',
),
// Only show actions for non-super_admin users
if (role != 'super_admin') ...[
// Toggle active
IconButton(
icon: Icon(isActive ? Icons.toggle_on : Icons.toggle_off, color: isActive ? const Color(0xFF10B981) : Colors.grey, size: 28),
onPressed: () => controller.toggleUserActive(user['id'], !isActive),
tooltip: isActive ? 'تعطيل' : 'تفعيل',
),
// Edit
IconButton(
icon: const Icon(Icons.edit, size: 20, color: Color(0xFF0F4C81)),
onPressed: () => _showEditDialog(context, user, controller),
tooltip: 'تعديل',
),
// Delete
IconButton(
icon: const Icon(Icons.delete_outline, size: 20, color: Colors.red),
onPressed: () => _confirmDelete(context, controller, user['id'], user['name'] ?? ''),
tooltip: 'حذف',
),
] else ...[
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: const Color(0xFF6366F1).withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(6),
),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.shield, size: 14, color: Color(0xFF6366F1)),
SizedBox(width: 4),
Text('محمي', style: TextStyle(fontSize: 11, color: Color(0xFF6366F1), fontWeight: FontWeight.w600)),
],
),
),
],
],
),
],