add prompt confirmation and update carton

This commit is contained in:
Thinzar Win
2020-12-08 20:24:15 +06:30
parent 1a7b1ce97b
commit 20477b6915
39 changed files with 637 additions and 259 deletions

View File

@@ -5,6 +5,7 @@ class CargoType {
double weight;
bool isChecked;
int qty;
bool isCutomDuty = false;
double get calAmount => (calRate ?? 0) * (calWeight ?? 0);
@@ -29,7 +30,8 @@ class CargoType {
this.calWeight,
this.calRate,
this.isChecked = false,
this.qty = 0});
this.qty = 0,
this.isCutomDuty = false});
Map<String, dynamic> toMap() {
return {
@@ -56,4 +58,8 @@ class CargoType {
String toString() {
return name;
}
bool isChangedForEdit(CargoType cargoType) {
return cargoType.name != this.name || cargoType.rate != this.rate;
}
}

View File

@@ -6,7 +6,6 @@ class CartonSize {
double height;
CartonSize({this.id, this.name, this.length, this.width, this.height});
Map<String, dynamic> toMap() {
return {
'id': id,
@@ -27,4 +26,10 @@ class CartonSize {
);
}
bool isChangedForEdit(CartonSize cartonSize) {
return cartonSize.name != this.name ||
cartonSize.length != this.length ||
cartonSize.width != this.width ||
cartonSize.height != this.height;
}
}

View File

@@ -3,7 +3,9 @@ class CustomDuty {
String productType;
String desc;
double fee;
CustomDuty({this.id, this.productType, this.desc, this.fee});
double shipmentRate;
CustomDuty(
{this.id, this.productType, this.desc, this.fee, this.shipmentRate});
factory CustomDuty.fromMap(Map<String, dynamic> map, String id) {
return CustomDuty(
@@ -28,4 +30,11 @@ class CustomDuty {
@override
int get hashCode => id.hashCode;
bool isChangedForEdit(CustomDuty customDuty) {
return customDuty.productType != this.productType ||
customDuty.fee != this.fee
// ||customDuty.shipmentRate != this.shipmentRate
;
}
}

View File

@@ -35,4 +35,10 @@ class Discount {
status: map['status'],
);
}
bool isChangedForEdit(Discount discount) {
return discount.code != this.code ||
discount.amount != this.amount ||
discount.customerId != this.customerId;
}
}

View File

@@ -20,4 +20,9 @@ class DiscountByWeight {
'discount': discount,
};
}
bool isChangedForEdit(DiscountByWeight discountByWeight) {
return discountByWeight.weight != this.weight ||
discountByWeight.discount != this.discount;
}
}

View File

@@ -66,4 +66,14 @@ class FcsShipment {
bool isConfirmed() {
return status == fcs_shipment_confirmed_status;
}
bool isChangedForEdit(FcsShipment fcsShipment) {
return fcsShipment.shipmentNumber != this.shipmentNumber ||
fcsShipment.cutoffDate != this.cutoffDate ||
fcsShipment.arrivalDate != this.arrivalDate ||
fcsShipment.shipType != this.shipType ||
fcsShipment.consignee != this.consignee ||
fcsShipment.port != this.port ||
fcsShipment.destination != this.destination;
}
}

View File

@@ -131,6 +131,12 @@ class Package {
currentStatusDate: DateTime.parse(json['status_date']));
}
bool isChangedForEdit(Package package) {
return package.trackingID != this.trackingID ||
package.remark != this.remark ||
package.fcsID != this.fcsID;
}
@override
bool operator ==(Object other) => other is Package && other.id == id;

View File

@@ -29,6 +29,12 @@ class Processing {
@override
int get hashCode => id.hashCode;
bool isChangedForEdit(Processing processing) {
return processing.userID != this.userID ||
processing.fcsID != this.fcsID ||
processing.packages != this.packages;
}
@override
String toString() {
return 'Processing{id: $id}';

View File

@@ -44,6 +44,12 @@ class Rate {
};
}
bool isChangedForEdit(Rate rate) {
return rate.freeDeliveryWeight != this.freeDeliveryWeight ||
rate.deliveryFee != this.deliveryFee ||
rate.volumetricRatio != this.volumetricRatio;
}
@override
String toString() {
return 'Rate{deliveryFee:$deliveryFee,freeDeliveryWeight:$freeDeliveryWeight,volumetricRatio:$volumetricRatio}';

View File

@@ -41,4 +41,13 @@ class DeliveryAddress {
'phone_number': phoneNumber,
};
}
bool isChangedForEdit(DeliveryAddress deliveryAddress) {
return deliveryAddress.fullName != this.fullName ||
deliveryAddress.phoneNumber != this.phoneNumber ||
deliveryAddress.addressLine1 != this.addressLine1 ||
deliveryAddress.addressLine2 != this.addressLine2 ||
deliveryAddress.state != this.state ||
deliveryAddress.city != this.city;
}
}