clean up
This commit is contained in:
parent
2213a6524c
commit
9e9aaf7a07
|
|
@ -94,33 +94,40 @@ class _CombinedDrawDialogState extends State<CombinedDrawDialog>
|
||||||
_slideController.forward();
|
_slideController.forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadEligibleMembers() {
|
void _loadEligibleMembers() async {
|
||||||
// This would typically load from the API
|
// Load real members from the API
|
||||||
// For now, we'll simulate eligible members
|
final chitGroupService = Get.find<ChitGroupService>();
|
||||||
|
|
||||||
|
// Load group members if not already loaded
|
||||||
|
await chitGroupService.loadGroupMembers(widget.group.id);
|
||||||
|
|
||||||
|
// Get active members who haven't won yet
|
||||||
|
final allMembers = chitGroupService.groupMembers;
|
||||||
|
final pastDraws = chitGroupService.monthlyDraws;
|
||||||
|
final wonMemberIds = pastDraws.map((d) => d.winnerId).toList();
|
||||||
|
|
||||||
|
final eligible = allMembers.where((member) {
|
||||||
|
return member.status.toLowerCase() == 'active' &&
|
||||||
|
!wonMemberIds.contains(member.userId);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_eligibleMembers = [
|
_eligibleMembers = eligible.map((member) => {
|
||||||
{'id': '1', 'name': 'R Rama Krishna Reddy', 'mobile': '9876543210'},
|
'id': member.userId,
|
||||||
{'id': '2', 'name': 'K Srinivas Reddy', 'mobile': '9876543211'},
|
'name': member.user?.fullName ?? 'Unknown',
|
||||||
{'id': '3', 'name': 'Ch Ramchandra Reddy', 'mobile': '9876543212'},
|
'mobile': member.user?.mobileNumber ?? '',
|
||||||
{'id': '4', 'name': 'B Krishnahari 1', 'mobile': '9876543213'},
|
}).toList();
|
||||||
{'id': '5', 'name': 'B Krishnahari 2', 'mobile': '9876543214'},
|
|
||||||
{'id': '6', 'name': 'N Paranjyothi 1', 'mobile': '9876543215'},
|
|
||||||
{'id': '7', 'name': 'N Paranjyothi 2', 'mobile': '9876543216'},
|
|
||||||
{'id': '8', 'name': 'Sharada 1', 'mobile': '9876543217'},
|
|
||||||
{'id': '9', 'name': 'Sharada 2', 'mobile': '9876543218'},
|
|
||||||
{'id': '10', 'name': 'Ibrahim', 'mobile': '9876543219'},
|
|
||||||
{'id': '11', 'name': 'Waheeda Bee', 'mobile': '9876543220'},
|
|
||||||
{'id': '12', 'name': 'R Janardhan Reddy', 'mobile': '9876543221'},
|
|
||||||
{'id': '13', 'name': 'Shashank 1', 'mobile': '9876543222'},
|
|
||||||
{'id': '14', 'name': 'Shashank 2', 'mobile': '9876543223'},
|
|
||||||
{'id': '15', 'name': 'S Saritha', 'mobile': '9876543224'},
|
|
||||||
{'id': '16', 'name': 'S Rakesh Reddy', 'mobile': '9876543225'},
|
|
||||||
{'id': '17', 'name': 'S Rohini (Sony)', 'mobile': '9876543226'},
|
|
||||||
{'id': '18', 'name': 'K Shalini', 'mobile': '9876543227'},
|
|
||||||
{'id': '19', 'name': 'K Sundeep Reddy', 'mobile': '9876543228'},
|
|
||||||
{'id': '20', 'name': 'K Thirupathi Reddy', 'mobile': '9876543229'},
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Show message if no eligible members
|
||||||
|
if (_eligibleMembers.isEmpty) {
|
||||||
|
Get.snackbar(
|
||||||
|
'No Eligible Members',
|
||||||
|
'All active members have already won, or no members exist in this group.',
|
||||||
|
backgroundColor: Colors.orange.shade100,
|
||||||
|
colorText: Colors.orange.shade900,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _startDraw() {
|
void _startDraw() {
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ class ManagerDashboard extends StatelessWidget {
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
QuickActionCard(
|
QuickActionCard(
|
||||||
title: 'Create New Group',
|
title: 'Create New Chitfund',
|
||||||
subtitle: 'Start a new chit fund group',
|
subtitle: 'Start a new chit fund group',
|
||||||
icon: Icons.group_add,
|
icon: Icons.group_add,
|
||||||
color: Colors.green.shade600,
|
color: Colors.green.shade600,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue