feat: integrate bank account addition with user input for bank name and success notification
This commit is contained in:
@@ -517,6 +517,8 @@
|
|||||||
"secure_subtitle": "Your account details are encrypted and safe.",
|
"secure_subtitle": "Your account details are encrypted and safe.",
|
||||||
"primary": "Primary",
|
"primary": "Primary",
|
||||||
"add_new_account": "Add New Account",
|
"add_new_account": "Add New Account",
|
||||||
|
"bank_name": "Bank Name",
|
||||||
|
"bank_hint": "Enter bank name",
|
||||||
"routing_number": "Routing Number",
|
"routing_number": "Routing Number",
|
||||||
"routing_hint": "Enter routing number",
|
"routing_hint": "Enter routing number",
|
||||||
"account_number": "Account Number",
|
"account_number": "Account Number",
|
||||||
@@ -526,7 +528,8 @@
|
|||||||
"savings": "Savings",
|
"savings": "Savings",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"account_ending": "Ending in $last4"
|
"account_ending": "Ending in $last4",
|
||||||
|
"account_added_success": "Bank account added successfully!"
|
||||||
},
|
},
|
||||||
"logout": {
|
"logout": {
|
||||||
"button": "Sign Out"
|
"button": "Sign Out"
|
||||||
|
|||||||
@@ -515,6 +515,8 @@
|
|||||||
"secure_title": "Seguro y Cifrado",
|
"secure_title": "Seguro y Cifrado",
|
||||||
"secure_subtitle": "Su información bancaria está cifrada y almacenada de forma segura. Nunca compartimos sus detalles.",
|
"secure_subtitle": "Su información bancaria está cifrada y almacenada de forma segura. Nunca compartimos sus detalles.",
|
||||||
"add_new_account": "Agregar Nueva Cuenta",
|
"add_new_account": "Agregar Nueva Cuenta",
|
||||||
|
"bank_name": "Nombre del Banco",
|
||||||
|
"bank_hint": "Ingrese nombre del banco",
|
||||||
"routing_number": "Número de Ruta",
|
"routing_number": "Número de Ruta",
|
||||||
"routing_hint": "9 dígitos",
|
"routing_hint": "9 dígitos",
|
||||||
"account_number": "Número de Cuenta",
|
"account_number": "Número de Cuenta",
|
||||||
@@ -525,7 +527,8 @@
|
|||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
"save": "Guardar",
|
"save": "Guardar",
|
||||||
"primary": "Principal",
|
"primary": "Principal",
|
||||||
"account_ending": "Termina en $last4"
|
"account_ending": "Termina en $last4",
|
||||||
|
"account_added_success": "¡Cuenta bancaria agregada exitosamente!"
|
||||||
},
|
},
|
||||||
"logout": {
|
"logout": {
|
||||||
"button": "Cerrar Sesión"
|
"button": "Cerrar Sesión"
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
/// To regenerate, run: `dart run slang`
|
/// To regenerate, run: `dart run slang`
|
||||||
///
|
///
|
||||||
/// Locales: 2
|
/// Locales: 2
|
||||||
/// Strings: 1038 (519 per locale)
|
/// Strings: 1044 (522 per locale)
|
||||||
///
|
///
|
||||||
/// Built on 2026-01-30 at 17:58 UTC
|
/// Built on 2026-01-30 at 19:58 UTC
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint, unused_import
|
// ignore_for_file: type=lint, unused_import
|
||||||
|
|||||||
@@ -2253,6 +2253,12 @@ class TranslationsStaffProfileBankAccountPageEn {
|
|||||||
/// en: 'Add New Account'
|
/// en: 'Add New Account'
|
||||||
String get add_new_account => 'Add New Account';
|
String get add_new_account => 'Add New Account';
|
||||||
|
|
||||||
|
/// en: 'Bank Name'
|
||||||
|
String get bank_name => 'Bank Name';
|
||||||
|
|
||||||
|
/// en: 'Enter bank name'
|
||||||
|
String get bank_hint => 'Enter bank name';
|
||||||
|
|
||||||
/// en: 'Routing Number'
|
/// en: 'Routing Number'
|
||||||
String get routing_number => 'Routing Number';
|
String get routing_number => 'Routing Number';
|
||||||
|
|
||||||
@@ -2282,6 +2288,9 @@ class TranslationsStaffProfileBankAccountPageEn {
|
|||||||
|
|
||||||
/// en: 'Ending in $last4'
|
/// en: 'Ending in $last4'
|
||||||
String account_ending({required Object last4}) => 'Ending in ${last4}';
|
String account_ending({required Object last4}) => 'Ending in ${last4}';
|
||||||
|
|
||||||
|
/// en: 'Bank account added successfully!'
|
||||||
|
String get account_added_success => 'Bank account added successfully!';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path: staff.profile.logout
|
// Path: staff.profile.logout
|
||||||
@@ -3058,6 +3067,8 @@ extension on Translations {
|
|||||||
'staff.profile.bank_account_page.secure_subtitle' => 'Your account details are encrypted and safe.',
|
'staff.profile.bank_account_page.secure_subtitle' => 'Your account details are encrypted and safe.',
|
||||||
'staff.profile.bank_account_page.primary' => 'Primary',
|
'staff.profile.bank_account_page.primary' => 'Primary',
|
||||||
'staff.profile.bank_account_page.add_new_account' => 'Add New Account',
|
'staff.profile.bank_account_page.add_new_account' => 'Add New Account',
|
||||||
|
'staff.profile.bank_account_page.bank_name' => 'Bank Name',
|
||||||
|
'staff.profile.bank_account_page.bank_hint' => 'Enter bank name',
|
||||||
'staff.profile.bank_account_page.routing_number' => 'Routing Number',
|
'staff.profile.bank_account_page.routing_number' => 'Routing Number',
|
||||||
'staff.profile.bank_account_page.routing_hint' => 'Enter routing number',
|
'staff.profile.bank_account_page.routing_hint' => 'Enter routing number',
|
||||||
'staff.profile.bank_account_page.account_number' => 'Account Number',
|
'staff.profile.bank_account_page.account_number' => 'Account Number',
|
||||||
@@ -3068,6 +3079,7 @@ extension on Translations {
|
|||||||
'staff.profile.bank_account_page.cancel' => 'Cancel',
|
'staff.profile.bank_account_page.cancel' => 'Cancel',
|
||||||
'staff.profile.bank_account_page.save' => 'Save',
|
'staff.profile.bank_account_page.save' => 'Save',
|
||||||
'staff.profile.bank_account_page.account_ending' => ({required Object last4}) => 'Ending in ${last4}',
|
'staff.profile.bank_account_page.account_ending' => ({required Object last4}) => 'Ending in ${last4}',
|
||||||
|
'staff.profile.bank_account_page.account_added_success' => 'Bank account added successfully!',
|
||||||
'staff.profile.logout.button' => 'Sign Out',
|
'staff.profile.logout.button' => 'Sign Out',
|
||||||
'staff.onboarding.personal_info.title' => 'Personal Info',
|
'staff.onboarding.personal_info.title' => 'Personal Info',
|
||||||
'staff.onboarding.personal_info.change_photo_hint' => 'Tap to change photo',
|
'staff.onboarding.personal_info.change_photo_hint' => 'Tap to change photo',
|
||||||
@@ -3192,11 +3204,11 @@ extension on Translations {
|
|||||||
'staff_shifts.tags.immediate_start' => 'Immediate start',
|
'staff_shifts.tags.immediate_start' => 'Immediate start',
|
||||||
'staff_shifts.tags.no_experience' => 'No experience',
|
'staff_shifts.tags.no_experience' => 'No experience',
|
||||||
'staff_time_card.title' => 'Timecard',
|
'staff_time_card.title' => 'Timecard',
|
||||||
|
_ => null,
|
||||||
|
} ?? switch (path) {
|
||||||
'staff_time_card.hours_worked' => 'Hours Worked',
|
'staff_time_card.hours_worked' => 'Hours Worked',
|
||||||
'staff_time_card.total_earnings' => 'Total Earnings',
|
'staff_time_card.total_earnings' => 'Total Earnings',
|
||||||
'staff_time_card.shift_history' => 'Shift History',
|
'staff_time_card.shift_history' => 'Shift History',
|
||||||
_ => null,
|
|
||||||
} ?? switch (path) {
|
|
||||||
'staff_time_card.no_shifts' => 'No shifts for this month',
|
'staff_time_card.no_shifts' => 'No shifts for this month',
|
||||||
'staff_time_card.hours' => 'hours',
|
'staff_time_card.hours' => 'hours',
|
||||||
'staff_time_card.per_hr' => '/hr',
|
'staff_time_card.per_hr' => '/hr',
|
||||||
|
|||||||
@@ -1381,6 +1381,8 @@ class _TranslationsStaffProfileBankAccountPageEs implements TranslationsStaffPro
|
|||||||
@override String get secure_title => 'Seguro y Cifrado';
|
@override String get secure_title => 'Seguro y Cifrado';
|
||||||
@override String get secure_subtitle => 'Su información bancaria está cifrada y almacenada de forma segura. Nunca compartimos sus detalles.';
|
@override String get secure_subtitle => 'Su información bancaria está cifrada y almacenada de forma segura. Nunca compartimos sus detalles.';
|
||||||
@override String get add_new_account => 'Agregar Nueva Cuenta';
|
@override String get add_new_account => 'Agregar Nueva Cuenta';
|
||||||
|
@override String get bank_name => 'Nombre del Banco';
|
||||||
|
@override String get bank_hint => 'Ingrese nombre del banco';
|
||||||
@override String get routing_number => 'Número de Ruta';
|
@override String get routing_number => 'Número de Ruta';
|
||||||
@override String get routing_hint => '9 dígitos';
|
@override String get routing_hint => '9 dígitos';
|
||||||
@override String get account_number => 'Número de Cuenta';
|
@override String get account_number => 'Número de Cuenta';
|
||||||
@@ -1392,6 +1394,7 @@ class _TranslationsStaffProfileBankAccountPageEs implements TranslationsStaffPro
|
|||||||
@override String get save => 'Guardar';
|
@override String get save => 'Guardar';
|
||||||
@override String get primary => 'Principal';
|
@override String get primary => 'Principal';
|
||||||
@override String account_ending({required Object last4}) => 'Termina en ${last4}';
|
@override String account_ending({required Object last4}) => 'Termina en ${last4}';
|
||||||
|
@override String get account_added_success => '¡Cuenta bancaria agregada exitosamente!';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path: staff.profile.logout
|
// Path: staff.profile.logout
|
||||||
@@ -2000,6 +2003,8 @@ extension on TranslationsEs {
|
|||||||
'staff.profile.bank_account_page.secure_title' => 'Seguro y Cifrado',
|
'staff.profile.bank_account_page.secure_title' => 'Seguro y Cifrado',
|
||||||
'staff.profile.bank_account_page.secure_subtitle' => 'Su información bancaria está cifrada y almacenada de forma segura. Nunca compartimos sus detalles.',
|
'staff.profile.bank_account_page.secure_subtitle' => 'Su información bancaria está cifrada y almacenada de forma segura. Nunca compartimos sus detalles.',
|
||||||
'staff.profile.bank_account_page.add_new_account' => 'Agregar Nueva Cuenta',
|
'staff.profile.bank_account_page.add_new_account' => 'Agregar Nueva Cuenta',
|
||||||
|
'staff.profile.bank_account_page.bank_name' => 'Nombre del Banco',
|
||||||
|
'staff.profile.bank_account_page.bank_hint' => 'Ingrese nombre del banco',
|
||||||
'staff.profile.bank_account_page.routing_number' => 'Número de Ruta',
|
'staff.profile.bank_account_page.routing_number' => 'Número de Ruta',
|
||||||
'staff.profile.bank_account_page.routing_hint' => '9 dígitos',
|
'staff.profile.bank_account_page.routing_hint' => '9 dígitos',
|
||||||
'staff.profile.bank_account_page.account_number' => 'Número de Cuenta',
|
'staff.profile.bank_account_page.account_number' => 'Número de Cuenta',
|
||||||
@@ -2011,6 +2016,7 @@ extension on TranslationsEs {
|
|||||||
'staff.profile.bank_account_page.save' => 'Guardar',
|
'staff.profile.bank_account_page.save' => 'Guardar',
|
||||||
'staff.profile.bank_account_page.primary' => 'Principal',
|
'staff.profile.bank_account_page.primary' => 'Principal',
|
||||||
'staff.profile.bank_account_page.account_ending' => ({required Object last4}) => 'Termina en ${last4}',
|
'staff.profile.bank_account_page.account_ending' => ({required Object last4}) => 'Termina en ${last4}',
|
||||||
|
'staff.profile.bank_account_page.account_added_success' => '¡Cuenta bancaria agregada exitosamente!',
|
||||||
'staff.profile.logout.button' => 'Cerrar Sesión',
|
'staff.profile.logout.button' => 'Cerrar Sesión',
|
||||||
'staff.onboarding.personal_info.title' => 'Información Personal',
|
'staff.onboarding.personal_info.title' => 'Información Personal',
|
||||||
'staff.onboarding.personal_info.change_photo_hint' => 'Toca para cambiar foto',
|
'staff.onboarding.personal_info.change_photo_hint' => 'Toca para cambiar foto',
|
||||||
@@ -2135,11 +2141,11 @@ extension on TranslationsEs {
|
|||||||
'staff_shifts.tags.immediate_start' => 'Immediate start',
|
'staff_shifts.tags.immediate_start' => 'Immediate start',
|
||||||
'staff_shifts.tags.no_experience' => 'No experience',
|
'staff_shifts.tags.no_experience' => 'No experience',
|
||||||
'staff_time_card.title' => 'Tarjeta de tiempo',
|
'staff_time_card.title' => 'Tarjeta de tiempo',
|
||||||
|
_ => null,
|
||||||
|
} ?? switch (path) {
|
||||||
'staff_time_card.hours_worked' => 'Horas trabajadas',
|
'staff_time_card.hours_worked' => 'Horas trabajadas',
|
||||||
'staff_time_card.total_earnings' => 'Ganancias totales',
|
'staff_time_card.total_earnings' => 'Ganancias totales',
|
||||||
'staff_time_card.shift_history' => 'Historial de turnos',
|
'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.no_shifts' => 'No hay turnos para este mes',
|
||||||
'staff_time_card.hours' => 'horas',
|
'staff_time_card.hours' => 'horas',
|
||||||
'staff_time_card.per_hr' => '/hr',
|
'staff_time_card.per_hr' => '/hr',
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class BankAccountCubit extends Cubit<BankAccountState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addAccount({
|
Future<void> addAccount({
|
||||||
|
required String bankName,
|
||||||
required String routingNumber,
|
required String routingNumber,
|
||||||
required String accountNumber,
|
required String accountNumber,
|
||||||
required String type,
|
required String type,
|
||||||
@@ -47,7 +48,7 @@ class BankAccountCubit extends Cubit<BankAccountState> {
|
|||||||
final BankAccount newAccount = BankAccount(
|
final BankAccount newAccount = BankAccount(
|
||||||
id: '', // Generated by server usually
|
id: '', // Generated by server usually
|
||||||
userId: '', // Handled by Repo/Auth
|
userId: '', // Handled by Repo/Auth
|
||||||
bankName: 'New Bank', // Mock
|
bankName: bankName,
|
||||||
accountNumber: accountNumber,
|
accountNumber: accountNumber,
|
||||||
accountName: '',
|
accountName: '',
|
||||||
sortCode: routingNumber,
|
sortCode: routingNumber,
|
||||||
@@ -63,6 +64,7 @@ class BankAccountCubit extends Cubit<BankAccountState> {
|
|||||||
await loadAccounts();
|
await loadAccounts();
|
||||||
|
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
|
status: BankAccountStatus.accountAdded,
|
||||||
showForm: false, // Close form on success
|
showForm: false, // Close form on success
|
||||||
));
|
));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:krow_domain/krow_domain.dart';
|
import 'package:krow_domain/krow_domain.dart';
|
||||||
|
|
||||||
enum BankAccountStatus { initial, loading, loaded, error }
|
enum BankAccountStatus { initial, loading, loaded, error, accountAdded }
|
||||||
|
|
||||||
class BankAccountState extends Equatable {
|
class BankAccountState extends Equatable {
|
||||||
final BankAccountStatus status;
|
final BankAccountStatus status;
|
||||||
|
|||||||
@@ -44,8 +44,23 @@ class BankAccountPage extends StatelessWidget {
|
|||||||
child: Container(color: UiColors.border, height: 1.0),
|
child: Container(color: UiColors.border, height: 1.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: BlocBuilder<BankAccountCubit, BankAccountState>(
|
body: BlocConsumer<BankAccountCubit, BankAccountState>(
|
||||||
bloc: cubit,
|
bloc: cubit,
|
||||||
|
listener: (BuildContext context, BankAccountState state) {
|
||||||
|
if (state.status == BankAccountStatus.accountAdded) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
strings.account_added_success,
|
||||||
|
style: UiTypography.body2r.textPrimary,
|
||||||
|
),
|
||||||
|
backgroundColor: UiColors.tagSuccess,
|
||||||
|
behavior: SnackBarBehavior.floating,
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
builder: (BuildContext context, BankAccountState state) {
|
builder: (BuildContext context, BankAccountState state) {
|
||||||
if (state.status == BankAccountStatus.loading && state.accounts.isEmpty) {
|
if (state.status == BankAccountStatus.loading && state.accounts.isEmpty) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
@@ -96,8 +111,9 @@ class BankAccountPage extends StatelessWidget {
|
|||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
child: AddAccountForm(
|
child: AddAccountForm(
|
||||||
strings: strings,
|
strings: strings,
|
||||||
onSubmit: (String routing, String account, String type) {
|
onSubmit: (String bankName, String routing, String account, String type) {
|
||||||
cubit.addAccount(
|
cubit.addAccount(
|
||||||
|
bankName: bankName,
|
||||||
routingNumber: routing,
|
routingNumber: routing,
|
||||||
accountNumber: account,
|
accountNumber: account,
|
||||||
type: type,
|
type: type,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import '../blocs/bank_account_cubit.dart';
|
|||||||
|
|
||||||
class AddAccountForm extends StatefulWidget {
|
class AddAccountForm extends StatefulWidget {
|
||||||
final dynamic strings;
|
final dynamic strings;
|
||||||
final Function(String routing, String account, String type) onSubmit;
|
final Function(String bankName, String routing, String account, String type) onSubmit;
|
||||||
final VoidCallback onCancel;
|
final VoidCallback onCancel;
|
||||||
|
|
||||||
const AddAccountForm({super.key, required this.strings, required this.onSubmit, required this.onCancel});
|
const AddAccountForm({super.key, required this.strings, required this.onSubmit, required this.onCancel});
|
||||||
@@ -15,12 +15,14 @@ class AddAccountForm extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AddAccountFormState extends State<AddAccountForm> {
|
class _AddAccountFormState extends State<AddAccountForm> {
|
||||||
|
final TextEditingController _bankNameController = TextEditingController();
|
||||||
final TextEditingController _routingController = TextEditingController();
|
final TextEditingController _routingController = TextEditingController();
|
||||||
final TextEditingController _accountController = TextEditingController();
|
final TextEditingController _accountController = TextEditingController();
|
||||||
String _selectedType = 'CHECKING';
|
String _selectedType = 'CHECKING';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
_bankNameController.dispose();
|
||||||
_routingController.dispose();
|
_routingController.dispose();
|
||||||
_accountController.dispose();
|
_accountController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@@ -44,6 +46,13 @@ class _AddAccountFormState extends State<AddAccountForm> {
|
|||||||
style: UiTypography.headline4m.copyWith(color: UiColors.textPrimary), // Was header4
|
style: UiTypography.headline4m.copyWith(color: UiColors.textPrimary), // Was header4
|
||||||
),
|
),
|
||||||
const SizedBox(height: UiConstants.space4),
|
const SizedBox(height: UiConstants.space4),
|
||||||
|
UiTextField(
|
||||||
|
label: widget.strings.bank_name,
|
||||||
|
hintText: widget.strings.bank_hint,
|
||||||
|
controller: _bankNameController,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
),
|
||||||
|
const SizedBox(height: UiConstants.space4),
|
||||||
UiTextField(
|
UiTextField(
|
||||||
label: widget.strings.routing_number,
|
label: widget.strings.routing_number,
|
||||||
hintText: widget.strings.routing_hint,
|
hintText: widget.strings.routing_hint,
|
||||||
@@ -90,6 +99,7 @@ class _AddAccountFormState extends State<AddAccountForm> {
|
|||||||
text: widget.strings.save,
|
text: widget.strings.save,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
widget.onSubmit(
|
widget.onSubmit(
|
||||||
|
_bankNameController.text,
|
||||||
_routingController.text,
|
_routingController.text,
|
||||||
_accountController.text,
|
_accountController.text,
|
||||||
_selectedType,
|
_selectedType,
|
||||||
|
|||||||
Reference in New Issue
Block a user