update carton filter and merge api for shipment
This commit is contained in:
@@ -64,7 +64,11 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
_portController.text = _shipment.port ?? "";
|
||||
_destinationController.text = _shipment.destination ?? "";
|
||||
|
||||
// _currentShipmentType = model.shipmentTypes.where((e) => e.id == _shipment.shipmentTypeId).first;
|
||||
List<ShipmentType> list = model.shipmentTypes
|
||||
.where((e) => e.id == _shipment.shipmentTypeId)
|
||||
.toList();
|
||||
|
||||
_currentShipmentType = list.isNotEmpty ? list.first : null;
|
||||
} else {
|
||||
_currentShipmentType = model.shipmentTypes[0];
|
||||
}
|
||||
@@ -175,7 +179,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
|
||||
items: shipmentTypes
|
||||
.map((e) =>
|
||||
DropdownMenuItem(child: Text(e.desc), value: e))
|
||||
DropdownMenuItem(child: Text(e.name), value: e))
|
||||
.toList(),
|
||||
onChanged: (selected) => {
|
||||
setState(() {
|
||||
@@ -209,7 +213,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
FcsShipment fcsShipment = FcsShipment();
|
||||
fcsShipment.id = _shipment.id;
|
||||
fcsShipment.shipmentNumber = _shipmentNumberController.text;
|
||||
fcsShipment.shipmentTypeId = _currentShipmentType?.id;
|
||||
fcsShipment.shipmentTypeId = _currentShipmentType?.id ?? "";
|
||||
fcsShipment.consignee = _consigneeController.text;
|
||||
fcsShipment.port = _portController.text;
|
||||
fcsShipment.destination = _destinationController.text;
|
||||
@@ -230,9 +234,8 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
try {
|
||||
await shipmentModel.create(fcsShipment);
|
||||
await context.read<FcsShipmentModel>().create(fcsShipment);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
@@ -250,9 +253,9 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
|
||||
try {
|
||||
await shipmentModel.update(fcsShipment);
|
||||
await context.read<FcsShipmentModel>().update(fcsShipment);
|
||||
Navigator.pop(context, true);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
Reference in New Issue
Block a user