Use StaffPaths and core imports across staff modules
Centralize and standardize routing by introducing StaffPaths constants (shiftDetailsRoute, formI9, formW4) and using StaffPaths.childRoute in multiple staff feature modules instead of hardcoded paths. Add package:krow_core/core.dart imports where needed, clean up minor formatting/constructor spacing, make some route callbacks explicitly typed, replace shiftDetails string interpolation with the new constant, and remove a debug print from phone verification. These changes unify route definitions and add explicit tax-form routes (I-9 and W-4).
This commit is contained in:
@@ -91,6 +91,11 @@ class StaffPaths {
|
||||
// SHIFT MANAGEMENT
|
||||
// ==========================================================================
|
||||
|
||||
/// Shift details route.
|
||||
///
|
||||
/// View detailed information for a specific shift.
|
||||
static const String shiftDetailsRoute = '/worker-main/shift-details';
|
||||
|
||||
/// Shift details page (dynamic).
|
||||
///
|
||||
/// View detailed information for a specific shift.
|
||||
@@ -98,7 +103,7 @@ class StaffPaths {
|
||||
///
|
||||
/// Example: `/worker-main/shift-details/shift123`
|
||||
static String shiftDetails(String shiftId) =>
|
||||
'/worker-main/shift-details/$shiftId';
|
||||
'$shiftDetailsRoute/$shiftId';
|
||||
|
||||
// ==========================================================================
|
||||
// ONBOARDING & PROFILE SECTIONS
|
||||
@@ -153,6 +158,16 @@ class StaffPaths {
|
||||
/// Manage W-4, tax withholding, and related tax documents.
|
||||
static const String taxForms = '/worker-main/tax-forms';
|
||||
|
||||
/// Form I-9 - Employment Eligibility Verification.
|
||||
///
|
||||
/// Complete and manage I-9 employment verification form.
|
||||
static const String formI9 = '/worker-main/tax-forms/i9';
|
||||
|
||||
/// Form W-4 - Employee's Withholding Certificate.
|
||||
///
|
||||
/// Complete and manage W-4 tax withholding form.
|
||||
static const String formW4 = '/worker-main/tax-forms/w4';
|
||||
|
||||
/// Time card - view detailed time tracking records.
|
||||
///
|
||||
/// Access detailed time entries and timesheets.
|
||||
|
||||
@@ -48,7 +48,6 @@ class _PhoneVerificationPageState extends State<PhoneVerificationPage> {
|
||||
required String phoneNumber,
|
||||
}) {
|
||||
final String normalized = phoneNumber.replaceAll(RegExp(r'\\D'), '');
|
||||
print('Phone verification input: "$normalized" len=${normalized.length}');
|
||||
if (normalized.length == 10) {
|
||||
BlocProvider.of<AuthBloc>(
|
||||
context,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:staff_availability/src/presentation/pages/availability_page.dart';
|
||||
|
||||
@@ -23,18 +24,21 @@ class StaffAvailabilityModule extends Module {
|
||||
firebaseAuth: FirebaseAuth.instance,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
// UseCases
|
||||
i.add(GetWeeklyAvailabilityUseCase.new);
|
||||
i.add(UpdateDayAvailabilityUseCase.new);
|
||||
i.add(ApplyQuickSetUseCase.new);
|
||||
|
||||
|
||||
// BLoC
|
||||
i.add(AvailabilityBloc.new);
|
||||
}
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (_) => const AvailabilityPage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.availability, StaffPaths.availability),
|
||||
child: (_) => const AvailabilityPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
|
||||
import 'data/repositories_impl/clock_in_repository_impl.dart';
|
||||
@@ -15,9 +17,7 @@ class StaffClockInModule extends Module {
|
||||
void binds(Injector i) {
|
||||
// Repositories
|
||||
i.add<ClockInRepositoryInterface>(
|
||||
() => ClockInRepositoryImpl(
|
||||
dataConnect: ExampleConnector.instance,
|
||||
),
|
||||
() => ClockInRepositoryImpl(dataConnect: ExampleConnector.instance),
|
||||
);
|
||||
|
||||
// Use Cases
|
||||
@@ -31,7 +31,10 @@ class StaffClockInModule extends Module {
|
||||
}
|
||||
|
||||
@override
|
||||
void routes(r) {
|
||||
r.child('/', child: (context) => const ClockInPage());
|
||||
void routes(RouteManager r) {
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.clockIn, StaffPaths.clockIn),
|
||||
child: (BuildContext context) => const ClockInPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:staff_home/src/data/repositories/home_repository_impl.dart';
|
||||
import 'package:staff_home/src/domain/repositories/home_repository.dart';
|
||||
import 'package:staff_home/src/presentation/blocs/home_cubit.dart';
|
||||
@@ -14,9 +15,7 @@ class StaffHomeModule extends Module {
|
||||
@override
|
||||
void binds(Injector i) {
|
||||
// Repository
|
||||
i.addLazySingleton<HomeRepository>(
|
||||
() => HomeRepositoryImpl(),
|
||||
);
|
||||
i.addLazySingleton<HomeRepository>(() => HomeRepositoryImpl());
|
||||
|
||||
// Presentation layer - Cubit
|
||||
i.addSingleton(HomeCubit.new);
|
||||
@@ -24,6 +23,9 @@ class StaffHomeModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (BuildContext context) => const WorkerHomePage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.home, StaffPaths.home),
|
||||
child: (BuildContext context) => const WorkerHomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'domain/repositories/payments_repository.dart';
|
||||
import 'domain/usecases/get_payment_summary_usecase.dart';
|
||||
@@ -10,19 +11,22 @@ import 'presentation/pages/payments_page.dart';
|
||||
class StaffPaymentsModule extends Module {
|
||||
@override
|
||||
void binds(Injector i) {
|
||||
// Repositories
|
||||
// Repositories
|
||||
i.add<PaymentsRepository>(PaymentsRepositoryImpl.new);
|
||||
|
||||
|
||||
// Use Cases
|
||||
i.add(GetPaymentSummaryUseCase.new);
|
||||
i.add(GetPaymentHistoryUseCase.new);
|
||||
|
||||
|
||||
// Blocs
|
||||
i.add(PaymentsBloc.new);
|
||||
}
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (context) => const PaymentsPage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.payments, StaffPaths.payments),
|
||||
child: (context) => const PaymentsPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
|
||||
@@ -40,15 +41,15 @@ class StaffProfileModule extends Module {
|
||||
|
||||
// Presentation layer - Cubit depends on use cases
|
||||
i.add<ProfileCubit>(
|
||||
() => ProfileCubit(
|
||||
i.get<GetProfileUseCase>(),
|
||||
i.get<SignOutUseCase>(),
|
||||
),
|
||||
() => ProfileCubit(i.get<GetProfileUseCase>(), i.get<SignOutUseCase>()),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (BuildContext context) => const StaffProfilePage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.profile, StaffPaths.profile),
|
||||
child: (BuildContext context) => const StaffProfilePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
|
||||
import 'data/repositories_impl/certificates_repository_impl.dart';
|
||||
@@ -23,6 +24,9 @@ class StaffCertificatesModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (_) => const CertificatesPage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.certificates, StaffPaths.certificates),
|
||||
child: (_) => const CertificatesPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'data/repositories_impl/documents_repository_impl.dart';
|
||||
import 'domain/repositories/documents_repository.dart';
|
||||
@@ -22,6 +23,9 @@ class StaffDocumentsModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (_) => DocumentsPage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.documents, StaffPaths.documents),
|
||||
child: (_) => DocumentsPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'data/repositories/tax_forms_repository_impl.dart';
|
||||
@@ -23,7 +24,7 @@ class StaffTaxFormsModule extends Module {
|
||||
dataConnect: ExampleConnector.instance,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
// Use Cases
|
||||
i.addLazySingleton(GetTaxFormsUseCase.new);
|
||||
i.addLazySingleton(SubmitI9FormUseCase.new);
|
||||
@@ -37,13 +38,16 @@ class StaffTaxFormsModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (_) => const TaxFormsPage());
|
||||
r.child(
|
||||
'/i9',
|
||||
StaffPaths.childRoute(StaffPaths.taxForms, StaffPaths.taxForms),
|
||||
child: (_) => const TaxFormsPage(),
|
||||
);
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.taxForms, StaffPaths.formI9),
|
||||
child: (_) => FormI9Page(form: r.args.data as TaxForm?),
|
||||
);
|
||||
r.child(
|
||||
'/w4',
|
||||
StaffPaths.childRoute(StaffPaths.taxForms, StaffPaths.formW4),
|
||||
child: (_) => FormW4Page(form: r.args.data as TaxForm?),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart' as auth;
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:staff_bank_account/src/data/repositories/bank_account_repository_impl.dart';
|
||||
|
||||
@@ -38,6 +39,9 @@ class StaffBankAccountModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (_) => const BankAccountPage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.bankAccount, StaffPaths.bankAccount),
|
||||
child: (_) => const BankAccountPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ library staff_time_card;
|
||||
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
|
||||
import 'data/repositories_impl/time_card_repository_impl.dart';
|
||||
@@ -39,6 +40,9 @@ class StaffTimeCardModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (context) => const TimeCardPage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.timeCard, StaffPaths.timeCard),
|
||||
child: (context) => const TimeCardPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
|
||||
import 'data/repositories_impl/attire_repository_impl.dart';
|
||||
@@ -28,6 +29,9 @@ class StaffAttireModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (_) => const AttirePage());
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.attire, StaffPaths.attire),
|
||||
child: (_) => const AttirePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class StaffMainModule extends Module {
|
||||
module: StaffAvailabilityModule(),
|
||||
);
|
||||
r.module(
|
||||
'/shift-details',
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.shiftDetailsRoute),
|
||||
module: ShiftDetailsModule(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user