add shipments
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user