add update shipments
This commit is contained in:
@@ -117,6 +117,7 @@ class ShipmentModel extends BaseModel {
|
||||
var q = Firestore.instance
|
||||
.collection("$path")
|
||||
.where("is_delivered", isEqualTo: false)
|
||||
.where("is_canceled", isEqualTo: false)
|
||||
.where("is_deleted", isEqualTo: false);
|
||||
|
||||
if (forCustomer) {
|
||||
@@ -144,6 +145,21 @@ class ShipmentModel extends BaseModel {
|
||||
shipment_courier_dropoff
|
||||
];
|
||||
|
||||
Future<Shipment> getShipment(String shipmentID) async {
|
||||
String path = "/$shipments_collection";
|
||||
try {
|
||||
var ref = Firestore.instance.collection("$path").document(shipmentID);
|
||||
var snap = await ref.get(source: Source.server);
|
||||
if (snap.exists) {
|
||||
var s = Shipment.fromMap(snap.data, snap.documentID);
|
||||
return s;
|
||||
}
|
||||
} catch (e) {
|
||||
log.warning("Error!! $e");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void initUser(user) {
|
||||
super.initUser(user);
|
||||
}
|
||||
@@ -155,4 +171,8 @@ class ShipmentModel extends BaseModel {
|
||||
Future<void> updateShipment(Shipment shipment) {
|
||||
return Services.instance.shipmentService.updateShipment(shipment);
|
||||
}
|
||||
|
||||
Future<void> cancelShipment(Shipment shipment) {
|
||||
return Services.instance.shipmentService.cancelShipment(shipment);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user