fix errors

This commit is contained in:
Sai Naw Wun
2020-10-22 04:14:53 +06:30
parent 2021f74872
commit e5540c5491
32 changed files with 1069 additions and 811 deletions

View File

@@ -490,7 +490,7 @@ class _CartonEditorState extends State<CartonEditor> {
showMsgDialog(context, "Error", "Invalid delivery address");
return;
}
if (isSmallBag && _mixCarton == null) {
if (isSmallBag && _mixCarton == null && _isNew) {
showMsgDialog(context, "Error", "Invalid mix carton");
return;
}
@@ -507,7 +507,9 @@ class _CartonEditorState extends State<CartonEditor> {
carton.width = w;
carton.height = h;
carton.deliveryAddress = _deliveryAddress;
carton.cartons = _carton.cartons.where((c) => c.isChecked).toList();
carton.cartons = _carton.cartons == null
? []
: _carton.cartons.where((c) => c.isChecked).toList();
setState(() {
_isLoading = true;
});

View File

@@ -68,17 +68,7 @@ class _CartonListState extends State<CartonList> {
backgroundColor: primaryColor,
title: LocalText(context, "boxes.name",
color: Colors.white, fontSize: 20),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
iconSize: 30, onPressed: () {},
// onPressed: () => showPlacesSearch(context),
),
popupMenu
],
actions: <Widget>[popupMenu],
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {

View File

@@ -174,6 +174,21 @@ class CartonModel extends BaseModel {
.toList();
}
Future<List<Carton>> getCartonsForInvoice(
String fcsShipmentID, String userID) async {
String path = "/$cartons_collection";
var querySnap = await Firestore.instance
.collection(path)
// .where("fcs_shipment_id", isEqualTo: fcsShipmentID)
.where("user_id", isEqualTo: userID)
.where("is_deleted", isEqualTo: false)
.where("is_invoiced", isEqualTo: false)
.getDocuments();
return querySnap.documents
.map((e) => Carton.fromMap(e.data, e.documentID))
.toList();
}
Future<List<Carton>> getMixCartonsByFcsShipment(String fcsShipmentID) async {
String path = "/$cartons_collection";
var querySnap = await Firestore.instance