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>
54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
import '../api/types.dart';
|
|
import 'delivery_contact.dart';
|
|
|
|
class DeliveryOrder implements Serializable {
|
|
final int id;
|
|
final bool isNewCustomer;
|
|
final String? note;
|
|
final double totalAmount;
|
|
final double? totalPaid;
|
|
final int? totalItems;
|
|
final List<DeliveryContact> contacts;
|
|
final DeliveryContact? contact;
|
|
|
|
const DeliveryOrder({
|
|
required this.id,
|
|
required this.isNewCustomer,
|
|
this.note,
|
|
required this.totalAmount,
|
|
this.totalPaid,
|
|
this.totalItems,
|
|
required this.contacts,
|
|
this.contact,
|
|
});
|
|
|
|
factory DeliveryOrder.fromJson(Map<String, dynamic> json) {
|
|
return DeliveryOrder(
|
|
id: json['id'] as int,
|
|
isNewCustomer: json['isNewCustomer'] as bool,
|
|
note: json['note'] as String?,
|
|
totalAmount: (json['totalAmount'] as num).toDouble(),
|
|
totalPaid: (json['totalPaid'] as num?)?.toDouble(),
|
|
totalItems: json['totalItems'] as int?,
|
|
contacts: (json['contacts'] as List?)
|
|
?.map((e) => DeliveryContact.fromJson(e as Map<String, dynamic>))
|
|
.toList() ?? [],
|
|
contact: json['contact'] != null
|
|
? DeliveryContact.fromJson(json['contact'] as Map<String, dynamic>)
|
|
: null,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Object?> toJson() => {
|
|
'id': id,
|
|
'isNewCustomer': isNewCustomer,
|
|
'note': note,
|
|
'totalAmount': totalAmount,
|
|
'totalPaid': totalPaid,
|
|
'totalItems': totalItems,
|
|
'contacts': contacts.map((c) => c.toJson()).toList(),
|
|
'contact': contact?.toJson(),
|
|
};
|
|
}
|