Add client view orders feature module

Introduces the client 'View Orders' feature, including domain entity, repository, use case, Cubit, state, navigation extension, UI page, and widget. Integrates the feature into the client main module, updates localization files for English and Spanish, and adds supporting icons to the design system. Also updates the mock repository to provide sample order data.
This commit is contained in:
Achintha Isuru
2026-01-23 11:28:51 -05:00
parent a964fcabd7
commit 960b21ec8c
21 changed files with 1695 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ import 'package:krow_domain/krow_domain.dart';
class OrderRepositoryMock {
/// Returns a list of available [OrderType]s.
Future<List<OrderType>> getOrderTypes() async {
await Future.delayed(const Duration(milliseconds: 500));
await Future<void>.delayed(const Duration(milliseconds: 500));
return const <OrderType>[
OrderType(
id: 'rapid',
@@ -34,11 +34,122 @@ class OrderRepositoryMock {
/// Simulates creating a one-time order.
Future<void> createOneTimeOrder(OneTimeOrder order) async {
await Future.delayed(const Duration(milliseconds: 800));
await Future<void>.delayed(const Duration(milliseconds: 800));
}
/// Simulates creating a rapid order.
Future<void> createRapidOrder(String description) async {
await Future.delayed(const Duration(seconds: 1));
await Future<void>.delayed(const Duration(seconds: 1));
}
/// Returns a mock list of client orders.
Future<List<OrderItem>> getOrders() async {
await Future<void>.delayed(const Duration(milliseconds: 500));
return <OrderItem>[
OrderItem(
id: '1',
title: 'Server - Wedding',
clientName: 'Grand Plaza Hotel',
status: 'filled',
date: DateTime.now()
.add(const Duration(days: 1))
.toIso8601String()
.split('T')[0],
startTime: '16:00',
endTime: '23:00',
location: 'Grand Plaza Hotel, 123 Main St',
locationAddress: 'Grand Plaza Hotel, 123 Main St',
filled: 10,
workersNeeded: 10,
hourlyRate: 22.0,
confirmedApps: List<Map<String, dynamic>>.generate(
10,
(int index) => <String, dynamic>{
'id': 'app_$index',
'worker_id': 'w_$index',
'worker_name': 'Worker ${String.fromCharCode(65 + index)}',
'status': 'confirmed',
'check_in_time': index < 5 ? '15:55' : null,
},
),
),
OrderItem(
id: '2',
title: 'Bartender - Private Event',
clientName: 'Taste of the Town',
status: 'open',
date: DateTime.now()
.add(const Duration(days: 1))
.toIso8601String()
.split('T')[0],
startTime: '18:00',
endTime: '02:00',
location: 'Downtown Loft, 456 High St',
locationAddress: 'Downtown Loft, 456 High St',
filled: 4,
workersNeeded: 5,
hourlyRate: 28.0,
confirmedApps: List<Map<String, dynamic>>.generate(
4,
(int index) => <String, dynamic>{
'id': 'app_b_$index',
'worker_id': 'w_b_$index',
'worker_name': 'Bartender ${index + 1}',
'status': 'confirmed',
},
),
),
OrderItem(
id: '3',
title: 'Event Staff',
clientName: 'City Center',
status: 'in_progress',
date: DateTime.now().toIso8601String().split('T')[0],
startTime: '08:00',
endTime: '16:00',
location: 'Convention Center, 789 Blvd',
locationAddress: 'Convention Center, 789 Blvd',
filled: 15,
workersNeeded: 15,
hourlyRate: 20.0,
confirmedApps: List<Map<String, dynamic>>.generate(
15,
(int index) => <String, dynamic>{
'id': 'app_c_$index',
'worker_id': 'w_c_$index',
'worker_name': 'Staff ${index + 1}',
'status': 'confirmed',
'check_in_time': '07:55',
},
),
),
OrderItem(
id: '4',
title: 'Coat Check',
clientName: 'The Met Museum',
status: 'completed',
date: DateTime.now()
.subtract(const Duration(days: 1))
.toIso8601String()
.split('T')[0],
startTime: '17:00',
endTime: '22:00',
location: 'The Met Museum, 1000 5th Ave',
locationAddress: 'The Met Museum, 1000 5th Ave',
filled: 2,
workersNeeded: 2,
hourlyRate: 18.0,
confirmedApps: List<Map<String, dynamic>>.generate(
2,
(int index) => <String, dynamic>{
'id': 'app_d_$index',
'worker_id': 'w_d_$index',
'worker_name': 'Checker ${index + 1}',
'status': 'confirmed',
'check_in_time': '16:50',
},
),
),
];
}
}