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>
82 lines
2.4 KiB
Dart
82 lines
2.4 KiB
Dart
import '../api/types.dart';
|
|
import 'delivery_address.dart';
|
|
import 'delivery_order.dart';
|
|
import 'user_info.dart';
|
|
|
|
class Delivery implements Serializable {
|
|
final int id;
|
|
final int routeFragmentId;
|
|
final int deliveryIndex;
|
|
final List<DeliveryOrder> orders;
|
|
final UserInfo? deliveredBy;
|
|
final DeliveryAddress? deliveryAddress;
|
|
final String? deliveredAt;
|
|
final String? skippedAt;
|
|
final String createdAt;
|
|
final String? updatedAt;
|
|
final bool delivered;
|
|
final bool hasBeenSkipped;
|
|
final bool isSkipped;
|
|
final String name;
|
|
|
|
const Delivery({
|
|
required this.id,
|
|
required this.routeFragmentId,
|
|
required this.deliveryIndex,
|
|
required this.orders,
|
|
this.deliveredBy,
|
|
this.deliveryAddress,
|
|
this.deliveredAt,
|
|
this.skippedAt,
|
|
required this.createdAt,
|
|
this.updatedAt,
|
|
required this.delivered,
|
|
required this.hasBeenSkipped,
|
|
required this.isSkipped,
|
|
required this.name,
|
|
});
|
|
|
|
factory Delivery.fromJson(Map<String, dynamic> json) {
|
|
return Delivery(
|
|
id: json['id'] as int,
|
|
routeFragmentId: json['routeFragmentId'] as int,
|
|
deliveryIndex: json['deliveryIndex'] as int,
|
|
orders: (json['orders'] as List?)
|
|
?.map((e) => DeliveryOrder.fromJson(e as Map<String, dynamic>))
|
|
.toList() ?? [],
|
|
deliveredBy: json['deliveredBy'] != null
|
|
? UserInfo.fromJson(json['deliveredBy'] as Map<String, dynamic>)
|
|
: null,
|
|
deliveryAddress: json['deliveryAddress'] != null
|
|
? DeliveryAddress.fromJson(json['deliveryAddress'] as Map<String, dynamic>)
|
|
: null,
|
|
deliveredAt: json['deliveredAt'] as String?,
|
|
skippedAt: json['skippedAt'] as String?,
|
|
createdAt: json['createdAt'] as String,
|
|
updatedAt: json['updatedAt'] as String?,
|
|
delivered: json['delivered'] as bool,
|
|
hasBeenSkipped: json['hasBeenSkipped'] as bool,
|
|
isSkipped: json['isSkipped'] as bool,
|
|
name: json['name'] as String,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Object?> toJson() => {
|
|
'id': id,
|
|
'routeFragmentId': routeFragmentId,
|
|
'deliveryIndex': deliveryIndex,
|
|
'orders': orders.map((o) => o.toJson()).toList(),
|
|
'deliveredBy': deliveredBy?.toJson(),
|
|
'deliveryAddress': deliveryAddress?.toJson(),
|
|
'deliveredAt': deliveredAt,
|
|
'skippedAt': skippedAt,
|
|
'createdAt': createdAt,
|
|
'updatedAt': updatedAt,
|
|
'delivered': delivered,
|
|
'hasBeenSkipped': hasBeenSkipped,
|
|
'isSkipped': isSkipped,
|
|
'name': name,
|
|
};
|
|
}
|