polices chip added

This commit is contained in:
Surendiran 2026-06-24 16:46:20 +05:30
parent 197a699c16
commit fbcfe20b9b
2 changed files with 92 additions and 31 deletions

View File

@ -644,6 +644,14 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
return value[0].toUpperCase() + value.substring(1).toLowerCase(); 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() { String _defaultReminderSubject() {
final policyName = localCardPolicyName ?? widget.cardPolicy_name; final policyName = localCardPolicyName ?? widget.cardPolicy_name;
return 'Reminder: Complete Your Enrollment - $policyName'; return 'Reminder: Complete Your Enrollment - $policyName';
@ -1774,12 +1782,11 @@ HR Team''';
final statusCounts = getPreStatusCounts(); final statusCounts = getPreStatusCounts();
const filters = <Map<String, String>>[ const filters = <Map<String, String>>[
{'key': 'emp_count', 'label': 'Emp Count'}, {'key': 'emp_count', 'label': 'Emp Count'},
{'key': 'enrolled', 'label': 'Enroled'}, {'key': 'enrolled', 'label': 'Submitted'},
{'key': 'not_enrolled', 'label': 'Not Enroled'},
{'key': 'logged_in', 'label': 'Logged-In'}, {'key': 'logged_in', 'label': 'Logged-In'},
{'key': 'not_logged_in', 'label': 'Not Logged-In'}, {'key': 'not_logged_in', 'label': 'Not Logged-In'},
{'key': 'draft', 'label': 'Draft'}, {'key': 'draft', 'label': 'Draft'},
]; ];
return SizedBox( return SizedBox(
height: 38, height: 38,
@ -1937,7 +1944,7 @@ HR Team''';
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Text( child: Text(
_capitalize(item['status']), _getStatusDisplayLabel(item['status']),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _dataBold, style: _dataBold,
), ),

View File

@ -578,6 +578,8 @@ class _PolicyGrid extends StatelessWidget {
final bool isEnrollment; final bool isEnrollment;
final Function(String clientPolicyId)? onBulkDownload; final Function(String clientPolicyId)? onBulkDownload;
static const double _enrollmentCardHeight = 156;
const _PolicyGrid({ const _PolicyGrid({
super.key, super.key,
required this.policies, required this.policies,
@ -695,7 +697,7 @@ class _PolicyGrid extends StatelessWidget {
double cardHeight; double cardHeight;
if (isEnrollment) { if (isEnrollment) {
cardHeight = 140; cardHeight = _enrollmentCardHeight;
} else { } else {
cardHeight = 170; cardHeight = 170;
} }
@ -712,7 +714,7 @@ class _PolicyGrid extends StatelessWidget {
childAspectRatio: config.childAspectRatio, childAspectRatio: config.childAspectRatio,
crossAxisSpacing: 16, crossAxisSpacing: 16,
mainAxisSpacing: 16, mainAxisSpacing: 16,
mainAxisExtent: isEnrollment ? 120 : 150, // fixed card height mainAxisExtent: isEnrollment ? _enrollmentCardHeight : 150,
), ),
itemCount: list.length, itemCount: list.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -971,9 +973,10 @@ class _EnrollmentPolicyCardNew extends StatelessWidget {
color: const Color(0xFFE9F6FB), color: const Color(0xFFE9F6FB),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
padding: const EdgeInsets.all(14), padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [ children: [
/// Policy Number /// Policy Number
Tooltip( Tooltip(
@ -1009,7 +1012,7 @@ class _EnrollmentPolicyCardNew extends StatelessWidget {
// ), // ),
// ), // ),
const SizedBox(height: 10), const SizedBox(height: 8),
/// Closes On /// Closes On
Text( Text(
@ -1020,26 +1023,57 @@ class _EnrollmentPolicyCardNew extends StatelessWidget {
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 8),
/// STATUS ROW /// STATUS ROW 2×2 grid so four pills fit without overflow
Row( Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
_StatusPillCount( Row(
label: 'Draft', children: [
value: data['membersCountOfDraft'] ?? 0, Expanded(
color: Colors.orange, 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( const SizedBox(height: 6),
label: 'Under Process', Row(
value: data['membersCountOfEnrolled'] ?? 0, children: [
color: Colors.blue, Expanded(
), child: _StatusPillCount(
_StatusPillCount( label: 'Submitted',
label: 'Total', value: data['membersCountOfEnrolled'] ?? 0,
value: data['totalMembersCount'] ?? 0, color: Colors.blue,
color: Colors.green, 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 String label;
final int value; final int value;
final Color color; final Color color;
final bool compact;
final bool expand;
const _StatusPillCount({ const _StatusPillCount({
required this.label, required this.label,
required this.value, required this.value,
required this.color, required this.color,
this.compact = false,
this.expand = false,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( 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( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Flexible(
label, child: Text(
style: GoogleFonts.poppins(fontSize: 13, color: color), 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( Text(
value.toString(), value.toString(),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: compact ? 12 : 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: color, color: color,
), ),