From 55f62207a815c9196a8115e3d92b7aee0e6340a6 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 16 Feb 2026 13:31:21 -0500 Subject: [PATCH] feat(breaks): Add break duration and payment status to shift details --- .../lib/src/l10n/en.i18n.json | 3 + .../lib/src/l10n/es.i18n.json | 3 + .../pages/shift_details_page.dart | 104 ++++++++++++------ 3 files changed, 77 insertions(+), 33 deletions(-) diff --git a/apps/mobile/packages/core_localization/lib/src/l10n/en.i18n.json b/apps/mobile/packages/core_localization/lib/src/l10n/en.i18n.json index 40b07667..2dc0b1e5 100644 --- a/apps/mobile/packages/core_localization/lib/src/l10n/en.i18n.json +++ b/apps/mobile/packages/core_localization/lib/src/l10n/en.i18n.json @@ -999,6 +999,9 @@ "est_total": "Est. Total", "hours_label": "$count hours", "location": "LOCATION", + "break": "BREAK", + "paid": "Paid", + "unpaid": "Unpaid", "open_in_maps": "Open in Maps", "job_description": "JOB DESCRIPTION", "cancel_shift": "CANCEL SHIFT", diff --git a/apps/mobile/packages/core_localization/lib/src/l10n/es.i18n.json b/apps/mobile/packages/core_localization/lib/src/l10n/es.i18n.json index 7627b0e3..2c70eb24 100644 --- a/apps/mobile/packages/core_localization/lib/src/l10n/es.i18n.json +++ b/apps/mobile/packages/core_localization/lib/src/l10n/es.i18n.json @@ -999,6 +999,9 @@ "est_total": "Total est.", "hours_label": "$count horas", "location": "UBICACIÓN", + "break": "DESCANSO", + "paid": "Pagado", + "unpaid": "No pagado", "open_in_maps": "Abrir en Mapas", "job_description": "DESCRIPCIÓN DEL TRABAJO", "cancel_shift": "CANCELAR TURNO", diff --git a/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart b/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart index 7ca8f8ca..b00740a9 100644 --- a/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart +++ b/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart @@ -240,6 +240,40 @@ class _ShiftDetailsPageState extends State { const Divider(height: 1, thickness: 0.5), + // Stats Row (New) + Padding( + padding: const EdgeInsets.all(UiConstants.space5), + child: Row( + children: [ + Expanded( + child: _buildStatCard( + UiIcons.dollar, + "\$${estimatedTotal.toStringAsFixed(0)}", + "Total", + ), + ), + const SizedBox(width: UiConstants.space4), + Expanded( + child: _buildStatCard( + UiIcons.dollar, + "\$${displayShift.hourlyRate.toStringAsFixed(0)}", + "Hourly Rate", + ), + ), + const SizedBox(width: UiConstants.space4), + Expanded( + child: _buildStatCard( + UiIcons.clock, + duration.toStringAsFixed(1), + "Hours", + ), + ), + ], + ), + ), + + const Divider(height: 1, thickness: 0.5), + // Date & Time Section Padding( padding: const EdgeInsets.all(UiConstants.space5), @@ -248,7 +282,8 @@ class _ShiftDetailsPageState extends State { children: [ Text( i18n.shift_date, - style: UiTypography.titleUppercase4b + style: UiTypography + .titleUppercase4b .textSecondary, ), const SizedBox(height: UiConstants.space2), @@ -288,42 +323,44 @@ class _ShiftDetailsPageState extends State { ], ), ), - + const Divider(height: 1, thickness: 0.5), - // Stats Row (New) - Padding( - padding: const EdgeInsets.all(UiConstants.space5), - child: Row( - children: [ - Expanded( - child: _buildStatCard( - UiIcons.dollar, - "\$${estimatedTotal.toStringAsFixed(0)}", - "Total", + // Break Section + if (displayShift.breakInfo != null && + displayShift.breakInfo!.duration != + BreakDuration.none) ...[ + Padding( + padding: const EdgeInsets.all(UiConstants.space5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "BREAK", + style: UiTypography.titleUppercase4b + .textSecondary, ), - ), - const SizedBox(width: UiConstants.space4), - Expanded( - child: _buildStatCard( - UiIcons.dollar, - "\$${displayShift.hourlyRate.toStringAsFixed(0)}", - "Hourly Rate", + const SizedBox(height: UiConstants.space2), + Row( + children: [ + const Icon( + UiIcons.breakIcon, + size: 20, + color: UiColors.primary, + ), + const SizedBox(width: UiConstants.space2), + Text( + "${displayShift.breakInfo!.duration.minutes} min (${displayShift.breakInfo!.isBreakPaid ? 'Paid' : 'Unpaid'})", + style: + UiTypography.headline5m.textPrimary, + ), + ], ), - ), - const SizedBox(width: UiConstants.space4), - Expanded( - child: _buildStatCard( - UiIcons.clock, - duration.toStringAsFixed(1), - "Hours", - ), - ), - ], + ], + ), ), - ), - - const Divider(height: 1, thickness: 0.5), + const Divider(height: 1, thickness: 0.5), + ], // Location Section (New with Map) Padding( @@ -358,7 +395,8 @@ class _ShiftDetailsPageState extends State { ).showSnackBar( SnackBar( content: Text( - displayShift.locationAddress + displayShift + .locationAddress .isNotEmpty ? displayShift.locationAddress : displayShift.location,