This commit is contained in:
Deep Koluguri 2025-11-05 23:38:22 -05:00
parent 2213a6524c
commit 9e9aaf7a07
2 changed files with 33 additions and 26 deletions

View File

@ -94,33 +94,40 @@ class _CombinedDrawDialogState extends State<CombinedDrawDialog>
_slideController.forward();
}
void _loadEligibleMembers() {
// This would typically load from the API
// For now, we'll simulate eligible members
void _loadEligibleMembers() async {
// Load real members from the API
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(() {
_eligibleMembers = [
{'id': '1', 'name': 'R Rama Krishna Reddy', 'mobile': '9876543210'},
{'id': '2', 'name': 'K Srinivas Reddy', 'mobile': '9876543211'},
{'id': '3', 'name': 'Ch Ramchandra Reddy', 'mobile': '9876543212'},
{'id': '4', 'name': 'B Krishnahari 1', 'mobile': '9876543213'},
{'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'},
];
_eligibleMembers = eligible.map((member) => {
'id': member.userId,
'name': member.user?.fullName ?? 'Unknown',
'mobile': member.user?.mobileNumber ?? '',
}).toList();
});
// 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() {

View File

@ -444,7 +444,7 @@ class ManagerDashboard extends StatelessWidget {
Column(
children: [
QuickActionCard(
title: 'Create New Group',
title: 'Create New Chitfund',
subtitle: 'Start a new chit fund group',
icon: Icons.group_add,
color: Colors.green.shade600,