From 47ecad5a63e24fd03c1c2c7de17c251b600bc95a Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Tue, 27 Jan 2026 15:07:43 -0500 Subject: [PATCH] feat: add new skills to localization files and update experience repository methods --- .../lib/src/l10n/en.i18n.json | 10 +- .../lib/src/l10n/es.i18n.json | 10 +- .../lib/src/l10n/strings.g.dart | 4 +- .../lib/src/l10n/strings_en.g.dart | 28 ++- .../lib/src/l10n/strings_es.g.dart | 16 +- .../experience/analysis_options.yaml | 2 +- .../experience_repository_impl.dart | 14 +- .../presentation/blocs/experience_bloc.dart | 2 + .../presentation/pages/experience_page.dart | 161 ++++++++---------- 9 files changed, 141 insertions(+), 106 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 00aa820f..8adab006 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 @@ -79,7 +79,12 @@ "cleaning": "Cleaning", "security": "Security", "driving": "Driving", - "cooking": "Cooking" + "cooking": "Cooking", + "cashier": "Cashier", + "server": "Server", + "barista": "Barista", + "host_hostess": "Host/Hostess", + "busser": "Busser" }, "industries": { "hospitality": "Hospitality", @@ -577,7 +582,8 @@ "server": "Server", "barista": "Barista", "host_hostess": "Host/Hostess", - "busser": "Busser" + "busser": "Busser", + "driving": "Driving" } } } 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 4cffd42e..ea3fc08c 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 @@ -79,7 +79,12 @@ "cleaning": "Limpieza", "security": "Seguridad", "driving": "Conducción", - "cooking": "Cocina" + "cooking": "Cocina", + "cashier": "Cajero", + "server": "Mesero", + "barista": "Barista", + "host_hostess": "Anfitrión", + "busser": "Ayudante de mesero" }, "industries": { "hospitality": "Hostelería", @@ -576,7 +581,8 @@ "server": "Server", "barista": "Barista", "host_hostess": "Host/Hostess", - "busser": "Busser" + "busser": "Busser", + "driving": "Driving" } } } diff --git a/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart b/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart index 7cabeb39..60de65e3 100644 --- a/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart +++ b/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart @@ -4,9 +4,9 @@ /// To regenerate, run: `dart run slang` /// /// Locales: 2 -/// Strings: 1026 (513 per locale) +/// Strings: 1038 (519 per locale) /// -/// Built on 2026-01-27 at 16:42 UTC +/// Built on 2026-01-27 at 19:37 UTC // coverage:ignore-file // ignore_for_file: type=lint, unused_import diff --git a/apps/mobile/packages/core_localization/lib/src/l10n/strings_en.g.dart b/apps/mobile/packages/core_localization/lib/src/l10n/strings_en.g.dart index 70903846..3f4a7e81 100644 --- a/apps/mobile/packages/core_localization/lib/src/l10n/strings_en.g.dart +++ b/apps/mobile/packages/core_localization/lib/src/l10n/strings_en.g.dart @@ -2420,6 +2420,21 @@ class TranslationsStaffAuthenticationProfileSetupPageExperienceSkillsEn { /// en: 'Cooking' String get cooking => 'Cooking'; + + /// en: 'Cashier' + String get cashier => 'Cashier'; + + /// en: 'Server' + String get server => 'Server'; + + /// en: 'Barista' + String get barista => 'Barista'; + + /// en: 'Host/Hostess' + String get host_hostess => 'Host/Hostess'; + + /// en: 'Busser' + String get busser => 'Busser'; } // Path: staff_authentication.profile_setup_page.experience.industries @@ -2589,6 +2604,9 @@ class TranslationsStaffOnboardingExperienceSkillsEn { /// en: 'Busser' String get busser => 'Busser'; + + /// en: 'Driving' + String get driving => 'Driving'; } // Path: staff.home.improve.items.training @@ -2724,6 +2742,11 @@ extension on Translations { 'staff_authentication.profile_setup_page.experience.skills.security' => 'Security', 'staff_authentication.profile_setup_page.experience.skills.driving' => 'Driving', 'staff_authentication.profile_setup_page.experience.skills.cooking' => 'Cooking', + 'staff_authentication.profile_setup_page.experience.skills.cashier' => 'Cashier', + 'staff_authentication.profile_setup_page.experience.skills.server' => 'Server', + 'staff_authentication.profile_setup_page.experience.skills.barista' => 'Barista', + 'staff_authentication.profile_setup_page.experience.skills.host_hostess' => 'Host/Hostess', + 'staff_authentication.profile_setup_page.experience.skills.busser' => 'Busser', 'staff_authentication.profile_setup_page.experience.industries.hospitality' => 'Hospitality', 'staff_authentication.profile_setup_page.experience.industries.food_service' => 'Food Service', 'staff_authentication.profile_setup_page.experience.industries.warehouse' => 'Warehouse', @@ -3090,6 +3113,7 @@ extension on Translations { 'staff.onboarding.experience.skills.barista' => 'Barista', 'staff.onboarding.experience.skills.host_hostess' => 'Host/Hostess', 'staff.onboarding.experience.skills.busser' => 'Busser', + 'staff.onboarding.experience.skills.driving' => 'Driving', 'staff_documents.title' => 'Documents', 'staff_documents.verification_card.title' => 'Document Verification', 'staff_documents.verification_card.progress' => ({required Object completed, required Object total}) => '${completed}/${total} Complete', @@ -3171,14 +3195,14 @@ extension on Translations { 'staff_time_card.hours_worked' => 'Hours Worked', 'staff_time_card.total_earnings' => 'Total Earnings', 'staff_time_card.shift_history' => 'Shift History', + _ => null, + } ?? switch (path) { 'staff_time_card.no_shifts' => 'No shifts for this month', 'staff_time_card.hours' => 'hours', 'staff_time_card.per_hr' => '/hr', 'staff_time_card.status.approved' => 'Approved', 'staff_time_card.status.disputed' => 'Disputed', 'staff_time_card.status.paid' => 'Paid', - _ => null, - } ?? switch (path) { 'staff_time_card.status.pending' => 'Pending', _ => null, }; diff --git a/apps/mobile/packages/core_localization/lib/src/l10n/strings_es.g.dart b/apps/mobile/packages/core_localization/lib/src/l10n/strings_es.g.dart index f497959c..23fb8610 100644 --- a/apps/mobile/packages/core_localization/lib/src/l10n/strings_es.g.dart +++ b/apps/mobile/packages/core_localization/lib/src/l10n/strings_es.g.dart @@ -1463,6 +1463,11 @@ class _TranslationsStaffAuthenticationProfileSetupPageExperienceSkillsEs impleme @override String get security => 'Seguridad'; @override String get driving => 'Conducción'; @override String get cooking => 'Cocina'; + @override String get cashier => 'Cajero'; + @override String get server => 'Mesero'; + @override String get barista => 'Barista'; + @override String get host_hostess => 'Anfitrión'; + @override String get busser => 'Ayudante de mesero'; } // Path: staff_authentication.profile_setup_page.experience.industries @@ -1564,6 +1569,7 @@ class _TranslationsStaffOnboardingExperienceSkillsEs implements TranslationsStaf @override String get barista => 'Barista'; @override String get host_hostess => 'Host/Hostess'; @override String get busser => 'Busser'; + @override String get driving => 'Driving'; } // Path: staff.home.improve.items.training @@ -1679,6 +1685,11 @@ extension on TranslationsEs { 'staff_authentication.profile_setup_page.experience.skills.security' => 'Seguridad', 'staff_authentication.profile_setup_page.experience.skills.driving' => 'Conducción', 'staff_authentication.profile_setup_page.experience.skills.cooking' => 'Cocina', + 'staff_authentication.profile_setup_page.experience.skills.cashier' => 'Cajero', + 'staff_authentication.profile_setup_page.experience.skills.server' => 'Mesero', + 'staff_authentication.profile_setup_page.experience.skills.barista' => 'Barista', + 'staff_authentication.profile_setup_page.experience.skills.host_hostess' => 'Anfitrión', + 'staff_authentication.profile_setup_page.experience.skills.busser' => 'Ayudante de mesero', 'staff_authentication.profile_setup_page.experience.industries.hospitality' => 'Hostelería', 'staff_authentication.profile_setup_page.experience.industries.food_service' => 'Servicio de comida', 'staff_authentication.profile_setup_page.experience.industries.warehouse' => 'Almacén', @@ -2045,6 +2056,7 @@ extension on TranslationsEs { 'staff.onboarding.experience.skills.barista' => 'Barista', 'staff.onboarding.experience.skills.host_hostess' => 'Host/Hostess', 'staff.onboarding.experience.skills.busser' => 'Busser', + 'staff.onboarding.experience.skills.driving' => 'Driving', 'staff_documents.title' => 'Documents', 'staff_documents.verification_card.title' => 'Document Verification', 'staff_documents.verification_card.progress' => ({required Object completed, required Object total}) => '${completed}/${total} Complete', @@ -2126,14 +2138,14 @@ extension on TranslationsEs { 'staff_time_card.hours_worked' => 'Horas trabajadas', 'staff_time_card.total_earnings' => 'Ganancias totales', 'staff_time_card.shift_history' => 'Historial de turnos', + _ => null, + } ?? switch (path) { 'staff_time_card.no_shifts' => 'No hay turnos para este mes', 'staff_time_card.hours' => 'horas', 'staff_time_card.per_hr' => '/hr', 'staff_time_card.status.approved' => 'Aprobado', 'staff_time_card.status.disputed' => 'Disputado', 'staff_time_card.status.paid' => 'Pagado', - _ => null, - } ?? switch (path) { 'staff_time_card.status.pending' => 'Pendiente', _ => null, }; diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/analysis_options.yaml b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/analysis_options.yaml index 0c1670dc..f9b30346 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/analysis_options.yaml +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/analysis_options.yaml @@ -1 +1 @@ -# include: package:flutter_lints/flutter.yaml +include: package:flutter_lints/flutter.yaml diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/data/repositories/experience_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/data/repositories/experience_repository_impl.dart index f51e5431..49af4cb9 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/data/repositories/experience_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/data/repositories/experience_repository_impl.dart @@ -15,16 +15,16 @@ class ExperienceRepositoryImpl implements ExperienceRepositoryInterface { }) : _dataConnect = dataConnect, _firebaseAuth = firebaseAuth; - Future _getStaff() async { + Future _getStaff() async { final user = _firebaseAuth.currentUser; - if (user == null) { - throw Exception('User not authenticated'); - } - final result = await _dataConnect.getStaffById(id: user.uid).execute(); - if (result.data.staff == null) { + if (user == null) throw Exception('User not authenticated'); + + final result = + await _dataConnect.getStaffByUserId(userId: user.uid).execute(); + if (result.data.staffs.isEmpty) { throw Exception('Staff profile not found'); } - return result.data.staff!; + return result.data.staffs.first; } @override diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/blocs/experience_bloc.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/blocs/experience_bloc.dart index c4787a33..5bd99c77 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/blocs/experience_bloc.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/blocs/experience_bloc.dart @@ -111,6 +111,8 @@ class ExperienceBloc extends Bloc { on(_onSkillToggled); on(_onCustomSkillAdded); on(_onSubmitted); + + add(ExperienceLoaded()); } Future _onLoaded( diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/pages/experience_page.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/pages/experience_page.dart index d939cea3..b001a90b 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/pages/experience_page.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/experience/lib/src/presentation/pages/experience_page.dart @@ -4,25 +4,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:krow_domain/krow_domain.dart'; + import '../blocs/experience_bloc.dart'; -import '../widgets/experience_custom_input.dart'; import '../widgets/experience_section_title.dart'; class ExperiencePage extends StatelessWidget { const ExperiencePage({super.key}); - @override - Widget build(BuildContext context) { - return BlocProvider( - create: (_) => Modular.get()..add(ExperienceLoaded()), - child: const _ExperienceView(), - ); - } -} - -class _ExperienceView extends StatelessWidget { - const _ExperienceView(); - String _getIndustryLabel(dynamic node, Industry industry) { switch (industry) { case Industry.hospitality: return node.hospitality; @@ -61,86 +49,83 @@ class _ExperienceView extends StatelessWidget { final i18n = t.staff.onboarding.experience; return Scaffold( - backgroundColor: UiColors.background, appBar: UiAppBar( title: i18n.title, onLeadingPressed: () => Modular.to.pop(), ), - body: BlocConsumer( - listener: (context, state) { - if (state.status == ExperienceStatus.success) { - Modular.to.pop(); - } - }, - builder: (context, state) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - padding: EdgeInsets.all(UiConstants.space5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ExperienceSectionTitle(title: i18n.industries_title), - Text( - i18n.industries_subtitle, - style: UiTypography.body2m.copyWith(color: UiColors.textSecondary), - ), - SizedBox(height: UiConstants.space3), - Wrap( - spacing: UiConstants.space2, - runSpacing: UiConstants.space2, - children: state.availableIndustries - .map( - (i) => UiChip( - label: _getIndustryLabel(i18n.industries, i), - isSelected: state.selectedIndustries.contains(i), - onTap: () => BlocProvider.of(context) - .add(ExperienceIndustryToggled(i)), - variant: state.selectedIndustries.contains(i) - ? UiChipVariant.primary - : UiChipVariant.secondary, - ), - ) - .toList(), - ), - SizedBox(height: UiConstants.space6), - ExperienceSectionTitle(title: i18n.skills_title), - Text( - i18n.skills_subtitle, - style: UiTypography.body2m.copyWith(color: UiColors.textSecondary), - ), - SizedBox(height: UiConstants.space3), - Wrap( - spacing: UiConstants.space2, - runSpacing: UiConstants.space2, - children: state.availableSkills - .map( - (s) => UiChip( - label: _getSkillLabel(i18n.skills, s), - isSelected: state.selectedSkills.contains(s.value), - onTap: () => BlocProvider.of(context) - .add(ExperienceSkillToggled(s.value)), - variant: state.selectedSkills.contains(s.value) - ? UiChipVariant.primary - : UiChipVariant.secondary, - ), - ) - .toList(), - ), - SizedBox(height: UiConstants.space4), - const ExperienceCustomInput(), - SizedBox(height: UiConstants.space4), - _buildCustomSkillsList(state, i18n), - SizedBox(height: UiConstants.space10), - ], - ), + body: BlocProvider( + create: (context) => Modular.get(), + child: BlocConsumer( + listener: (context, state) { + if (state.status == ExperienceStatus.success) { + Modular.to.pop(); + } + }, + builder: (context, state) { + return Column( + children: [ + Expanded( + child: SingleChildScrollView( + padding: EdgeInsets.all(UiConstants.space5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ExperienceSectionTitle(title: i18n.industries_title), + Text( + i18n.industries_subtitle, + style: UiTypography.body2m.copyWith(color: UiColors.textSecondary), + ), + SizedBox(height: UiConstants.space3), + Wrap( + spacing: UiConstants.space2, + runSpacing: UiConstants.space2, + children: state.availableIndustries + .map( + (i) => UiChip( + label: _getIndustryLabel(i18n.industries, i), + isSelected: state.selectedIndustries.contains(i), + onTap: () => BlocProvider.of(context) + .add(ExperienceIndustryToggled(i)), + variant: state.selectedIndustries.contains(i) + ? UiChipVariant.primary + : UiChipVariant.secondary, + ), + ) + .toList(), + ), + SizedBox(height: UiConstants.space6), + ExperienceSectionTitle(title: i18n.skills_title), + Text( + i18n.skills_subtitle, + style: UiTypography.body2m.copyWith(color: UiColors.textSecondary), + ), + SizedBox(height: UiConstants.space3), + Wrap( + spacing: UiConstants.space2, + runSpacing: UiConstants.space2, + children: state.availableSkills + .map( + (s) => UiChip( + label: _getSkillLabel(i18n.skills, s), + isSelected: state.selectedSkills.contains(s.value), + onTap: () => BlocProvider.of(context) + .add(ExperienceSkillToggled(s.value)), + variant: state.selectedSkills.contains(s.value) + ? UiChipVariant.primary + : UiChipVariant.secondary, + ), + ) + .toList(), + ), + ], + ), + ), ), - ), - _buildSaveButton(context, state, i18n), - ], - ); - }, + _buildSaveButton(context, state, i18n), + ], + ); + }, + ), ), ); }