Implements complete refactor of Ionic Angular logistics app to Flutter/Dart with: - Svrnty dark mode console theme (Material Design 3) - Responsive layouts (mobile, tablet, desktop) following FRONTEND standards - CQRS API integration with Result<T> error handling - OAuth2/OIDC authentication support (mocked for initial testing) - Delivery route and delivery management features - Multi-language support (EN/FR) with i18n - Native integrations (camera, phone calls, maps) - Strict typing throughout codebase - Mock data for UI testing without backend Follows all FRONTEND style guides, design patterns, and conventions. App is running in dark mode and fully responsive across all device sizes. Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
1.7 KiB
Dart
60 lines
1.7 KiB
Dart
import '../api/types.dart';
|
|
|
|
class DeliveryRoute implements Serializable {
|
|
final int id;
|
|
final String name;
|
|
final String? description;
|
|
final int routeFragmentId;
|
|
final int totalDeliveries;
|
|
final int completedDeliveries;
|
|
final int skippedDeliveries;
|
|
final String createdAt;
|
|
final String? updatedAt;
|
|
|
|
const DeliveryRoute({
|
|
required this.id,
|
|
required this.name,
|
|
this.description,
|
|
required this.routeFragmentId,
|
|
required this.totalDeliveries,
|
|
required this.completedDeliveries,
|
|
required this.skippedDeliveries,
|
|
required this.createdAt,
|
|
this.updatedAt,
|
|
});
|
|
|
|
factory DeliveryRoute.fromJson(Map<String, dynamic> json) {
|
|
return DeliveryRoute(
|
|
id: json['id'] as int,
|
|
name: json['name'] as String,
|
|
description: json['description'] as String?,
|
|
routeFragmentId: json['routeFragmentId'] as int,
|
|
totalDeliveries: json['totalDeliveries'] as int,
|
|
completedDeliveries: json['completedDeliveries'] as int,
|
|
skippedDeliveries: json['skippedDeliveries'] as int,
|
|
createdAt: json['createdAt'] as String,
|
|
updatedAt: json['updatedAt'] as String?,
|
|
);
|
|
}
|
|
|
|
double get progress {
|
|
if (totalDeliveries == 0) return 0.0;
|
|
return completedDeliveries / totalDeliveries;
|
|
}
|
|
|
|
int get pendingDeliveries => totalDeliveries - completedDeliveries - skippedDeliveries;
|
|
|
|
@override
|
|
Map<String, Object?> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'description': description,
|
|
'routeFragmentId': routeFragmentId,
|
|
'totalDeliveries': totalDeliveries,
|
|
'completedDeliveries': completedDeliveries,
|
|
'skippedDeliveries': skippedDeliveries,
|
|
'createdAt': createdAt,
|
|
'updatedAt': updatedAt,
|
|
};
|
|
}
|