update carton form ,info and filter
This commit is contained in:
@@ -15,7 +15,6 @@ class CartonDataProvider {
|
|||||||
Future<Carton> createCarton(Carton carton) async {
|
Future<Carton> createCarton(Carton carton) async {
|
||||||
var data = await requestAPI("/cartons", "POST",
|
var data = await requestAPI("/cartons", "POST",
|
||||||
payload: carton.toMap(), token: await getToken());
|
payload: carton.toMap(), token: await getToken());
|
||||||
print("carton data:${data}");
|
|
||||||
return Carton.fromMap(data, data['id']);
|
return Carton.fromMap(data, data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +31,6 @@ class CartonDataProvider {
|
|||||||
Future<Carton> createMixCarton(Carton carton) async {
|
Future<Carton> createMixCarton(Carton carton) async {
|
||||||
var data = await requestAPI("/cartons", "POST",
|
var data = await requestAPI("/cartons", "POST",
|
||||||
payload: carton.toMapForMix(), token: await getToken());
|
payload: carton.toMapForMix(), token: await getToken());
|
||||||
print("carton mix data:${data}");
|
|
||||||
return Carton.fromMap(data, data['id']);
|
return Carton.fromMap(data, data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,10 @@ class CargoType {
|
|||||||
|
|
||||||
factory CargoType.fromMapForCargo(Map<String, dynamic> map, String id) {
|
factory CargoType.fromMapForCargo(Map<String, dynamic> map, String id) {
|
||||||
return CargoType(
|
return CargoType(
|
||||||
id: id, name: map['name'], weight: map['weight']?.toDouble() ?? 0);
|
id: id,
|
||||||
|
name: map['name'],
|
||||||
|
weight: map['weight']?.toDouble() ?? 0,
|
||||||
|
displayIndex: map['display_index'] ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
factory CargoType.fromMapForsurcharge(Map<String, dynamic> map, String id) {
|
factory CargoType.fromMapForsurcharge(Map<String, dynamic> map, String id) {
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
_mixCartons = await context
|
_mixCartons = await context
|
||||||
.read<CartonModel>()
|
.read<CartonModel>()
|
||||||
.getCartonsByIds(_carton.cartonIDs);
|
.getCartonsByIds(_carton.cartonIDs);
|
||||||
|
_cargoTypes.sort((a, b) => a.name!.compareTo(b.name!));
|
||||||
|
_surchareItems.sort((a, b) => a.name!.compareTo(b.name!));
|
||||||
}
|
}
|
||||||
|
|
||||||
totalWeight =
|
totalWeight =
|
||||||
@@ -156,13 +158,17 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final lastMileBox = DisplayText(
|
final lastMileBox = DisplayText(
|
||||||
text: _carton.lastMile == delivery_caton ? 'Delivery' : 'Pick-up',
|
text: _carton.lastMile == delivery_caton
|
||||||
|
? 'Delivery'
|
||||||
|
: _carton.lastMile == pickup_carton
|
||||||
|
? 'Pick-up'
|
||||||
|
: '',
|
||||||
labelTextKey: "box.delivery_type",
|
labelTextKey: "box.delivery_type",
|
||||||
);
|
);
|
||||||
|
|
||||||
final cartonSizeBox = DisplayText(
|
final cartonSizeBox = DisplayText(
|
||||||
subText: Text("${boxDimension ?? 'No defined size'}"),
|
subText: Text("${boxDimension ?? 'No defined size'}"),
|
||||||
labelTextKey: "box.carton_size",
|
labelTextKey: "box.select_carton_size",
|
||||||
);
|
);
|
||||||
|
|
||||||
final senderBox = DisplayText(
|
final senderBox = DisplayText(
|
||||||
@@ -192,6 +198,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
|
|
||||||
final userRowBox = Row(
|
final userRowBox = Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -228,7 +235,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final cargosBox = Padding(
|
final cargosBox = Padding(
|
||||||
padding: const EdgeInsets.only(top: 15),
|
padding: const EdgeInsets.only(top: 20),
|
||||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@@ -237,10 +244,13 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
color: Colors.black54,
|
color: Colors.black54,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.normal),
|
fontWeight: FontWeight.normal),
|
||||||
Padding(
|
_cargoTypes.isNotEmpty
|
||||||
|
? Padding(
|
||||||
padding: EdgeInsets.only(right: 50),
|
padding: EdgeInsets.only(right: 50),
|
||||||
child: Text("${removeTrailingZeros(totalWeight)} lb",
|
child: Text("${removeTrailingZeros(totalWeight)} lb",
|
||||||
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||||
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
@@ -262,38 +272,25 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
TextStyle(color: Colors.black, fontSize: 15),
|
TextStyle(color: Colors.black, fontSize: 15),
|
||||||
),
|
),
|
||||||
Text("${removeTrailingZeros(e.weight)} lb",
|
Text("${removeTrailingZeros(e.weight)} lb",
|
||||||
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black, fontSize: 15))
|
color: Colors.black, fontSize: 15))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList()),
|
}).toList()),
|
||||||
const SizedBox(height: 10),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
final surchargeItemBox = Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 15),
|
final surchargeItemBox =
|
||||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
LocalText(context, 'box.surcharge.item',
|
|
||||||
color: Colors.black54,
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.normal),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(right: 50),
|
|
||||||
child: Text("${removeTrailingZeros(totalSurchargeCount)} pcs",
|
|
||||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Container(
|
Container(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(right: 60),
|
padding: const EdgeInsets.only(right: 50),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
@@ -306,24 +303,21 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
e.name ?? "",
|
e.name ?? "",
|
||||||
style:
|
style: TextStyle(color: Colors.black, fontSize: 15),
|
||||||
TextStyle(color: Colors.black, fontSize: 15),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text("${removeTrailingZeros((e.qty).toDouble())} pc",
|
||||||
"${removeTrailingZeros((e.qty).toDouble())} pc",
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(
|
style:
|
||||||
color: Colors.black, fontSize: 15))
|
TextStyle(color: Colors.black, fontSize: 15))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList()),
|
}).toList()),
|
||||||
const SizedBox(height: 10),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]),
|
]);
|
||||||
);
|
|
||||||
|
|
||||||
final img = MultiImageFile(
|
final img = MultiImageFile(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@@ -447,10 +441,13 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_cargoTypes.isEmpty ? const SizedBox() : cargosBox,
|
cargosBox,
|
||||||
_surchareItems.isEmpty ? const SizedBox() : surchargeItemBox,
|
surchargeItemBox,
|
||||||
|
const SizedBox(height: 10),
|
||||||
uploadImageBtn,
|
uploadImageBtn,
|
||||||
const SizedBox(height: 30),
|
_carton.photoUrls.isNotEmpty
|
||||||
|
? const SizedBox(height: 10)
|
||||||
|
: const SizedBox(),
|
||||||
img,
|
img,
|
||||||
_carton.photoUrls.isNotEmpty
|
_carton.photoUrls.isNotEmpty
|
||||||
? const SizedBox(height: 40)
|
? const SizedBox(height: 40)
|
||||||
|
|||||||
@@ -89,15 +89,6 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
|||||||
_cargoTypes = widget.carton.cargoTypes;
|
_cargoTypes = widget.carton.cargoTypes;
|
||||||
_surchareItems = widget.carton.surchareItems;
|
_surchareItems = widget.carton.surchareItems;
|
||||||
|
|
||||||
var s = await context
|
|
||||||
.read<FcsShipmentModel>()
|
|
||||||
.getFcsShipment(widget.carton.fcsShipmentID ?? "");
|
|
||||||
_shipment = s;
|
|
||||||
|
|
||||||
_packages = await context
|
|
||||||
.read<PackageModel>()
|
|
||||||
.getPackagesByIds(widget.carton.packageIDs);
|
|
||||||
|
|
||||||
// check carton size type
|
// check carton size type
|
||||||
List<CartonSize> cartonSizes = context.read<CartonSizeModel>().cartonSizes;
|
List<CartonSize> cartonSizes = context.read<CartonSizeModel>().cartonSizes;
|
||||||
|
|
||||||
@@ -120,8 +111,20 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
|||||||
_cartonSizeType = packageCarton;
|
_cartonSizeType = packageCarton;
|
||||||
} else {
|
} else {
|
||||||
_cartonSizeType = customCarton;
|
_cartonSizeType = customCarton;
|
||||||
|
_length = widget.carton.length.toDouble();
|
||||||
|
_width = widget.carton.width.toDouble();
|
||||||
|
_height = widget.carton.height.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var s = await context
|
||||||
|
.read<FcsShipmentModel>()
|
||||||
|
.getFcsShipment(widget.carton.fcsShipmentID ?? "");
|
||||||
|
_shipment = s;
|
||||||
|
|
||||||
|
_packages = await context
|
||||||
|
.read<PackageModel>()
|
||||||
|
.getPackagesByIds(widget.carton.packageIDs);
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@@ -328,7 +331,10 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var carton = Carton(
|
var carton = Carton(
|
||||||
|
id: widget.carton.id,
|
||||||
cartonType: carton_from_packages,
|
cartonType: carton_from_packages,
|
||||||
|
senderID: widget.carton.senderID,
|
||||||
|
consigneeID: widget.carton.consigneeID,
|
||||||
billTo: _billToValue,
|
billTo: _billToValue,
|
||||||
lastMile: _selectedLastMile,
|
lastMile: _selectedLastMile,
|
||||||
fcsShipmentID: _shipment?.id,
|
fcsShipmentID: _shipment?.id,
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ class CartonSizeWidget extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||||
// List<String> _deliveryTypes = [delivery_caton, pickup_carton];
|
|
||||||
|
|
||||||
FcsShipment? _shipment;
|
FcsShipment? _shipment;
|
||||||
String _cartonSizeType = standardCarton;
|
String _cartonSizeType = standardCarton;
|
||||||
|
|
||||||
@@ -85,7 +83,6 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
_selectedLastmile = widget.lastMile;
|
_selectedLastmile = widget.lastMile;
|
||||||
_billToValue = widget.billType;
|
_billToValue = widget.billType;
|
||||||
_cartonSizeType = widget.cartonSizeType;
|
_cartonSizeType = widget.cartonSizeType;
|
||||||
|
|
||||||
_lengthController.text =
|
_lengthController.text =
|
||||||
widget.length == null ? "0" : removeTrailingZeros(widget.length ?? 0);
|
widget.length == null ? "0" : removeTrailingZeros(widget.length ?? 0);
|
||||||
_widthController.text =
|
_widthController.text =
|
||||||
@@ -95,7 +92,6 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
|
|
||||||
_getStandardCartonSize();
|
_getStandardCartonSize();
|
||||||
_loadShipment();
|
_loadShipment();
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ class CartonSubmit extends StatelessWidget {
|
|||||||
final cartonSizeBox = Padding(
|
final cartonSizeBox = Padding(
|
||||||
padding: const EdgeInsets.only(top: 10),
|
padding: const EdgeInsets.only(top: 10),
|
||||||
child: SubmitTextWidget(
|
child: SubmitTextWidget(
|
||||||
labelKey: 'box.carton_size',
|
labelKey: 'box.select_carton_size',
|
||||||
text: boxDimension ?? 'No defined size',
|
text: boxDimension ?? 'No defined size',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ class _MixCartonEditorState extends State<MixCartonEditor> {
|
|||||||
_cartonSizeType = packageCarton;
|
_cartonSizeType = packageCarton;
|
||||||
} else {
|
} else {
|
||||||
_cartonSizeType = customCarton;
|
_cartonSizeType = customCarton;
|
||||||
|
_length = widget.carton.length.toDouble();
|
||||||
|
_width = widget.carton.width.toDouble();
|
||||||
|
_height = widget.carton.height.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
var s = await context
|
var s = await context
|
||||||
@@ -269,7 +272,7 @@ class _MixCartonEditorState extends State<MixCartonEditor> {
|
|||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
cartons: _cartons);
|
cartons: _cartons);
|
||||||
await context.read<CartonModel>().updateCarton(carton);
|
await context.read<CartonModel>().updateMixCarton(carton);
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ class MixCartonSubmit extends StatefulWidget {
|
|||||||
|
|
||||||
class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
||||||
final NumberFormat numberFormatter = NumberFormat("#,###");
|
final NumberFormat numberFormatter = NumberFormat("#,###");
|
||||||
Map<String?, double> _mapCargosByWeight = {};
|
Map<String?, double> _mapCargos = {};
|
||||||
Map<String?, double> _mapCargosByCustomDutyFee = {};
|
Map<String?, double> _mapSurchargeItems = {};
|
||||||
double totalWeight = 0;
|
double totalWeight = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -59,30 +59,37 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_init() {
|
_init() {
|
||||||
|
// get cargos by weight
|
||||||
List<CargoType> _cargoTypes = [];
|
List<CargoType> _cargoTypes = [];
|
||||||
for (var c in widget.cartons) {
|
for (var c in widget.cartons) {
|
||||||
_cargoTypes.addAll(c.cargoTypes);
|
_cargoTypes.addAll(c.cargoTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get cargos by weight
|
_cargoTypes.sort((a, b) => a.name!.compareTo(b.name!));
|
||||||
Map<String?, List<CargoType>> _cargosByWeight =
|
|
||||||
groupCargos(_cargoTypes.where((e) => !e.isCutomDuty).toList());
|
|
||||||
|
|
||||||
|
Map<String?, List<CargoType>> _cargosByWeight = groupCargos(_cargoTypes);
|
||||||
_cargosByWeight.forEach((key, value) {
|
_cargosByWeight.forEach((key, value) {
|
||||||
double total = value.fold(0, (sum, item) => sum + item.weight);
|
double total = value.fold(0, (sum, item) => sum + item.weight);
|
||||||
_mapCargosByWeight[key] = total;
|
_mapCargos[key] = total;
|
||||||
});
|
});
|
||||||
|
|
||||||
totalWeight =
|
totalWeight = _mapCargos.entries.fold(0, (sum, value) => sum + value.value);
|
||||||
_mapCargosByWeight.entries.fold(0, (sum, value) => sum + value.value);
|
|
||||||
|
// get surcharge items
|
||||||
|
|
||||||
|
List<CargoType> _surchargeItems = [];
|
||||||
|
for (var c in widget.cartons) {
|
||||||
|
_surchargeItems.addAll(c.surchareItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
_surchargeItems.sort((a, b) => a.name!.compareTo(b.name!));
|
||||||
|
|
||||||
// get cargos by custom duty fee
|
|
||||||
Map<String?, List<CargoType>> _cargosByCustomDutyFee =
|
Map<String?, List<CargoType>> _cargosByCustomDutyFee =
|
||||||
groupCargos(_cargoTypes.where((e) => e.isCutomDuty).toList());
|
groupCargos(_surchargeItems);
|
||||||
|
|
||||||
_cargosByCustomDutyFee.forEach((key, value) {
|
_cargosByCustomDutyFee.forEach((key, value) {
|
||||||
double total = value.fold(0, (sum, item) => sum + item.qty);
|
double total = value.fold(0, (sum, item) => sum + item.qty);
|
||||||
_mapCargosByCustomDutyFee[key] = total;
|
_mapSurchargeItems[key] = total;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@@ -116,7 +123,7 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
|||||||
final cartonSizeBox = Padding(
|
final cartonSizeBox = Padding(
|
||||||
padding: const EdgeInsets.only(top: 10),
|
padding: const EdgeInsets.only(top: 10),
|
||||||
child: SubmitTextWidget(
|
child: SubmitTextWidget(
|
||||||
labelKey: 'box.carton_size',
|
labelKey: 'box.select_carton_size',
|
||||||
text: boxDimension ?? 'No defined size',
|
text: boxDimension ?? 'No defined size',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -195,7 +202,7 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
|||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _mapCargosByWeight.entries.map((e) {
|
children: _mapCargos.entries.map((e) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -216,7 +223,7 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _mapCargosByCustomDutyFee.entries.map((e) {
|
children: _mapSurchargeItems.entries.map((e) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@@ -117,13 +117,15 @@ class CartonModel extends BaseModel {
|
|||||||
Query pageQuery = FirebaseFirestore.instance.collection(path);
|
Query pageQuery = FirebaseFirestore.instance.collection(path);
|
||||||
|
|
||||||
if (filterByConsingee != null) {
|
if (filterByConsingee != null) {
|
||||||
col = col.where("user_id", isEqualTo: filterByConsingee!.id);
|
col = col.where("consignee_user_id", isEqualTo: filterByConsingee!.id);
|
||||||
pageQuery = pageQuery.where("user_id", isEqualTo: filterByConsingee!.id);
|
pageQuery = pageQuery.where("consignee_user_id",
|
||||||
|
isEqualTo: filterByConsingee!.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filterBySender != null) {
|
if (filterBySender != null) {
|
||||||
col = col.where("sender_id", isEqualTo: filterBySender!.id);
|
col = col.where("sender_user_id", isEqualTo: filterBySender!.id);
|
||||||
pageQuery = pageQuery.where("sender_id", isEqualTo: filterBySender!.id);
|
pageQuery =
|
||||||
|
pageQuery.where("sender_user_id", isEqualTo: filterBySender!.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filterByStatus != null) {
|
if (filterByStatus != null) {
|
||||||
@@ -208,7 +210,7 @@ class CartonModel extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Carton> createMixCarton(Carton carton) {
|
Future<Carton> createMixCarton(Carton carton) {
|
||||||
return Services.instance.cartonService.createCarton(carton);
|
return Services.instance.cartonService.createMixCarton(carton);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateMixCarton(Carton carton) {
|
Future<void> updateMixCarton(Carton carton) {
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ class ConsigneeSelectionModel extends BaseModel {
|
|||||||
Query query = FirebaseFirestore.instance
|
Query query = FirebaseFirestore.instance
|
||||||
.collection(path)
|
.collection(path)
|
||||||
.where("is_sys_admin", isEqualTo: false)
|
.where("is_sys_admin", isEqualTo: false)
|
||||||
.where("is_deleted", isEqualTo: false)
|
.where("delete_time", isEqualTo: 0)
|
||||||
.orderBy("message_time", descending: true);
|
.orderBy("update_time", descending: true);
|
||||||
|
|
||||||
if (_lastDocument != null) {
|
if (_lastDocument != null) {
|
||||||
query = query.startAfterDocument(_lastDocument!);
|
query = query.startAfterDocument(_lastDocument!);
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ class SenderSelectionModel extends BaseModel {
|
|||||||
Query query = FirebaseFirestore.instance
|
Query query = FirebaseFirestore.instance
|
||||||
.collection(path)
|
.collection(path)
|
||||||
.where("is_sys_admin", isEqualTo: false)
|
.where("is_sys_admin", isEqualTo: false)
|
||||||
.where("is_deleted", isEqualTo: false)
|
.where("delete_time", isEqualTo: 0)
|
||||||
.orderBy("message_time", descending: true);
|
.orderBy("update_time", descending: true);
|
||||||
|
|
||||||
if (_lastDocument != null) {
|
if (_lastDocument != null) {
|
||||||
query = query.startAfterDocument(_lastDocument!);
|
query = query.startAfterDocument(_lastDocument!);
|
||||||
|
|||||||
@@ -84,12 +84,12 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
controller: _displayIndexController,
|
controller: _displayIndexController,
|
||||||
textInputType: TextInputType.number,
|
textInputType: TextInputType.number,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
// validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
// if (value == null || value.isEmpty) {
|
||||||
return "Please insert display index";
|
// return "Please insert display index";
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
},
|
// },
|
||||||
);
|
);
|
||||||
|
|
||||||
final defaultBox = Padding(
|
final defaultBox = Padding(
|
||||||
@@ -189,7 +189,9 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
CargoType _cargo = CargoType(
|
CargoType _cargo = CargoType(
|
||||||
name: _descController.text,
|
name: _descController.text,
|
||||||
rate: double.parse(_rateController.text),
|
rate: double.parse(_rateController.text),
|
||||||
displayIndex: int.parse(_displayIndexController.text),
|
displayIndex: _displayIndexController.text == ''
|
||||||
|
? 0
|
||||||
|
: int.parse(_displayIndexController.text),
|
||||||
isDefault: _isDefault);
|
isDefault: _isDefault);
|
||||||
if (_isNew) {
|
if (_isNew) {
|
||||||
await shipmentRateModel.addCargoType(_cargo);
|
await shipmentRateModel.addCargoType(_cargo);
|
||||||
|
|||||||
Reference in New Issue
Block a user