chore: add localization to benefits overview page (en & es)

This commit is contained in:
2026-02-24 16:25:24 +05:30
parent 7e26b54c50
commit a7b34e40c8
3 changed files with 188 additions and 154 deletions

View File

@@ -536,6 +536,21 @@
"sick_days": "Sick Days",
"vacation": "Vacation",
"holidays": "Holidays"
},
"overview": {
"title": "Your Benefits Overview",
"subtitle": "Manage and track your earned benefits here",
"request_payment": "Request Payment for $benefit",
"request_submitted": "Request submitted for $benefit",
"sick_leave_subtitle": "You need at least 8 hours to request sick leave",
"vacation_subtitle": "You need 40 hours to claim vacation pay",
"holidays_subtitle": "Pay holidays: Thanksgiving, Christmas, New Year",
"sick_leave_history": "SICK LEAVE HISTORY",
"compliance_banner": "Listed certificates are mandatory for employees. If the employee does not have the complete certificates, they can't proceed with their registration.",
"status": {
"pending": "Pending",
"submitted": "Submitted"
}
}
},
"auto_match": {

View File

@@ -536,6 +536,21 @@
"sick_days": "D\u00edas de Enfermedad",
"vacation": "Vacaciones",
"holidays": "Festivos"
},
"overview": {
"title": "Resumen de tus Beneficios",
"subtitle": "Gestiona y sigue tus beneficios ganados aqu\u00ed",
"request_payment": "Solicitar pago por $benefit",
"request_submitted": "Solicitud enviada para $benefit",
"sick_leave_subtitle": "Necesitas al menos 8 horas para solicitar d\u00edas de enfermedad",
"vacation_subtitle": "Necesitas 40 horas para reclamar el pago de vacaciones",
"holidays_subtitle": "D\u00edas festivos pagados: Acci\u00f3n de Gracias, Navidad, A\u00f1o Nuevo",
"sick_leave_history": "HISTORIAL DE D\u00cdAS DE ENFERMEDAD",
"compliance_banner": "Los certificados listados son obligatorios para los empleados. Si el empleado no tiene los certificados completos, no puede proceder con su registro.",
"status": {
"pending": "Pendiente",
"submitted": "Enviado"
}
}
},
"auto_match": {

View File

@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
import 'package:core_localization/core_localization.dart';
import 'package:staff_home/src/presentation/blocs/home_cubit.dart';
import 'dart:math' as math;
@@ -59,12 +60,12 @@ class BenefitsOverviewPage extends StatelessWidget {
title: Column(
children: [
Text(
'Your Benefits Overview',
t.staff.home.benefits.overview.title,
style: UiTypography.title2b.textPrimary,
),
const SizedBox(height: 2),
Text(
'Manage and track your earned benefits here',
t.staff.home.benefits.overview.subtitle,
style: UiTypography.footnote2r.textSecondary,
),
],
@@ -88,6 +89,8 @@ class _BenefitCard extends StatelessWidget {
final bool isVacation = benefit.title.toLowerCase().contains('vacation');
final bool isHolidays = benefit.title.toLowerCase().contains('holiday');
final i18n = t.staff.home.benefits.overview;
return Container(
padding: const EdgeInsets.all(UiConstants.space6),
decoration: BoxDecoration(
@@ -135,17 +138,17 @@ class _BenefitCard extends StatelessWidget {
),
const SizedBox(height: UiConstants.space6),
if (isSickLeave) ...[
const _AccordionHistory(label: 'SICK LEAVE HISTORY'),
_AccordionHistory(label: i18n.sick_leave_history),
const SizedBox(height: UiConstants.space6),
],
if (isVacation || isHolidays) ...[
_buildComplianceBanner(),
_buildComplianceBanner(i18n.compliance_banner),
const SizedBox(height: UiConstants.space6),
],
SizedBox(
width: double.infinity,
child: UiButton.primary(
text: 'Request Payment for ${benefit.title}',
text: i18n.request_payment(benefit: benefit.title),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF0038A8),
padding: const EdgeInsets.symmetric(vertical: 16),
@@ -155,7 +158,7 @@ class _BenefitCard extends StatelessWidget {
),
onPressed: () {
// TODO: Implement payment request
UiSnackbar.show(context, message: 'Request submitted for ${benefit.title}', type: UiSnackbarType.success);
UiSnackbar.show(context, message: i18n.request_submitted(benefit: benefit.title), type: UiSnackbarType.success);
},
),
),
@@ -191,7 +194,7 @@ class _BenefitCard extends StatelessWidget {
style: UiTypography.body2b.textPrimary.copyWith(fontSize: 14),
),
Text(
'hours',
t.client_billing.hours_suffix,
style: UiTypography.footnote2r.textTertiary.copyWith(fontSize: 9),
),
],
@@ -202,17 +205,18 @@ class _BenefitCard extends StatelessWidget {
}
String _getSubtitle(String title) {
final i18n = t.staff.home.benefits.overview;
if (title.toLowerCase().contains('sick')) {
return 'You need at least 8 hours to request sick leave';
return i18n.sick_leave_subtitle;
} else if (title.toLowerCase().contains('vacation')) {
return 'You need 40 hours to claim vacation pay';
return i18n.vacation_subtitle;
} else if (title.toLowerCase().contains('holiday')) {
return 'Pay holidays: Thanksgiving, Christmas, New Year';
return i18n.holidays_subtitle;
}
return '';
}
Widget _buildComplianceBanner() {
Widget _buildComplianceBanner(String text) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
@@ -226,7 +230,7 @@ class _BenefitCard extends StatelessWidget {
const SizedBox(width: 8),
Expanded(
child: Text(
'Listed certificates are mandatory for employees. If the employee does not have the complete certificates, they can\'t proceed with their registration.',
text,
style: UiTypography.footnote1r.copyWith(
color: const Color(0xFF065F46),
fontSize: 11,