fcs shipment update
This commit is contained in:
@@ -48,13 +48,14 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_load() {
|
_load() {
|
||||||
_shipmentNumberController.text = _fcsShipment!.shipmentNumber ?? "";
|
_shipmentNumberController.text = _fcsShipment?.shipmentNumber ?? "";
|
||||||
if(_fcsShipment!.cutoffDate != null)
|
if (_fcsShipment?.cutoffDate != null)
|
||||||
_cutoffDateController.text = dateFormatter.format(_fcsShipment!.cutoffDate!);
|
_cutoffDateController.text =
|
||||||
if(_fcsShipment!.arrivalDate != null)
|
dateFormatter.format(_fcsShipment!.cutoffDate!);
|
||||||
|
if (_fcsShipment?.arrivalDate != null)
|
||||||
_arrivalDateController.text =
|
_arrivalDateController.text =
|
||||||
dateFormatter.format(_fcsShipment!.arrivalDate!);
|
dateFormatter.format(_fcsShipment!.arrivalDate!);
|
||||||
if(_fcsShipment!.departureDate != null)
|
if (_fcsShipment?.departureDate != null)
|
||||||
_departureDateControler.text =
|
_departureDateControler.text =
|
||||||
dateFormatter.format(_fcsShipment!.departureDate!);
|
dateFormatter.format(_fcsShipment!.departureDate!);
|
||||||
_shipmentTypeControler.text = _fcsShipment!.shipType ?? "";
|
_shipmentTypeControler.text = _fcsShipment!.shipType ?? "";
|
||||||
@@ -169,7 +170,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
portBox,
|
portBox,
|
||||||
destinationBox,
|
destinationBox,
|
||||||
statusBox,
|
statusBox,
|
||||||
_fcsShipment!.status == fcs_shipment_confirmed_status
|
_fcsShipment?.status == fcs_shipment_confirmed_status
|
||||||
? shipBtn
|
? shipBtn
|
||||||
: Container(),
|
: Container(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -185,7 +186,6 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_edit() async {
|
_edit() async {
|
||||||
var f;
|
|
||||||
bool? updated = await Navigator.push<bool>(
|
bool? updated = await Navigator.push<bool>(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
@@ -193,14 +193,16 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
);
|
);
|
||||||
if (updated ?? false) {
|
if (updated ?? false) {
|
||||||
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
||||||
if(_fcsShipment != null && _fcsShipment!.id != null )
|
if (_fcsShipment != null && _fcsShipment!.id != null) {
|
||||||
f = await shipmentModel.getFcsShipment(_fcsShipment!.id!);
|
FcsShipment? f = await shipmentModel.getFcsShipment(_fcsShipment!.id!);
|
||||||
|
if (f == null) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_fcsShipment = f;
|
_fcsShipment = f;
|
||||||
});
|
});
|
||||||
_load();
|
_load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget menuPopWidget(BuildContext context) {
|
Widget menuPopWidget(BuildContext context) {
|
||||||
return PopupMenuButton<PopupMenu>(
|
return PopupMenuButton<PopupMenu>(
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class FcsShipmentModel extends BaseModel {
|
|||||||
.collection("/$fcs_shipment_collection")
|
.collection("/$fcs_shipment_collection")
|
||||||
.doc(id)
|
.doc(id)
|
||||||
.get(const GetOptions(source: Source.server));
|
.get(const GetOptions(source: Source.server));
|
||||||
var fcs = FcsShipment.fromMap(snap.data as Map<String, dynamic>, snap.id);
|
var fcs = FcsShipment.fromMap(snap.data()!, snap.id);
|
||||||
|
|
||||||
return fcs;
|
return fcs;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ class _PackageEditorState extends State<PackageEditor> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_package = Package();
|
_package = Package();
|
||||||
_loadPackageData(widget.package!.id!);
|
_loadPackageData(widget.package?.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadPackageData(String id) async {
|
_loadPackageData(String? id) async {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
PackageModel packageModel =
|
PackageModel packageModel =
|
||||||
Provider.of<PackageModel>(context, listen: false);
|
Provider.of<PackageModel>(context, listen: false);
|
||||||
|
|||||||
Reference in New Issue
Block a user