add carton editor for package

This commit is contained in:
tzw
2024-02-05 17:49:12 +06:30
parent afb980e6ae
commit a9e16ede8f
17 changed files with 1216 additions and 82 deletions

View File

@@ -14,6 +14,7 @@ class Package {
DateTime? currentStatusDate;
List<String> photoUrls;
List<ShipmentStatus> shipmentHistory;
List<String> cartonIds;
String? desc;
String? status;
@@ -69,7 +70,8 @@ class Package {
this.deliveryAddress,
this.isChecked = false,
this.photoFiles = const [],
this.senderPhoneNumber});
this.senderPhoneNumber,
this.cartonIds = const []});
factory Package.fromMap(Map<String, dynamic> map, String docID) {
var _currentStatusDate = (map['status_date'] as Timestamp);
@@ -82,6 +84,9 @@ class Package {
var da = map['delivery_address'];
var _da = da != null ? DeliveryAddress.fromMap(da, da["id"]) : null;
List<String> cartonIds =
map['carton_ids'] == null ? [] : List.from(map['carton_ids']);
return Package(
id: docID,
userID: map['user_id'],
@@ -99,7 +104,8 @@ class Package {
deliveryAddress: _da,
currentStatusDate: _currentStatusDate.toDate().toLocal(),
photoUrls: _photoUrls,
shipmentHistory: _shipmentStatus);
shipmentHistory: _shipmentStatus,
cartonIds: cartonIds);
}
Map<String, dynamic> toJson() => {