fcs shipment update

This commit is contained in:
Phaung Phaung
2021-09-13 14:24:04 +06:30
parent 1e6471e66c
commit 273c0389c6
3 changed files with 22 additions and 20 deletions

View File

@@ -48,15 +48,16 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
}
_load() {
_shipmentNumberController.text = _fcsShipment!.shipmentNumber ?? "";
if(_fcsShipment!.cutoffDate != null)
_cutoffDateController.text = dateFormatter.format(_fcsShipment!.cutoffDate!);
if(_fcsShipment!.arrivalDate != null)
_arrivalDateController.text =
dateFormatter.format(_fcsShipment!.arrivalDate!);
if(_fcsShipment!.departureDate != null)
_departureDateControler.text =
dateFormatter.format(_fcsShipment!.departureDate!);
_shipmentNumberController.text = _fcsShipment?.shipmentNumber ?? "";
if (_fcsShipment?.cutoffDate != null)
_cutoffDateController.text =
dateFormatter.format(_fcsShipment!.cutoffDate!);
if (_fcsShipment?.arrivalDate != null)
_arrivalDateController.text =
dateFormatter.format(_fcsShipment!.arrivalDate!);
if (_fcsShipment?.departureDate != null)
_departureDateControler.text =
dateFormatter.format(_fcsShipment!.departureDate!);
_shipmentTypeControler.text = _fcsShipment!.shipType ?? "";
_consigneeController.text = _fcsShipment!.consignee ?? "";
_portController.text = _fcsShipment!.port ?? "";
@@ -169,7 +170,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
portBox,
destinationBox,
statusBox,
_fcsShipment!.status == fcs_shipment_confirmed_status
_fcsShipment?.status == fcs_shipment_confirmed_status
? shipBtn
: Container(),
SizedBox(
@@ -185,7 +186,6 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
}
_edit() async {
var f;
bool? updated = await Navigator.push<bool>(
context,
CupertinoPageRoute(
@@ -193,12 +193,14 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
);
if (updated ?? false) {
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
if(_fcsShipment != null && _fcsShipment!.id != null )
f = await shipmentModel.getFcsShipment(_fcsShipment!.id!);
setState(() {
_fcsShipment = f;
});
_load();
if (_fcsShipment != null && _fcsShipment!.id != null) {
FcsShipment? f = await shipmentModel.getFcsShipment(_fcsShipment!.id!);
if (f == null) return;
setState(() {
_fcsShipment = f;
});
_load();
}
}
}