update shipment type

This commit is contained in:
tzw
2024-03-01 17:27:56 +06:30
parent 1acb2057d4
commit 41a1be745e
14 changed files with 112 additions and 52 deletions

View File

@@ -159,7 +159,9 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
color: dangerColor,
textKey: "FCSshipment.cancel.btn",
callBack: () {
showConfirmDialog(context, "FCSshipment.cancel.confirm", () {});
showConfirmDialog(context, "FCSshipment.cancel.confirm", () {
_cancelFcsShipment();
});
},
),
);
@@ -174,10 +176,12 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
labelColor: primaryColor,
arrowColor: primaryColor,
actions: [
IconButton(
icon: Icon(Icons.edit, color: primaryColor),
onPressed: _edit,
),
_fcsShipment?.status == fcs_shipment_pending_status
? IconButton(
icon: Icon(Icons.edit, color: primaryColor),
onPressed: _edit,
)
: const SizedBox(),
//menuPopWidget(context)
],
),
@@ -377,6 +381,24 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
}
}
_cancelFcsShipment() async {
setState(() {
_isLoading = true;
});
try {
FcsShipmentModel fcsShipmentModel =
Provider.of<FcsShipmentModel>(context, listen: false);
await fcsShipmentModel.cancel(_fcsShipment!.id!);
Navigator.pop(context, true);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
_showPDF(int id) async {
setState(() {
_isLoading = true;