add mix carton

This commit is contained in:
Sai Naw Wun
2020-10-21 02:59:10 +06:30
parent b87703c693
commit 9aefc585ec
23 changed files with 393 additions and 519 deletions

View File

@@ -32,6 +32,8 @@ class Carton {
String userID;
String fcsShipmentID;
String fcsShipmentNumber;
String mixCartonID;
String mixCartonNumber;
int rate;
int weight;
@@ -134,12 +136,15 @@ class Carton {
this.fcsShipmentNumber,
this.cartons,
this.packageIDs,
this.mixCartonID,
this.mixCartonNumber,
this.isShipmentCarton = false,
this.deliveryAddress});
Map<String, dynamic> toMap() {
List _cargoTypes = cargoTypes.map((c) => c.toMap()).toList();
List _packages = packages?.map((c) => c.toJson())?.toList();
List _cartons = cartons?.map((c) => c.toMap())?.toList() ?? [];
return {
"id": id,
'fcs_shipment_id': fcsShipmentID,
@@ -151,6 +156,8 @@ class Carton {
'height': height,
'delivery_address': deliveryAddress.toMap(),
'carton_type': cartonType,
'cartons': _cartons,
'mix_carton_id': mixCartonID
};
}
@@ -158,7 +165,8 @@ class Carton {
var _arrivedDate = (map['arrived_date'] as Timestamp);
var da = map['delivery_address'];
var _da = da != null ? DeliveryAddress.fromMap(da, da["id"]) : null;
var cargoTypesMaps = List<Map<String, dynamic>>.from(map['cargo_types']);
var cargoTypesMaps =
List<Map<String, dynamic>>.from(map['cargo_types'] ?? []);
var cargoTypes =
cargoTypesMaps.map((e) => CargoType.fromMap(e, e["id"])).toList();
return Carton(
@@ -178,6 +186,8 @@ class Carton {
fcsShipmentID: map['fcs_shipment_id'],
fcsShipmentNumber: map['fcs_shipment_number'],
isShipmentCarton: map['is_shipment_carton'],
mixCartonID: map['mix_carton_id'],
mixCartonNumber: map['mix_carton_number'],
status: map['status'],
packageIDs: List<String>.from(map['package_ids'] ?? []),
deliveryAddress: _da,