feat: refactor hub management to use dedicated pages for adding, editing, and viewing hub details.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import 'route_paths.dart';
|
||||
|
||||
@@ -145,6 +146,22 @@ extension ClientNavigator on IModularNavigator {
|
||||
await pushNamed(ClientPaths.hubs);
|
||||
}
|
||||
|
||||
/// Navigates to the details of a specific hub.
|
||||
Future<bool?> toHubDetails(Hub hub) {
|
||||
return pushNamed<bool?>(
|
||||
ClientPaths.hubDetails,
|
||||
arguments: <String, dynamic>{'hub': hub},
|
||||
);
|
||||
}
|
||||
|
||||
/// Navigates to the page to add a new hub or edit an existing one.
|
||||
Future<bool?> toEditHub({Hub? hub}) async {
|
||||
return pushNamed<bool?>(
|
||||
ClientPaths.editHub,
|
||||
arguments: <String, dynamic>{'hub': hub},
|
||||
);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// ORDER CREATION
|
||||
// ==========================================================================
|
||||
|
||||
@@ -16,14 +16,14 @@ class ClientPaths {
|
||||
/// Generate child route based on the given route and parent route
|
||||
///
|
||||
/// This is useful for creating nested routes within modules.
|
||||
static String childRoute(String parent, String child) {
|
||||
static String childRoute(String parent, String child) {
|
||||
final String childPath = child.replaceFirst(parent, '');
|
||||
|
||||
|
||||
// check if the child path is empty
|
||||
if (childPath.isEmpty) {
|
||||
return '/';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ensure the child path starts with a '/'
|
||||
if (!childPath.startsWith('/')) {
|
||||
return '/$childPath';
|
||||
@@ -82,10 +82,12 @@ class ClientPaths {
|
||||
static const String billing = '/client-main/billing';
|
||||
|
||||
/// Completion review page - review shift completion records.
|
||||
static const String completionReview = '/client-main/billing/completion-review';
|
||||
static const String completionReview =
|
||||
'/client-main/billing/completion-review';
|
||||
|
||||
/// Full list of invoices awaiting approval.
|
||||
static const String awaitingApproval = '/client-main/billing/awaiting-approval';
|
||||
static const String awaitingApproval =
|
||||
'/client-main/billing/awaiting-approval';
|
||||
|
||||
/// Invoice ready page - view status of approved invoices.
|
||||
static const String invoiceReady = '/client-main/billing/invoice-ready';
|
||||
@@ -118,6 +120,12 @@ class ClientPaths {
|
||||
/// View and manage physical locations/hubs where staff are deployed.
|
||||
static const String hubs = '/client-hubs';
|
||||
|
||||
/// Specific hub details.
|
||||
static const String hubDetails = '/client-hubs/details';
|
||||
|
||||
/// Page for adding or editing a hub.
|
||||
static const String editHub = '/client-hubs/edit';
|
||||
|
||||
// ==========================================================================
|
||||
// ORDER CREATION & MANAGEMENT
|
||||
// ==========================================================================
|
||||
|
||||
Reference in New Issue
Block a user