From 6f57cae2478a5e1def5e57d4362811bf74f1f6b1 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Fri, 13 Mar 2026 20:47:59 -0400 Subject: [PATCH] feat: Add overridden banner for geofence check with justification and update localization strings --- .../lib/src/l10n/en.i18n.json | 4 ++- .../lib/src/l10n/es.i18n.json | 4 ++- .../geofence_status_banner.dart | 7 ++--- .../overridden_banner.dart | 27 +++++++++++++++++++ 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/overridden_banner.dart 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 5bcb0e57..b7c05176 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 @@ -954,7 +954,9 @@ "override_title": "Justification Required", "override_desc": "Your location could not be verified. Please explain why you are clocking in without location verification.", "override_hint": "Enter your justification...", - "override_submit": "Clock In" + "override_submit": "Clock In", + "overridden_title": "Location Not Verified", + "overridden_desc": "You are clocking in without location verification. Your justification has been recorded." } }, "availability": { 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 9f101f12..a1c3e424 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 @@ -949,7 +949,9 @@ "override_title": "Justificación Requerida", "override_desc": "No se pudo verificar su ubicación. Explique por qué registra entrada sin verificación de ubicación.", "override_hint": "Ingrese su justificación...", - "override_submit": "Registrar Entrada" + "override_submit": "Registrar Entrada", + "overridden_title": "Ubicación No Verificada", + "overridden_desc": "Está registrando entrada sin verificación de ubicación. Su justificación ha sido registrada." } }, "availability": { diff --git a/apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/geofence_status_banner.dart b/apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/geofence_status_banner.dart index ad9e9700..3d7ec47a 100644 --- a/apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/geofence_status_banner.dart +++ b/apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/geofence_status_banner.dart @@ -7,6 +7,7 @@ import '../../bloc/geofence_state.dart'; import 'permission_denied_banner.dart'; import 'permission_denied_forever_banner.dart'; import 'service_disabled_banner.dart'; +import 'overridden_banner.dart'; import 'timeout_banner.dart'; import 'too_far_banner.dart'; import 'verified_banner.dart'; @@ -35,10 +36,10 @@ class GeofenceStatusBanner extends StatelessWidget { /// Determines which banner variant to display based on the current state. Widget _buildBannerForState(GeofenceState state) { - // If the worker overrode the geofence check, show the verified banner - // instead of any failure state — the justification has been recorded. + // If the worker overrode the geofence check, show a warning banner + // indicating location was not verified but justification was recorded. if (state.isGeofenceOverridden) { - return const VerifiedBanner(); + return const OverriddenBanner(); } // 1. Location services disabled. diff --git a/apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/overridden_banner.dart b/apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/overridden_banner.dart new file mode 100644 index 00000000..047192c6 --- /dev/null +++ b/apps/mobile/packages/features/staff/clock_in/lib/src/presentation/widgets/geofence_status_banner/overridden_banner.dart @@ -0,0 +1,27 @@ +import 'package:core_localization/core_localization.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; + +/// Banner shown when the worker has overridden the geofence check with a +/// justification note. Displays a warning indicating location was not verified. +class OverriddenBanner extends StatelessWidget { + /// Creates an [OverriddenBanner]. + const OverriddenBanner({super.key}); + + @override + Widget build(BuildContext context) { + final TranslationsStaffClockInGeofenceEn i18n = Translations.of( + context, + ).staff.clock_in.geofence; + + return UiNoticeBanner( + backgroundColor: UiColors.tagPending, + icon: UiIcons.warning, + iconColor: UiColors.textWarning, + title: i18n.overridden_title, + titleColor: UiColors.textWarning, + description: i18n.overridden_desc, + descriptionColor: UiColors.textWarning, + ); + } +}