diff --git a/lib/presentation/hrPolicyDetails.dart b/lib/presentation/hrPolicyDetails.dart index 4ccb894..a19b786 100755 --- a/lib/presentation/hrPolicyDetails.dart +++ b/lib/presentation/hrPolicyDetails.dart @@ -644,6 +644,14 @@ class _HrPolicyDetailsState extends State return value[0].toUpperCase() + value.substring(1).toLowerCase(); } + String _getStatusDisplayLabel(String? status) { + final normalized = status?.toLowerCase().trim() ?? ''; + if (localTokenType == 'pre' && _isEnrolledStatus(normalized)) { + return 'Submitted'; + } + return _capitalize(status); + } + String _defaultReminderSubject() { final policyName = localCardPolicyName ?? widget.cardPolicy_name; return 'Reminder: Complete Your Enrollment - $policyName'; @@ -1774,12 +1782,11 @@ HR Team'''; final statusCounts = getPreStatusCounts(); const filters = >[ {'key': 'emp_count', 'label': 'Emp Count'}, - {'key': 'enrolled', 'label': 'Enroled'}, - {'key': 'not_enrolled', 'label': 'Not Enroled'}, + {'key': 'enrolled', 'label': 'Submitted'}, {'key': 'logged_in', 'label': 'Logged-In'}, {'key': 'not_logged_in', 'label': 'Not Logged-In'}, {'key': 'draft', 'label': 'Draft'}, - ]; + ]; return SizedBox( height: 38, @@ -1937,7 +1944,7 @@ HR Team'''; borderRadius: BorderRadius.circular(10), ), child: Text( - _capitalize(item['status']), + _getStatusDisplayLabel(item['status']), textAlign: TextAlign.center, style: _dataBold, ), diff --git a/lib/presentation/policies.dart b/lib/presentation/policies.dart index ad35305..dc3eeaa 100644 --- a/lib/presentation/policies.dart +++ b/lib/presentation/policies.dart @@ -578,6 +578,8 @@ class _PolicyGrid extends StatelessWidget { final bool isEnrollment; final Function(String clientPolicyId)? onBulkDownload; + static const double _enrollmentCardHeight = 156; + const _PolicyGrid({ super.key, required this.policies, @@ -695,7 +697,7 @@ class _PolicyGrid extends StatelessWidget { double cardHeight; if (isEnrollment) { - cardHeight = 140; + cardHeight = _enrollmentCardHeight; } else { cardHeight = 170; } @@ -712,7 +714,7 @@ class _PolicyGrid extends StatelessWidget { childAspectRatio: config.childAspectRatio, crossAxisSpacing: 16, mainAxisSpacing: 16, - mainAxisExtent: isEnrollment ? 120 : 150, // fixed card height + mainAxisExtent: isEnrollment ? _enrollmentCardHeight : 150, ), itemCount: list.length, itemBuilder: (context, index) { @@ -971,9 +973,10 @@ class _EnrollmentPolicyCardNew extends StatelessWidget { color: const Color(0xFFE9F6FB), borderRadius: BorderRadius.circular(12), ), - padding: const EdgeInsets.all(14), + padding: const EdgeInsets.fromLTRB(14, 12, 14, 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ /// Policy Number Tooltip( @@ -1009,7 +1012,7 @@ class _EnrollmentPolicyCardNew extends StatelessWidget { // ), // ), - const SizedBox(height: 10), + const SizedBox(height: 8), /// Closes On Text( @@ -1020,26 +1023,57 @@ class _EnrollmentPolicyCardNew extends StatelessWidget { ), ), - const SizedBox(height: 10), + const SizedBox(height: 8), - /// STATUS ROW - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + /// STATUS ROW — 2×2 grid so four pills fit without overflow + Column( children: [ - _StatusPillCount( - label: 'Draft', - value: data['membersCountOfDraft'] ?? 0, - color: Colors.orange, + Row( + children: [ + Expanded( + child: _StatusPillCount( + label: 'Draft', + value: data['membersCountOfDraft'] ?? 0, + color: Colors.orange, + compact: true, + expand: true, + ), + ), + const SizedBox(width: 6), + Expanded( + child: _StatusPillCount( + label: 'Logged In', + value: data['membersCountOfLoggedIn'] ?? 0, + color: Colors.purple, + compact: true, + expand: true, + ), + ), + ], ), - _StatusPillCount( - label: 'Under Process', - value: data['membersCountOfEnrolled'] ?? 0, - color: Colors.blue, - ), - _StatusPillCount( - label: 'Total', - value: data['totalMembersCount'] ?? 0, - color: Colors.green, + const SizedBox(height: 6), + Row( + children: [ + Expanded( + child: _StatusPillCount( + label: 'Submitted', + value: data['membersCountOfEnrolled'] ?? 0, + color: Colors.blue, + compact: true, + expand: true, + ), + ), + const SizedBox(width: 6), + Expanded( + child: _StatusPillCount( + label: 'Total', + value: data['totalMembersCount'] ?? 0, + color: Colors.green, + compact: true, + expand: true, + ), + ), + ], ), ], ), @@ -1202,32 +1236,52 @@ class _StatusPillCount extends StatelessWidget { final String label; final int value; final Color color; + final bool compact; + final bool expand; const _StatusPillCount({ required this.label, required this.value, required this.color, + this.compact = false, + this.expand = false, }); @override Widget build(BuildContext context) { return Container( - padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 5), + width: expand ? double.infinity : null, + height: expand ? 30 : null, + padding: EdgeInsets.symmetric( + horizontal: compact ? 8 : 18, + vertical: compact ? 4 : 5, + ), + alignment: expand ? Alignment.center : null, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), ), child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - label, - style: GoogleFonts.poppins(fontSize: 13, color: color), + Flexible( + child: Text( + label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: compact ? 11 : 13, + color: color, + ), + ), ), - const SizedBox(width: 8), + SizedBox(width: compact ? 4 : 8), Text( value.toString(), style: GoogleFonts.poppins( - fontSize: 14, + fontSize: compact ? 12 : 14, fontWeight: FontWeight.bold, color: color, ),