update carton and fcs shipment
This commit is contained in:
@@ -29,6 +29,8 @@ class FcsShipmentInfo extends StatefulWidget {
|
||||
|
||||
class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
final NumberFormat numberFormatter = NumberFormat("#,###");
|
||||
|
||||
late FcsShipment _fcsShipment;
|
||||
bool _isLoading = false;
|
||||
TextEditingController _shipmentNumberController = new TextEditingController();
|
||||
@@ -83,13 +85,15 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
labelTextKey: "FCSshipment.ETA",
|
||||
iconData: Icons.date_range,
|
||||
);
|
||||
|
||||
final cartonBox = DisplayText(
|
||||
//text: _arrivalDateController.text,
|
||||
text: numberFormatter.format(_fcsShipment.cartonCount),
|
||||
labelTextKey: "FCSshipment.carton",
|
||||
iconData: MaterialCommunityIcons.package,
|
||||
);
|
||||
|
||||
final packageBox = DisplayText(
|
||||
//text: _arrivalDateController.text,
|
||||
text: numberFormatter.format(_fcsShipment.packageCount),
|
||||
labelTextKey: "FCSshipment.package",
|
||||
iconData: Octicons.package,
|
||||
);
|
||||
@@ -131,6 +135,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
callBack: _ship,
|
||||
),
|
||||
);
|
||||
|
||||
final processBtn = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: LocalButton(
|
||||
@@ -138,6 +143,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
callBack: _process,
|
||||
),
|
||||
);
|
||||
|
||||
final arriveBtn = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: LocalButton(
|
||||
@@ -145,6 +151,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
callBack: _arrive,
|
||||
),
|
||||
);
|
||||
|
||||
final invoiceBtn = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: LocalButton(
|
||||
@@ -153,6 +160,14 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
),
|
||||
);
|
||||
|
||||
final deliverBtn = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: LocalButton(
|
||||
textKey: "FCSshipment.deliver.btn",
|
||||
callBack: _deliver,
|
||||
),
|
||||
);
|
||||
|
||||
final cancelBtn = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: LocalButton(
|
||||
@@ -228,6 +243,9 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
_fcsShipment.status == fcs_shipment_arrived_status
|
||||
? invoiceBtn
|
||||
: Container(),
|
||||
_fcsShipment.status == fcs_shipment_invoiced_status
|
||||
? deliverBtn
|
||||
: Container(),
|
||||
SizedBox(height: 20)
|
||||
]),
|
||||
),
|
||||
@@ -387,6 +405,28 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
}
|
||||
}
|
||||
|
||||
_deliver() {
|
||||
showConfirmDialog(context, "FCSshipment.deliver.confrim", () {
|
||||
_deliverFcsShipment();
|
||||
});
|
||||
}
|
||||
|
||||
_deliverFcsShipment() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
await context.read<FcsShipmentModel>().deliver(_fcsShipment.id!);
|
||||
Navigator.pop(context, true);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_showPDF(int id) async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
|
||||
Reference in New Issue
Block a user