fixed frontned
This commit is contained in:
parent
c855e1b434
commit
6e480ef09a
|
|
@ -2045,28 +2045,78 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
||||||
'Group can only be deleted while in "Forming" status',
|
'Group can only be deleted while in "Forming" status',
|
||||||
backgroundColor: Colors.orange,
|
backgroundColor: Colors.orange,
|
||||||
colorText: Colors.white,
|
colorText: Colors.white,
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final memberCount = _service.groupMembers.length;
|
// Count only ACTIVE members (not removed or inactive)
|
||||||
if (memberCount > 0) {
|
final activeMemberCount = _service.groupMembers.where((m) => m.status == 'active').length;
|
||||||
|
|
||||||
|
if (activeMemberCount > 0) {
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'Cannot Delete',
|
'Cannot Delete',
|
||||||
'Group has $memberCount members. Remove all members first.',
|
'Group has $activeMemberCount active member(s). Remove all active members first.',
|
||||||
backgroundColor: Colors.orange,
|
backgroundColor: Colors.orange,
|
||||||
colorText: Colors.white,
|
colorText: Colors.white,
|
||||||
|
duration: const Duration(seconds: 4),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show removed members count if any
|
||||||
|
final removedMemberCount = _service.groupMembers.where((m) => m.status == 'removed').length;
|
||||||
|
final totalMembers = _service.groupMembers.length;
|
||||||
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: const Text('Delete Group?'),
|
title: const Text('Delete Group?'),
|
||||||
content: Text(
|
content: Column(
|
||||||
'Are you sure you want to delete "${widget.group.name}"?\n\n'
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Are you sure you want to delete "${widget.group.name}"?',
|
||||||
|
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
if (removedMemberCount > 0) ...[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(12.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.blue.shade50,
|
||||||
|
borderRadius: BorderRadius.circular(8.r),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Group Status:',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 6.h),
|
||||||
|
Text('• Active members: 0', style: TextStyle(fontSize: 13.sp)),
|
||||||
|
Text('• Removed members: $removedMemberCount',
|
||||||
|
style: TextStyle(fontSize: 13.sp, color: Colors.grey.shade600)),
|
||||||
|
Text('• Total records: $totalMembers', style: TextStyle(fontSize: 13.sp)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12.h),
|
||||||
|
],
|
||||||
|
Text(
|
||||||
'This action cannot be undone.',
|
'This action cannot be undone.',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.red.shade700,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
|
|
@ -2082,7 +2132,7 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
child: const Text('Delete'),
|
child: const Text('Delete Group'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue