fixed add members
This commit is contained in:
parent
ede5b15ade
commit
8d4fbfed00
|
|
@ -97,9 +97,9 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
|||
icon: Icon(Icons.more_vert, size: 24.w, color: Colors.grey.shade700),
|
||||
tooltip: 'More Options',
|
||||
onSelected: (value) {
|
||||
if (value == 'select' && widget.group.isForming) {
|
||||
if (value == 'select') {
|
||||
_showMemberSelectionDialog(context);
|
||||
} else if (value == 'add_user' && widget.group.isForming) {
|
||||
} else if (value == 'add_user') {
|
||||
_showAddUserDialog(context);
|
||||
} else if (value == 'add_past_draw') {
|
||||
_showAddPastDrawDialog(context);
|
||||
|
|
@ -107,9 +107,14 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
|||
_showAddPastPaymentsDialog(context);
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
// Add members options (only for forming groups)
|
||||
if (widget.group.isForming) ...[
|
||||
itemBuilder: (context) {
|
||||
final currentMemberCount = widget.group.currentMemberCount;
|
||||
final maxMembers = widget.group.maxMembers;
|
||||
final canAddMembers = currentMemberCount < maxMembers;
|
||||
|
||||
return [
|
||||
// Add members options (if not full)
|
||||
if (canAddMembers) ...[
|
||||
PopupMenuItem(
|
||||
value: 'select',
|
||||
child: Row(
|
||||
|
|
@ -153,7 +158,8 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
|||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
];
|
||||
},
|
||||
),
|
||||
],
|
||||
bottom: PreferredSize(
|
||||
|
|
|
|||
|
|
@ -332,50 +332,28 @@ class ManagerDashboard extends StatelessWidget {
|
|||
Widget _buildMobileStatsGrid() {
|
||||
return Obx(() {
|
||||
final groups = ChitGroupService.to.chitGroups;
|
||||
final activeGroups = groups.where((g) => g.isActive).length;
|
||||
final formingGroups = groups.where((g) => g.isForming).length;
|
||||
final totalMembers = groups.fold<int>(0, (sum, group) => sum + (group.members?.length ?? 0));
|
||||
|
||||
return Column(
|
||||
return Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
title: 'Active Chitfunds',
|
||||
value: activeGroups.toString(),
|
||||
icon: Icons.group,
|
||||
color: Colors.blue.shade600,
|
||||
Expanded(
|
||||
child: InteractiveStatsCard(
|
||||
title: 'Total Chitfunds',
|
||||
value: groups.length.toString(),
|
||||
icon: Icons.account_balance_wallet,
|
||||
color: Colors.green.shade600,
|
||||
onTap: () => _navigateToGroups(),
|
||||
)),
|
||||
SizedBox(width: 12.w),
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
title: 'Forming Chitfunds',
|
||||
value: formingGroups.toString(),
|
||||
icon: Icons.group_add,
|
||||
color: Colors.orange.shade600,
|
||||
onTap: () => _navigateToGroups(),
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 12.h),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
),
|
||||
SizedBox(width: 12.w),
|
||||
Expanded(
|
||||
child: InteractiveStatsCard(
|
||||
title: 'Total Members',
|
||||
value: totalMembers.toString(),
|
||||
icon: Icons.people,
|
||||
color: Colors.green.shade600,
|
||||
color: Colors.blue.shade600,
|
||||
onTap: () => _navigateToMembers(),
|
||||
)),
|
||||
SizedBox(width: 12.w),
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
title: 'Total Chitfunds',
|
||||
value: groups.length.toString(),
|
||||
icon: Icons.dashboard,
|
||||
color: Colors.purple.shade600,
|
||||
onTap: () => _navigateToGroups(),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
@ -385,43 +363,29 @@ class ManagerDashboard extends StatelessWidget {
|
|||
Widget _buildDesktopStatsGrid() {
|
||||
return Obx(() {
|
||||
final groups = ChitGroupService.to.chitGroups;
|
||||
final activeGroups = groups.where((g) => g.isActive).length;
|
||||
final formingGroups = groups.where((g) => g.isForming).length;
|
||||
final totalMembers = groups.fold<int>(0, (sum, group) => sum + (group.members?.length ?? 0));
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
title: 'Active Groups',
|
||||
value: activeGroups.toString(),
|
||||
icon: Icons.group,
|
||||
color: Colors.blue.shade600,
|
||||
Expanded(
|
||||
child: InteractiveStatsCard(
|
||||
title: 'Total Chitfunds',
|
||||
value: groups.length.toString(),
|
||||
icon: Icons.account_balance_wallet,
|
||||
color: Colors.green.shade600,
|
||||
onTap: () => _navigateToGroups(),
|
||||
)),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16.w),
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
title: 'Forming Groups',
|
||||
value: formingGroups.toString(),
|
||||
icon: Icons.group_add,
|
||||
color: Colors.orange.shade600,
|
||||
onTap: () => _navigateToGroups(),
|
||||
)),
|
||||
SizedBox(width: 16.w),
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
Expanded(
|
||||
child: InteractiveStatsCard(
|
||||
title: 'Total Members',
|
||||
value: totalMembers.toString(),
|
||||
icon: Icons.people,
|
||||
color: Colors.green.shade600,
|
||||
color: Colors.blue.shade600,
|
||||
onTap: () => _navigateToMembers(),
|
||||
)),
|
||||
SizedBox(width: 16.w),
|
||||
Expanded(child: InteractiveStatsCard(
|
||||
title: 'Total Groups',
|
||||
value: groups.length.toString(),
|
||||
icon: Icons.dashboard,
|
||||
color: Colors.purple.shade600,
|
||||
onTap: () => _navigateToGroups(),
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue