feat: Update NEXT_SPRINT_TASKS with new tasks and fixes; add routing and navigation extensions for Client and Staff applications

This commit is contained in:
Achintha Isuru
2026-02-04 16:14:57 -05:00
parent c526f74e9f
commit 62bed9fdbf
9 changed files with 924 additions and 0 deletions

View File

@@ -24,6 +24,9 @@
- In places api call in the when the api's not working we need to show a proper error message instead of just an empty list.
- pending should come first in the view order list.
- rename connect name to 'krow-connect' in the project.
- fix "dartdepend_on_referenced_packages" warnings.
- fix "dartunnecessary_library_name" warnings.
- fix lint issues.
- track minimum shift hours in the staff profile and show a warning if they try to apply for shifts that are below their minimum hours.
- this need to be added in the BE and also a FE validation (5 hrs).

View File

@@ -5,3 +5,4 @@ export 'src/domain/usecases/usecase.dart';
export 'src/utils/date_time_utils.dart';
export 'src/presentation/widgets/web_mobile_frame.dart';
export 'src/config/app_config.dart';
export 'src/routing/routing.dart';

View File

@@ -0,0 +1,180 @@
import 'package:flutter_modular/flutter_modular.dart';
import 'route_paths.dart';
/// Typed navigation extension for the Client application.
///
/// This extension provides type-safe navigation methods for all routes
/// in the Client app. All client navigation should use these methods
/// instead of hardcoding route strings.
///
/// Usage:
/// ```dart
/// import 'package:flutter_modular/flutter_modular.dart';
/// import 'package:krow_core/routing.dart';
///
/// // In your widget or bloc
/// Modular.to.toClientSignIn();
/// Modular.to.toClientHome();
/// Modular.to.toOrderDetails('order123');
/// ```
///
/// See also:
/// * [ClientPaths] for route path constants
/// * [StaffNavigator] for Staff app navigation
extension ClientNavigator on IModularNavigator {
// ==========================================================================
// AUTHENTICATION FLOWS
// ==========================================================================
/// Navigates to the client sign-in page.
///
/// This page allows existing clients to log in using email/password
/// or social authentication providers.
void toClientSignIn() {
pushNamed(ClientPaths.signIn);
}
/// Navigates to the client sign-up page.
///
/// This page allows new clients to create an account and provides
/// the initial registration form.
void toClientSignUp() {
pushNamed(ClientPaths.signUp);
}
/// Navigates to the client home dashboard.
///
/// This is typically called after successful authentication or when
/// returning to the main application from a deep feature.
///
/// Uses absolute navigation to ensure proper routing from any context.
void toClientHome() {
navigate(ClientPaths.home);
}
/// Navigates to the client main shell.
///
/// This is the container with bottom navigation. Usually you'd navigate
/// to a specific tab instead (like [toClientHome]).
void toClientMain() {
navigate(ClientPaths.main);
}
// ==========================================================================
// MAIN NAVIGATION TABS
// ==========================================================================
/// Navigates to the Coverage tab.
///
/// Displays workforce coverage analytics and metrics.
void toClientCoverage() {
navigate(ClientPaths.coverage);
}
/// Navigates to the Billing tab.
///
/// Access billing history, invoices, and payment methods.
void toClientBilling() {
navigate(ClientPaths.billing);
}
/// Navigates to the Orders tab.
///
/// View and manage all shift orders with filtering and sorting.
void toClientOrders() {
navigate(ClientPaths.orders);
}
/// Navigates to the Reports tab.
///
/// Generate and view workforce reports and analytics.
void toClientReports() {
navigate(ClientPaths.reports);
}
// ==========================================================================
// SETTINGS
// ==========================================================================
/// Pushes the client settings page.
///
/// Manage account settings, notifications, and app preferences.
void toClientSettings() {
pushNamed(ClientPaths.settings);
}
// ==========================================================================
// HUBS MANAGEMENT
// ==========================================================================
/// Pushes the client hubs management page.
///
/// View and manage physical locations/hubs where staff are deployed.
Future<void> toClientHubs() async {
await pushNamed(ClientPaths.hubs);
}
// ==========================================================================
// ORDER CREATION
// ==========================================================================
/// Pushes the order creation flow entry page.
///
/// This is the starting point for all order creation flows.
void toCreateOrder() {
pushNamed(ClientPaths.createOrder);
}
/// Pushes the rapid order creation flow.
///
/// Quick shift creation with simplified inputs for urgent needs.
void toCreateOrderRapid() {
pushNamed(ClientPaths.createOrderRapid);
}
/// Pushes the one-time order creation flow.
///
/// Create a shift that occurs once at a specific date and time.
void toCreateOrderOneTime() {
pushNamed(ClientPaths.createOrderOneTime);
}
/// Pushes the recurring order creation flow.
///
/// Create shifts that repeat on a defined schedule (daily, weekly, etc.).
void toCreateOrderRecurring() {
pushNamed(ClientPaths.createOrderRecurring);
}
/// Pushes the permanent order creation flow.
///
/// Create a long-term or permanent staffing position.
void toCreateOrderPermanent() {
pushNamed(ClientPaths.createOrderPermanent);
}
// ==========================================================================
// ORDER VIEWING
// ==========================================================================
/// Navigates to the view orders page.
///
/// Browse all orders with filtering, sorting, and status indicators.
void toViewOrders() {
navigate(ClientPaths.viewOrders);
}
/// Navigates to the details page for a specific order.
///
/// Parameters:
/// * [orderId] - The unique identifier for the order to view
///
/// Example:
/// ```dart
/// Modular.to.toOrderDetails('abc123');
/// ```
void toOrderDetails(String orderId) {
navigate(ClientPaths.orderDetails(orderId));
}
}

View File

@@ -0,0 +1,130 @@
/// Centralized route path definitions for the KROW Client application.
///
/// This file contains all route paths used in the Client app, organized by feature.
/// All client navigation should reference these constants to ensure consistency
/// and make route changes easier to manage.
///
/// See also:
/// * [StaffPaths] for Staff app routes
/// * [ClientNavigator] for typed navigation methods
class ClientPaths {
ClientPaths._();
// ==========================================================================
// AUTHENTICATION
// ==========================================================================
/// Root path for the client authentication flow.
///
/// This serves as the entry point for unauthenticated users.
static const String root = '/';
/// Sign-in page where existing clients can log into their account.
///
/// Supports email/password and social authentication.
static const String signIn = '/client-sign-in';
/// Sign-up page where new clients can create an account.
///
/// Collects basic information and credentials for new client registration.
static const String signUp = '/client-sign-up';
// ==========================================================================
// MAIN SHELL & NAVIGATION
// ==========================================================================
/// Main shell route with bottom navigation.
///
/// This is the primary navigation container that hosts tabs for:
/// Home, Coverage, Billing, Orders, and Reports.
static const String main = '/client-main';
/// Home tab - the main dashboard for clients.
///
/// Displays quick actions, upcoming shifts, and recent activity.
static const String home = '/client-main/home';
/// Coverage tab - view coverage analytics and status.
///
/// Shows workforce coverage metrics and analytics.
static const String coverage = '/client-main/coverage';
/// Billing tab - manage billing and invoices.
///
/// Access billing history, payment methods, and invoices.
static const String billing = '/client-main/billing';
/// Orders tab - view and manage shift orders.
///
/// List of all orders with filtering and status tracking.
static const String orders = '/client-main/orders';
/// Reports tab - access various reports and analytics.
///
/// Generate and view workforce reports (placeholder).
static const String reports = '/client-main/reports';
// ==========================================================================
// SETTINGS
// ==========================================================================
/// Client settings and preferences.
///
/// Manage account settings, notifications, and app preferences.
static const String settings = '/client-settings';
// ==========================================================================
// HUBS MANAGEMENT
// ==========================================================================
/// Client hubs (locations) management.
///
/// View and manage physical locations/hubs where staff are deployed.
static const String hubs = '/client-hubs';
// ==========================================================================
// ORDER CREATION & MANAGEMENT
// ==========================================================================
/// Base path for order creation flows.
///
/// Entry point for all order creation types.
static const String createOrder = '/client/create-order';
/// Rapid order creation - quick shift creation flow.
///
/// Simplified flow for creating single shifts quickly.
static const String createOrderRapid = '/client/create-order/rapid';
/// One-time order creation - single occurrence shift.
///
/// Create a shift that occurs once at a specific date/time.
static const String createOrderOneTime = '/client/create-order/one-time';
/// Recurring order creation - repeated shifts.
///
/// Create shifts that repeat on a schedule (daily, weekly, etc.).
static const String createOrderRecurring = '/client/create-order/recurring';
/// Permanent order creation - ongoing position.
///
/// Create a long-term or permanent staffing position.
static const String createOrderPermanent = '/client/create-order/permanent';
// ==========================================================================
// ORDER VIEWING & DETAILS
// ==========================================================================
/// View orders list and details.
///
/// Browse all orders with filtering, sorting, and status indicators.
static const String viewOrders = '/client/view-orders';
/// Order details page (dynamic).
///
/// View detailed information for a specific order.
/// Path format: `/client/view-orders/{orderId}`
///
/// Example: `/client/view-orders/abc123`
static String orderDetails(String orderId) => '$viewOrders/$orderId';
}

View File

@@ -0,0 +1,81 @@
import 'package:flutter_modular/flutter_modular.dart';
/// Base navigation utilities extension for [IModularNavigator].
///
/// Provides helper methods for common navigation patterns that can be used
/// across both Client and Staff applications. These utilities add error handling,
/// logging capabilities, and convenience methods on top of the base Modular
/// navigation API.
///
/// See also:
/// * [ClientNavigator] for Client-specific navigation
/// * [StaffNavigator] for Staff-specific navigation
extension NavigationExtensions on IModularNavigator {
/// Safely navigates to a route with optional error handling.
///
/// This method wraps [navigate] with error handling to prevent navigation
/// failures from crashing the app.
///
/// Parameters:
/// * [path] - The route path to navigate to
/// * [arguments] - Optional arguments to pass to the route
///
/// Returns `true` if navigation was successful, `false` otherwise.
Future<bool> safeNavigate(
String path, {
Object? arguments,
}) async {
try {
navigate(path, arguments: arguments);
return true;
} catch (e) {
// In production, you might want to log this to a monitoring service
// ignore: avoid_print
print('Navigation error to $path: $e');
return false;
}
}
/// Safely pushes a named route with optional error handling.
///
/// This method wraps [pushNamed] with error handling to prevent navigation
/// failures from crashing the app.
///
/// Parameters:
/// * [routeName] - The name of the route to push
/// * [arguments] - Optional arguments to pass to the route
///
/// Returns the result from the pushed route, or `null` if navigation failed.
Future<T?> safePush<T extends Object?>(
String routeName, {
Object? arguments,
}) async {
try {
return await pushNamed<T>(routeName, arguments: arguments);
} catch (e) {
// In production, you might want to log this to a monitoring service
// ignore: avoid_print
print('Push navigation error to $routeName: $e');
return null;
}
}
/// Pops all routes until reaching the root route.
///
/// This is useful for resetting the navigation stack, such as after logout
/// or when returning to the main entry point of the app.
void popToRoot() {
navigate('/');
}
/// Pops the current route if possible.
///
/// Returns `true` if a route was popped, `false` if already at root.
bool popSafe() {
if (canPop()) {
pop();
return true;
}
return false;
}
}

View File

@@ -0,0 +1,50 @@
/// Centralized routing infrastructure for KROW applications.
///
/// This library provides a unified routing solution for both Client and Staff
/// applications, including:
///
/// * Route path constants organized by feature
/// * Type-safe navigation extensions
/// * Base navigation utilities
///
/// ## Usage
///
/// Import this library in your app code to access routing:
///
/// ```dart
/// import 'package:krow_core/routing.dart';
/// ```
///
/// ### Client Navigation
///
/// ```dart
/// // In a Client app widget or bloc
/// Modular.to.toClientHome();
/// Modular.to.toCreateOrder();
/// Modular.to.toOrderDetails('order123');
/// ```
///
/// ### Staff Navigation
///
/// ```dart
/// // In a Staff app widget or bloc
/// Modular.to.toStaffHome();
/// Modular.to.toShiftDetails(shift);
/// Modular.to.toPhoneVerification(AuthMode.login);
/// ```
///
/// ### Direct Path Access
///
/// You can also access route paths directly:
///
/// ```dart
/// final homePath = ClientPaths.home;
/// final shiftsPath = StaffPaths.shifts;
/// ```
library routing;
export 'client/route_paths.dart';
export 'client/navigator.dart';
export 'staff/route_paths.dart';
export 'staff/navigator.dart';
export 'navigation_extensions.dart';

View File

@@ -0,0 +1,304 @@
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_domain/krow_domain.dart';
import 'route_paths.dart';
/// Typed navigation extension for the Staff application.
///
/// This extension provides type-safe navigation methods for all routes
/// in the Staff app. All staff navigation should use these methods
/// instead of hardcoding route strings.
///
/// Usage:
/// ```dart
/// import 'package:flutter_modular/flutter_modular.dart';
/// import 'package:krow_core/routing.dart';
///
/// // In your widget or bloc
/// Modular.to.toStaffHome();
/// Modular.to.toShiftDetails(shift);
/// Modular.to.toPhoneVerification('login'); // 'login' or 'signup'
/// ```
///
/// See also:
/// * [StaffPaths] for route path constants
/// * [ClientNavigator] for Client app navigation
extension StaffNavigator on IModularNavigator {
// ==========================================================================
// AUTHENTICATION FLOWS
// ==========================================================================
/// Navigates to the phone verification page.
///
/// Used for both login and signup flows to verify phone numbers via OTP.
///
/// Parameters:
/// * [mode] - The authentication mode: 'login' or 'signup'
///
/// The mode is passed as an argument and used by the verification page
/// to determine the appropriate flow.
void toPhoneVerification(String mode) {
pushNamed(
StaffPaths.phoneVerification,
arguments: <String, String>{'mode': mode},
);
}
/// Navigates to the profile setup page, replacing the current route.
///
/// This is typically called after successful phone verification for new
/// staff members. Uses pushReplacement to prevent going back to verification.
void toProfileSetup() {
pushReplacementNamed(StaffPaths.profileSetup);
}
// ==========================================================================
// MAIN NAVIGATION
// ==========================================================================
/// Navigates to the staff home dashboard.
///
/// This is the main landing page for authenticated staff members.
/// Displays shift cards, quick actions, and notifications.
void toStaffHome() {
pushNamed(StaffPaths.home);
}
/// Navigates to the staff main shell.
///
/// This is the container with bottom navigation. Navigates to home tab
/// by default. Usually you'd navigate to a specific tab instead.
void toStaffMain() {
navigate('${StaffPaths.main}/home/');
}
// ==========================================================================
// MAIN NAVIGATION TABS
// ==========================================================================
/// Navigates to the Shifts tab.
///
/// Browse available shifts, accepted shifts, and shift history.
///
/// Parameters:
/// * [selectedDate] - Optional date to pre-select in the shifts view
/// * [initialTab] - Optional initial tab (via query parameter)
void toShifts({DateTime? selectedDate, String? initialTab}) {
final Map<String, dynamic> args = <String, dynamic>{};
if (selectedDate != null) {
args['selectedDate'] = selectedDate;
}
if (initialTab != null) {
args['initialTab'] = initialTab;
}
navigate(
StaffPaths.shifts,
arguments: args.isEmpty ? null : args,
);
}
/// Navigates to the Payments tab.
///
/// View payment history, earnings breakdown, and tax information.
void toPayments() {
navigate(StaffPaths.payments);
}
/// Navigates to the Clock In tab.
///
/// Access time tracking interface for active shifts.
void toClockIn() {
navigate(StaffPaths.clockIn);
}
/// Navigates to the Profile tab.
///
/// Manage personal information, documents, and preferences.
void toProfile() {
navigate(StaffPaths.profile);
}
// ==========================================================================
// SHIFT MANAGEMENT
// ==========================================================================
/// Navigates to the shift details page for a specific shift.
///
/// Displays comprehensive information about a shift including location,
/// time, pay rate, and action buttons for accepting/declining/applying.
///
/// Parameters:
/// * [shift] - The shift entity to display details for
///
/// The shift object is passed as an argument and can be retrieved
/// in the details page.
void toShiftDetails(Shift shift) {
navigate(
StaffPaths.shiftDetails(shift.id),
arguments: shift,
);
}
/// Pushes the shift details page (alternative method).
///
/// Same as [toShiftDetails] but using pushNamed instead of navigate.
/// Use this when you want to add the details page to the stack rather
/// than replacing the current route.
void pushShiftDetails(Shift shift) {
pushNamed(
StaffPaths.shiftDetails(shift.id),
arguments: shift,
);
}
// ==========================================================================
// ONBOARDING & PROFILE SECTIONS
// ==========================================================================
/// Pushes the personal information page.
///
/// Collect or edit basic personal information.
void toPersonalInfo() {
pushNamed(StaffPaths.onboardingPersonalInfo);
}
/// Pushes the emergency contact page.
///
/// Manage emergency contact details for safety purposes.
void toEmergencyContact() {
pushNamed(StaffPaths.emergencyContact);
}
/// Pushes the work experience page.
///
/// Record previous work experience and qualifications.
void toExperience() {
pushNamed(StaffPaths.experience);
}
/// Pushes the attire preferences page.
///
/// Record sizing and appearance information for uniform allocation.
void toAttire() {
pushNamed(StaffPaths.attire);
}
// ==========================================================================
// COMPLIANCE & DOCUMENTS
// ==========================================================================
/// Pushes the documents management page.
///
/// Upload and manage required documents like ID and work permits.
void toDocuments() {
pushNamed(StaffPaths.documents);
}
/// Pushes the certificates management page.
///
/// Manage professional certificates (e.g., food handling, CPR).
void toCertificates() {
pushNamed(StaffPaths.certificates);
}
// ==========================================================================
// FINANCIAL INFORMATION
// ==========================================================================
/// Pushes the bank account information page.
///
/// Manage banking details for direct deposit payments.
void toBankAccount() {
pushNamed(StaffPaths.bankAccount);
}
/// Pushes the tax forms page.
///
/// Manage W-4, tax withholding, and related tax documents.
void toTaxForms() {
pushNamed(StaffPaths.taxForms);
}
/// Pushes the time card page.
///
/// View detailed time entries and timesheets.
void toTimeCard() {
pushNamed(StaffPaths.timeCard);
}
// ==========================================================================
// SCHEDULING & AVAILABILITY
// ==========================================================================
/// Pushes the availability management page.
///
/// Define when the staff member is available to work.
void toAvailability() {
pushNamed(StaffPaths.availability);
}
// ==========================================================================
// ADDITIONAL FEATURES
// ==========================================================================
/// Pushes the Krow University page (placeholder).
///
/// Access training materials and educational courses.
void toKrowUniversity() {
pushNamed(StaffPaths.krowUniversity);
}
/// Pushes the trainings page (placeholder).
///
/// View and complete required training modules.
void toTrainings() {
pushNamed(StaffPaths.trainings);
}
/// Pushes the leaderboard page (placeholder).
///
/// View performance rankings and achievements.
void toLeaderboard() {
pushNamed(StaffPaths.leaderboard);
}
/// Pushes the FAQs page.
///
/// Access frequently asked questions and help resources.
void toFaqs() {
pushNamed(StaffPaths.faqs);
}
/// Pushes the privacy and security settings page.
///
/// Manage privacy preferences and security settings.
void toPrivacy() {
pushNamed(StaffPaths.privacy);
}
/// Pushes the messages page (placeholder).
///
/// Access internal messaging system.
void toMessages() {
pushNamed(StaffPaths.messages);
}
/// Pushes the settings page (placeholder).
///
/// General app settings and preferences.
void toSettings() {
pushNamed(StaffPaths.settings);
}
// ==========================================================================
// SPECIAL NAVIGATION
// ==========================================================================
/// Navigates to the get started/authentication screen.
///
/// This effectively logs out the user by navigating to root.
/// Used when signing out or session expires.
void toGetStarted() {
navigate(StaffPaths.root);
}
}

View File

@@ -0,0 +1,173 @@
/// Centralized route path definitions for the KROW Staff application.
///
/// This file contains all route paths used in the Staff app, organized by feature.
/// All staff navigation should reference these constants to ensure consistency
/// and make route changes easier to manage.
///
/// See also:
/// * [ClientPaths] for Client app routes
/// * [StaffNavigator] for typed navigation methods
class StaffPaths {
StaffPaths._();
// ==========================================================================
// AUTHENTICATION
// ==========================================================================
/// Root path for the staff authentication flow.
///
/// This serves as the entry point for unauthenticated staff members.
static const String root = '/';
/// Phone verification page (relative path within auth module).
///
/// Used for both login and signup flows to verify phone numbers via OTP.
/// Expects `mode` argument: 'login' or 'signup'
static const String phoneVerification = './phone-verification';
/// Profile setup page (relative path within auth module).
///
/// Initial profile setup for new staff members after verification.
static const String profileSetup = './profile-setup';
// ==========================================================================
// MAIN SHELL & NAVIGATION
// ==========================================================================
/// Main shell route with bottom navigation.
///
/// This is the primary navigation container that hosts tabs for:
/// Shifts, Payments, Home, Clock In, and Profile.
static const String main = '/worker-main';
/// Home tab - the main dashboard for staff.
///
/// Displays shift cards, quick actions, and notifications.
static const String home = '/worker-main/home';
/// Shifts tab - view and manage shifts.
///
/// Browse available shifts, accepted shifts, and shift history.
static const String shifts = '/worker-main/shifts';
/// Payments tab - view payment history and earnings.
///
/// Access payment history, earnings breakdown, and tax information.
static const String payments = '/worker-main/payments';
/// Clock In tab - clock in/out functionality.
///
/// Time tracking interface for active shifts.
static const String clockIn = '/worker-main/clock-in';
/// Profile tab - staff member profile and settings.
///
/// Manage personal information, documents, and preferences.
static const String profile = '/worker-main/profile';
// ==========================================================================
// SHIFT MANAGEMENT
// ==========================================================================
/// Shift details page (dynamic).
///
/// View detailed information for a specific shift.
/// Path format: `/worker-main/shift-details/{shiftId}`
///
/// Example: `/worker-main/shift-details/shift123`
static String shiftDetails(String shiftId) =>
'/worker-main/shift-details/$shiftId';
// ==========================================================================
// ONBOARDING & PROFILE SECTIONS
// ==========================================================================
/// Personal information onboarding.
///
/// Collect basic personal information during staff onboarding.
static const String onboardingPersonalInfo = '/worker-main/onboarding/personal-info';
/// Emergency contact information.
///
/// Manage emergency contact details for safety purposes.
static const String emergencyContact = '/worker-main/emergency-contact';
/// Work experience information.
///
/// Record previous work experience and qualifications.
static const String experience = '/worker-main/experience';
/// Attire and appearance preferences.
///
/// Record sizing and appearance information for uniform allocation.
static const String attire = '/worker-main/attire';
// ==========================================================================
// COMPLIANCE & DOCUMENTS
// ==========================================================================
/// Documents management - upload and manage required documents.
///
/// Store ID, work permits, and other required documentation.
static const String documents = '/worker-main/documents';
/// Certificates management - professional certifications.
///
/// Manage professional certificates (e.g., food handling, CPR, etc.).
static const String certificates = '/worker-main/certificates';
// ==========================================================================
// FINANCIAL INFORMATION
// ==========================================================================
/// Bank account information for direct deposit.
///
/// Manage banking details for payment processing.
static const String bankAccount = '/worker-main/bank-account';
/// Tax forms and withholding information.
///
/// Manage W-4, tax withholding, and related tax documents.
static const String taxForms = '/worker-main/tax-forms';
/// Time card - view detailed time tracking records.
///
/// Access detailed time entries and timesheets.
static const String timeCard = '/worker-main/time-card';
// ==========================================================================
// SCHEDULING & AVAILABILITY
// ==========================================================================
/// Availability management - set working hours preferences.
///
/// Define when the staff member is available to work.
static const String availability = '/worker-main/availability';
// ==========================================================================
// ADDITIONAL FEATURES (Placeholders)
// ==========================================================================
/// Krow University - training and education (placeholder).
///
/// Access to training materials and courses.
static const String krowUniversity = '/krow-university';
/// Training modules (placeholder).
static const String trainings = '/trainings';
/// Leaderboard - performance rankings (placeholder).
static const String leaderboard = '/leaderboard';
/// FAQs - frequently asked questions.
static const String faqs = '/faqs';
/// Privacy and security settings.
static const String privacy = '/privacy';
/// Messages - internal messaging system (placeholder).
static const String messages = '/messages';
/// General settings (placeholder).
static const String settings = '/settings';
}

View File

@@ -13,3 +13,5 @@ dependencies:
sdk: flutter
design_system:
path: ../design_system
equatable: ^2.0.8
flutter_modular: ^6.4.1