fixed add members
This commit is contained in:
parent
ede5b15ade
commit
8d4fbfed00
|
|
@ -93,29 +93,34 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
actions: [
|
actions: [
|
||||||
// Actions menu - always visible
|
// Actions menu - always visible
|
||||||
PopupMenuButton<String>(
|
PopupMenuButton<String>(
|
||||||
icon: Icon(Icons.more_vert, size: 24.w, color: Colors.grey.shade700),
|
icon: Icon(Icons.more_vert, size: 24.w, color: Colors.grey.shade700),
|
||||||
tooltip: 'More Options',
|
tooltip: 'More Options',
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
if (value == 'select' && widget.group.isForming) {
|
if (value == 'select') {
|
||||||
_showMemberSelectionDialog(context);
|
_showMemberSelectionDialog(context);
|
||||||
} else if (value == 'add_user' && widget.group.isForming) {
|
} else if (value == 'add_user') {
|
||||||
_showAddUserDialog(context);
|
_showAddUserDialog(context);
|
||||||
} else if (value == 'add_past_draw') {
|
} else if (value == 'add_past_draw') {
|
||||||
_showAddPastDrawDialog(context);
|
_showAddPastDrawDialog(context);
|
||||||
} else if (value == 'add_past_payments') {
|
} else if (value == 'add_past_payments') {
|
||||||
_showAddPastPaymentsDialog(context);
|
_showAddPastPaymentsDialog(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) {
|
||||||
// Add members options (only for forming groups)
|
final currentMemberCount = widget.group.currentMemberCount;
|
||||||
if (widget.group.isForming) ...[
|
final maxMembers = widget.group.maxMembers;
|
||||||
|
final canAddMembers = currentMemberCount < maxMembers;
|
||||||
|
|
||||||
|
return [
|
||||||
|
// Add members options (if not full)
|
||||||
|
if (canAddMembers) ...[
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 'select',
|
value: 'select',
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.people_alt, color: Colors.blue.shade600),
|
Icon(Icons.people_alt, color: Colors.blue.shade600),
|
||||||
SizedBox(width: 12.w),
|
SizedBox(width: 12.w),
|
||||||
const Text('Select Members'),
|
const Text('Select Members'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -125,36 +130,37 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.person_add, color: Colors.green.shade600),
|
Icon(Icons.person_add, color: Colors.green.shade600),
|
||||||
SizedBox(width: 12.w),
|
SizedBox(width: 12.w),
|
||||||
const Text('Add New User'),
|
const Text('Add New User'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const PopupMenuDivider(),
|
const PopupMenuDivider(),
|
||||||
],
|
],
|
||||||
// Backfill options (always available)
|
// Backfill options (always available)
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 'add_past_draw',
|
value: 'add_past_draw',
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.history, color: Colors.blue.shade600),
|
Icon(Icons.history, color: Colors.blue.shade600),
|
||||||
SizedBox(width: 12.w),
|
SizedBox(width: 12.w),
|
||||||
const Text('Add Past Draw Result'),
|
const Text('Add Past Draw Result'),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
PopupMenuItem(
|
||||||
PopupMenuItem(
|
value: 'add_past_payments',
|
||||||
value: 'add_past_payments',
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Icon(Icons.payment_outlined, color: Colors.green.shade600),
|
||||||
Icon(Icons.payment_outlined, color: Colors.green.shade600),
|
SizedBox(width: 12.w),
|
||||||
SizedBox(width: 12.w),
|
const Text('Add Past Payments'),
|
||||||
const Text('Add Past Payments'),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
];
|
||||||
],
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: Size.fromHeight(64.h),
|
preferredSize: Size.fromHeight(64.h),
|
||||||
|
|
|
||||||
|
|
@ -332,50 +332,28 @@ class ManagerDashboard extends StatelessWidget {
|
||||||
Widget _buildMobileStatsGrid() {
|
Widget _buildMobileStatsGrid() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
final groups = ChitGroupService.to.chitGroups;
|
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));
|
final totalMembers = groups.fold<int>(0, (sum, group) => sum + (group.members?.length ?? 0));
|
||||||
|
|
||||||
return Column(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Expanded(
|
||||||
children: [
|
child: InteractiveStatsCard(
|
||||||
Expanded(child: InteractiveStatsCard(
|
title: 'Total Chitfunds',
|
||||||
title: 'Active Chitfunds',
|
value: groups.length.toString(),
|
||||||
value: activeGroups.toString(),
|
icon: Icons.account_balance_wallet,
|
||||||
icon: Icons.group,
|
color: Colors.green.shade600,
|
||||||
color: Colors.blue.shade600,
|
onTap: () => _navigateToGroups(),
|
||||||
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),
|
SizedBox(width: 12.w),
|
||||||
Row(
|
Expanded(
|
||||||
children: [
|
child: InteractiveStatsCard(
|
||||||
Expanded(child: InteractiveStatsCard(
|
title: 'Total Members',
|
||||||
title: 'Total Members',
|
value: totalMembers.toString(),
|
||||||
value: totalMembers.toString(),
|
icon: Icons.people,
|
||||||
icon: Icons.people,
|
color: Colors.blue.shade600,
|
||||||
color: Colors.green.shade600,
|
onTap: () => _navigateToMembers(),
|
||||||
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() {
|
Widget _buildDesktopStatsGrid() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
final groups = ChitGroupService.to.chitGroups;
|
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));
|
final totalMembers = groups.fold<int>(0, (sum, group) => sum + (group.members?.length ?? 0));
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: InteractiveStatsCard(
|
Expanded(
|
||||||
title: 'Active Groups',
|
child: InteractiveStatsCard(
|
||||||
value: activeGroups.toString(),
|
title: 'Total Chitfunds',
|
||||||
icon: Icons.group,
|
value: groups.length.toString(),
|
||||||
color: Colors.blue.shade600,
|
icon: Icons.account_balance_wallet,
|
||||||
onTap: () => _navigateToGroups(),
|
color: Colors.green.shade600,
|
||||||
)),
|
onTap: () => _navigateToGroups(),
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(width: 16.w),
|
SizedBox(width: 16.w),
|
||||||
Expanded(child: InteractiveStatsCard(
|
Expanded(
|
||||||
title: 'Forming Groups',
|
child: InteractiveStatsCard(
|
||||||
value: formingGroups.toString(),
|
title: 'Total Members',
|
||||||
icon: Icons.group_add,
|
value: totalMembers.toString(),
|
||||||
color: Colors.orange.shade600,
|
icon: Icons.people,
|
||||||
onTap: () => _navigateToGroups(),
|
color: Colors.blue.shade600,
|
||||||
)),
|
onTap: () => _navigateToMembers(),
|
||||||
SizedBox(width: 16.w),
|
),
|
||||||
Expanded(child: InteractiveStatsCard(
|
),
|
||||||
title: 'Total Members',
|
|
||||||
value: totalMembers.toString(),
|
|
||||||
icon: Icons.people,
|
|
||||||
color: Colors.green.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