add shipments
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_button.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/popupmenu.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
@@ -9,6 +13,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'fcs_shipment_editor.dart';
|
||||
|
||||
@@ -110,6 +115,11 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
iconData: Icons.av_timer,
|
||||
);
|
||||
|
||||
final shipBtn = LocalButton(
|
||||
textKey: "FCSshipment.ship.btn",
|
||||
callBack: _ship,
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -151,6 +161,9 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
portBox,
|
||||
destinationBox,
|
||||
statusBox,
|
||||
_fcsShipment.status == fcs_shipment_confirmed_status
|
||||
? shipBtn
|
||||
: Container(),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
@@ -203,4 +216,28 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
}).toList();
|
||||
});
|
||||
}
|
||||
|
||||
_ship() {
|
||||
showConfirmDialog(context, "FCSshipment.ship.confirm", () {
|
||||
_shipFcsShipment();
|
||||
});
|
||||
}
|
||||
|
||||
_shipFcsShipment() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
FcsShipmentModel fcsShipmentModel =
|
||||
Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
await fcsShipmentModel.ship(_fcsShipment);
|
||||
Navigator.pop(context, true);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user