Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
manifest_document.dart
Go to the documentation of this file.
1import 'dart:convert';
2
4 final DateTime? collectionDate;
5 final List<CollectionVoucher>? collectionVoucher;
8 final Partner? driver;
9 final int? id;
12 final DateTime? unloadingDate;
14 final num? firstWeight;
15 final num? secondWeight;
16 final num? totalQuantity;
20
22 this.collectionDate,
23 this.collectionVoucher,
24 this.containerNumber,
25 this.containerType,
26 this.driver,
27 this.id,
28 this.productName,
29 this.reference,
30 this.unloadingDate,
31 this.vehiclePlate,
32 this.firstWeight,
33 this.secondWeight,
34 this.totalQuantity,
35 this.driverSignature,
36 this.warehouseSignature,
37 this.warehouseResponsible,
38 });
39
40 factory ManifestDocument.fromJson(Map<String, dynamic> json) {
41 return ManifestDocument(
42 collectionDate: json['collectionDate'] != null
43 ? DateTime.tryParse(json['collectionDate'])
44 : null,
45 collectionVoucher: (json['collectionVoucher'] as List?)
46 ?.map((v) => CollectionVoucher.fromJson(v))
47 .toList(),
48 containerNumber: json['containerNumber'],
49 containerType: json['containerType'],
50 driver: json['driver'] != null ? Partner.fromJson(json['driver']) : null,
51 id: json['id'],
52 productName: json['productName'] != null
53 ? LocalizedString.fromJsonString(json['productName'])
54 : null,
55 reference: json['reference'],
56 unloadingDate: json['unloadingDate'] != null
57 ? DateTime.tryParse(json['unloadingDate'])
58 : null,
59 vehiclePlate: json['vehiclePlate'],
60 firstWeight: json['firstWeight'],
61 secondWeight: json['secondWeight'],
62 totalQuantity: json['totalQuantity'],
63 driverSignature: json['driverSignature'],
64 warehouseSignature: json['warehouseSignature'],
65 warehouseResponsible: json['warehouseResponsible'],
66 );
67 }
68
69 Map<String, dynamic> toJson() {
70 return {
71 if (collectionDate != null)
72 'collectionDate': collectionDate!.toIso8601String(),
73 if (collectionVoucher != null)
74 'collectionVoucher': collectionVoucher!.map((v) => v.toJson()).toList(),
75 'containerNumber': containerNumber,
76 'containerType': containerType,
77 if (driver != null) 'driver': driver!.toJson(),
78 'id': id,
79 'productName':
80 productName != null ? json.encode(productName!.values) : null,
81 'reference': reference,
82 if (unloadingDate != null)
83 'unloadingDate': unloadingDate!.toIso8601String(),
84 'vehiclePlate': vehiclePlate,
85 'firstWeight': firstWeight,
86 'secondWeight': secondWeight,
87 'totalQuantity': totalQuantity,
88 };
89 }
90}
91
93 final int? id;
94 final String? name;
99
101 this.id,
102 this.name,
103 this.address,
104 this.collectionPoint,
105 this.contactPerson,
106 this.generatorId,
107 });
108
109 factory CollectionVoucher.fromJson(Map<String, dynamic> json) {
110 return CollectionVoucher(
111 id: json['id'],
112 name: json['name'],
113 address: json['address'],
114 collectionPoint: json['collectionPoint'],
115 contactPerson: json['contactPerson'],
116 generatorId: json['generatorId'],
117 );
118 }
119
120 Map<String, dynamic> toJson() => {
121 'id': id,
122 'name': name,
123 'address': address,
124 'collectionPoint': collectionPoint,
125 'contactPerson': contactPerson,
126 'generatorId': generatorId,
127 };
128}
129
130class Partner {
131 final int? id;
132 final bool? isCompany;
133 final String? name;
134 final int? parentId;
135 final String? partnerLatitude;
137 final String? street;
138
140 this.id,
141 this.isCompany,
142 this.name,
143 this.parentId,
144 this.partnerLatitude,
145 this.partnerLongitude,
146 this.street,
147 });
148
149 factory Partner.fromJson(Map<String, dynamic> json) {
150 return Partner(
151 id: json['id'],
152 isCompany: json['isCompany'],
153 name: json['name'],
154 parentId: json['parentId'],
155 partnerLatitude: json['partnerLatitude'],
156 partnerLongitude: json['partnerLongitude'],
157 street: json['street'],
158 );
159 }
160
161 Map<String, dynamic> toJson() => {
162 'id': id,
163 'isCompany': isCompany,
164 'name': name,
165 'parentId': parentId,
166 'partnerLatitude': partnerLatitude,
167 'partnerLongitude': partnerLongitude,
168 'street': street,
169 };
170}
171
172class LocalizedString {
173 final Map<String, String> values;
174
175 LocalizedString(this.values);
176
177 factory LocalizedString.fromJsonString(String jsonStr) {
178 try {
179 final decoded = json.decode(jsonStr);
180 if (decoded is Map<String, dynamic>) {
181 return LocalizedString(
182 decoded.map((k, v) => MapEntry(k, v.toString())),
183 );
184 } else {
185 return LocalizedString({'en_US': jsonStr});
186 }
187 } catch (_) {
188 return LocalizedString({'en_US': jsonStr});
189 }
190 }
191
192 String? get(String locale) => values[locale];
193
194 String? get defaultValue => values['en_US'] ?? values.values.firstOrNull;
195}
AuthGuard _()
final String warehouseResponsible
final DateTime unloadingDate
final LocalizedString productName
final DateTime collectionDate
final List< CollectionVoucher > collectionVoucher
ManifestDocument({ this.collectionDate, this.collectionVoucher, this.containerNumber, this.containerType, this.driver, this.id, this.productName, this.reference, this.unloadingDate, this.vehiclePlate, this.firstWeight, this.secondWeight, this.totalQuantity, this.driverSignature, this.warehouseSignature, this.warehouseResponsible, })
final String containerNumber
final String containerType
final String driverSignature
Map< String, dynamic > toJson()
final String warehouseSignature
Partner({ this.id, this.isCompany, this.name, this.parentId, this.partnerLatitude, this.partnerLongitude, this.street, })
factory Partner fromJson(Map< String, dynamic > json)
Partner({ required this.contactName, required this.id, required this.isCompany, required this.name, required this.parentId, required this.partnerLatitude, required this.partnerLongitude, required this.street, })
Map< String, dynamic > toJson()
Map< String, dynamic > toJson()
CollectionVoucher({ this.id, this.name, this.address, this.collectionPoint, this.contactPerson, this.generatorId, })
class Partner String
final String contactPerson
class Partner values
String get defaultValue
final String generatorId
final String collectionPoint
String get(String locale)
final String address
LocalizedString(this.values)
CollectionVoucher({ this.id, this.name, this.address, this.collectionPoint, this.contactPerson, this.generatorId, })
class Partner String
class Partner values
LocalizedString(this.values)