add shipments

This commit is contained in:
Sai Naw Wun
2020-10-19 05:13:49 +06:30
parent 4f8bde40b0
commit c619ae3f22
57 changed files with 1886 additions and 724 deletions

View File

@@ -75,7 +75,7 @@ class FcsShipmentModel extends BaseModel {
.collection("/$fcs_shipment_collection")
.where("is_delivered", isEqualTo: true)
.where("is_deleted", isEqualTo: false)
.orderBy("current_status_date", descending: true);
.orderBy("status_date", descending: true);
var paginator = new Paginator(pageQuery, rowPerLoad: 20, toObj: (data, id) {
return FcsShipment.fromMap(data, id);
});
@@ -98,6 +98,24 @@ class FcsShipmentModel extends BaseModel {
});
}
Future<List<FcsShipment>> getActiveFcsShipments() async {
List<FcsShipment> fcsShipments = [];
try {
var snaps = await Firestore.instance
.collection("/$fcs_shipment_collection")
.where("status", isEqualTo: fcs_shipment_confirmed_status)
.getDocuments(source: Source.server);
fcsShipments = snaps.documents.map((documentSnapshot) {
var fcs = FcsShipment.fromMap(
documentSnapshot.data, documentSnapshot.documentID);
return fcs;
}).toList();
} catch (e) {
log.warning("Error!! $e");
}
return fcsShipments;
}
void initUser(user) {
super.initUser(user);
}
@@ -116,4 +134,8 @@ class FcsShipmentModel extends BaseModel {
Future<void> update(FcsShipment fcsShipment) {
return Services.instance.fcsShipmentService.updateFcsShipment(fcsShipment);
}
Future<void> ship(FcsShipment fcsShipment) {
return Services.instance.fcsShipmentService.ship(fcsShipment);
}
}