From d0cef82b19cf409190a572789fe30be54b95fba1 Mon Sep 17 00:00:00 2001 From: sma Date: Thu, 22 Feb 2024 17:09:48 +0630 Subject: [PATCH] update fcs-shipmentinfo,cartoninfo and pinlogin --- assets/local/localization_en.json | 10 ++ assets/local/localization_mu.json | 10 ++ lib/pages/carton/carton_info.dart | 110 +++++++++++++++++- lib/pages/fcs_shipment/fcs_shipment_info.dart | 78 ++++++++++++- lib/pages/signin/pinlogin_page.dart | 3 +- 5 files changed, 205 insertions(+), 6 deletions(-) diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index e531f33..ee16197 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -358,6 +358,12 @@ "box.delete.btn":"Delete carton", "box.update_title":"Edit carton", "box.update.btn":"Update carton", + "box.ship.btn":"Ship this Carton", + "box.arrive.btn":"Arrive this Carton", + "box.invoice.btn":"Invoice this Carton", + "box.ship.confirm":"Confirm ship?", + "box.arrive.confirm":"Confirm arrive?", + "box.invoice.confirm":"Confirm invoice?", "Boxes End ================================================================":"", "Delivery Start ================================================================":"", @@ -400,6 +406,9 @@ "FCSshipment.cancel.confirm":"Cancel this shipment?", "FCSshipment.carton":"Cartons", "FCSshipment.package":"Packages", + "FCSshipment.process.confirm":"Confirm process?", + "FCSshipment.arrive.confirm":"Confirm arrive?", + "FCSshipment.invoice.confirm":"Confirm invoice?", "FCS Shipment End ================================================================":"", "Shipment Start ================================================================":"", @@ -458,6 +467,7 @@ "shipment.confirm.complete.confirm":"Complete confirm?", "shipment.receive.complete.btn":"Complete receive", "shipment.receive.complete.confirm":"Complete receive?", + "Shipment End ================================================================":"", "Rate Start ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 6e6424a..d088e21 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -358,6 +358,12 @@ "box.delete.btn":"Delete carton", "box.update_title":"Edit carton", "box.update.btn":"Update carton", + "box.ship.btn":"Ship this Carton", + "box.arrive.btn":"Arrive this Carton", + "box.invoice.btn":"Invoice this Carton", + "box.ship.confirm":"ပို့ဆောင်မှုကို အတည်ပြုပါ ?", + "box.arrive.confirm":"ရောက်ရှိကြောင်း အတည်ပြုပါ ?", + "box.invoice.confirm":"ပြေစာ အတည်ပြုပါ ?", "Boxes End ================================================================":"", "Delivery Start ================================================================":"", @@ -403,6 +409,9 @@ "FCSshipment.popupmenu.shipped":"Shipped shipments", "FCSshipment.carton":"FCS ပုံးများ", "FCSshipment.package":"FCS အထုပ်", + "FCSshipment.process.confirm":"လုပ်ငန်းစဉ်ကို အတည်ပြုပါ ?", + "FCSshipment.arrive.confirm":"ရောက်ရှိကြောင်း အတည်ပြုပါ ?", + "FCSshipment.invoice.confirm":"ပြေစာအတည်ပြုပါ ?", "FCS Shipment End ================================================================":"", "Shipment Start ================================================================":"", @@ -461,6 +470,7 @@ "shipment.confirm.complete.confirm":"Complete confirm?", "shipment.receive.complete.btn":"Complete receive", "shipment.receive.complete.confirm":"Complete receive?", + "Shipment End ================================================================":"", "Rate Start ================================================================":"", diff --git a/lib/pages/carton/carton_info.dart b/lib/pages/carton/carton_info.dart index 8f125f2..c716703 100644 --- a/lib/pages/carton/carton_info.dart +++ b/lib/pages/carton/carton_info.dart @@ -315,6 +315,27 @@ class _CartonInfoState extends State { child: LocalText(context, "box.imageupload.title", color: Colors.white, fontSize: 14)), ); + final shipBtn = Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: LocalButton( + color: primaryColor, + textKey: "box.ship.btn", + callBack: _ship, + )); + final arriveBtn = Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: LocalButton( + color: primaryColor, + textKey: "box.arrive.btn", + callBack: _arrive, + )); + final invoiceBtn = Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: LocalButton( + color: primaryColor, + textKey: "box.invoice.btn", + callBack: _invoice, + )); final deleteBtn = Padding( padding: const EdgeInsets.symmetric(horizontal: 30), @@ -397,9 +418,22 @@ class _CartonInfoState extends State { _cargoTypes.isEmpty ? const SizedBox() : cargosBox, _surchareItems.isEmpty ? const SizedBox() : surchargeItemBox, uploadImageBtn, + const SizedBox(height: 30), img, - const SizedBox(height: 15), - deleteBtn, + const SizedBox(height: 40), + _carton.status == carton_processing_status + ? shipBtn + : Container(), + const SizedBox(height: 40), + _carton.status == carton_processing_status + ? deleteBtn + : Container(), + _carton.status == carton_arrived_status + ? arriveBtn + : Container(), + _carton.status == carton_arrived_status + ? invoiceBtn + : Container(), const SizedBox(height: 20) ])))); } @@ -446,6 +480,78 @@ class _CartonInfoState extends State { } } + _ship() { + showConfirmDialog(context, "box.ship.confirm", () { + _shipCarton(); + }); + } + + _shipCarton() async { + setState(() { + _isLoading = true; + }); + try { + // CartonModel cartonModel = + // Provider.of(context, listen: false); + //await cartonModel.ship(_carton.id!); + Navigator.pop(context, true); + } catch (e) { + showMsgDialog(context, "Error", e.toString()); + } finally { + setState(() { + _isLoading = false; + }); + } + } + + _arrive() { + showConfirmDialog(context, "box.arrive.confirm", () { + _arriveCarton(); + }); + } + + _arriveCarton() async { + setState(() { + _isLoading = true; + }); + try { + // CartonModel cartonModel = + // Provider.of(context, listen: false); + //await cartonModel.ship(_carton.id!); + Navigator.pop(context, true); + } catch (e) { + showMsgDialog(context, "Error", e.toString()); + } finally { + setState(() { + _isLoading = false; + }); + } + } + + _invoice() { + showConfirmDialog(context, "box.invoice.confirm", () { + _invoiceCarton(); + }); + } + + _invoiceCarton() async { + setState(() { + _isLoading = true; + }); + try { + // CartonModel cartonModel = + // Provider.of(context, listen: false); + //await cartonModel.ship(_carton.id!); + Navigator.pop(context, true); + } catch (e) { + showMsgDialog(context, "Error", e.toString()); + } finally { + setState(() { + _isLoading = false; + }); + } + } + _delete() { showConfirmDialog(context, "box.delete.confirm", () { _deleteCarton(); diff --git a/lib/pages/fcs_shipment/fcs_shipment_info.dart b/lib/pages/fcs_shipment/fcs_shipment_info.dart index 13effdd..c622ee8 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_info.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_info.dart @@ -135,21 +135,21 @@ class _FcsShipmentInfoState extends State { padding: const EdgeInsets.symmetric(horizontal: 30), child: LocalButton( textKey: "FCSshipment.process.btn", - callBack: () {}, + callBack: _process, ), ); final arriveBtn = Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: LocalButton( textKey: "FCSshipment.arrive.btn", - callBack: () {}, + callBack: _arrive, ), ); final invoiceBtn = Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: LocalButton( textKey: "FCSshipment.invoice.btn", - callBack: () {}, + callBack: _invoice, ), ); @@ -281,6 +281,30 @@ class _FcsShipmentInfoState extends State { }); } + _process() { + showConfirmDialog(context, "FCSshipment.process.confirm", () { + _processFcsShipment(); + }); + } + + _processFcsShipment() async { + setState(() { + _isLoading = true; + }); + try { + FcsShipmentModel fcsShipmentModel = + Provider.of(context, listen: false); + await fcsShipmentModel.process(_fcsShipment!.id!); + Navigator.pop(context, true); + } catch (e) { + showMsgDialog(context, "Error", e.toString()); + } finally { + setState(() { + _isLoading = false; + }); + } + } + _ship() { showConfirmDialog(context, "FCSshipment.ship.confirm", () { _shipFcsShipment(); @@ -305,6 +329,54 @@ class _FcsShipmentInfoState extends State { } } + _arrive() { + showConfirmDialog(context, "FCSshipment.arrive.confirm", () { + _arriveFcsShipment(); + }); + } + + _arriveFcsShipment() async { + setState(() { + _isLoading = true; + }); + try { + FcsShipmentModel fcsShipmentModel = + Provider.of(context, listen: false); + await fcsShipmentModel.arrive(_fcsShipment!.id!); + Navigator.pop(context, true); + } catch (e) { + showMsgDialog(context, "Error", e.toString()); + } finally { + setState(() { + _isLoading = false; + }); + } + } + + _invoice() { + showConfirmDialog(context, "FCSshipment.invoice.confirm", () { + _invoiceFcsShipment(); + }); + } + + _invoiceFcsShipment() async { + setState(() { + _isLoading = true; + }); + try { + FcsShipmentModel fcsShipmentModel = + Provider.of(context, listen: false); + await fcsShipmentModel.invoice(_fcsShipment!.id!); + Navigator.pop(context, true); + } catch (e) { + showMsgDialog(context, "Error", e.toString()); + } finally { + setState(() { + _isLoading = false; + }); + } + } + _showPDF(int id) async { setState(() { _isLoading = true; diff --git a/lib/pages/signin/pinlogin_page.dart b/lib/pages/signin/pinlogin_page.dart index 9c39f39..14d9eb6 100644 --- a/lib/pages/signin/pinlogin_page.dart +++ b/lib/pages/signin/pinlogin_page.dart @@ -44,10 +44,11 @@ class _PinLoginPageState extends State { cursorColor: primaryColor, keyboardType: TextInputType.text, decoration: new InputDecoration( - prefix: Text( + prefixIcon: Text( prefixText, style: TextStyle(color: Colors.black), ), + prefixIconConstraints: BoxConstraints(minWidth: 0, minHeight: 0), contentPadding: EdgeInsets.all(0), labelStyle: newLabelStyle(color: Colors.black54, fontSize: 17), enabledBorder: UnderlineInputBorder(