update shipment and carton
This commit is contained in:
@@ -10,7 +10,6 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/carton/carton_package_table.dart';
|
||||
import 'package:fcs/pages/carton_search/carton_search.dart';
|
||||
import 'package:fcs/pages/carton_size/carton_size_list.dart';
|
||||
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
||||
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/package/model/package_model.dart';
|
||||
@@ -40,8 +39,8 @@ import 'package_carton_editor.dart';
|
||||
import 'widgets.dart';
|
||||
|
||||
class CartonEditor extends StatefulWidget {
|
||||
final Carton? box;
|
||||
CartonEditor({this.box});
|
||||
final Carton? carton;
|
||||
CartonEditor({this.carton});
|
||||
|
||||
@override
|
||||
_CartonEditorState createState() => _CartonEditorState();
|
||||
@@ -63,7 +62,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
double volumetricRatio = 0;
|
||||
double shipmentWeight = 0;
|
||||
FcsShipment? _fcsShipment;
|
||||
List<FcsShipment>? _fcsShipments;
|
||||
List<FcsShipment> _fcsShipments = [];
|
||||
List<Carton> _cartons = [];
|
||||
CartonSize? selectedCatonSize;
|
||||
|
||||
@@ -90,8 +89,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
_widthController.addListener(_calShipmentWeight);
|
||||
_heightController.addListener(_calShipmentWeight);
|
||||
|
||||
if (widget.box != null) {
|
||||
_carton = widget.box;
|
||||
if (widget.carton != null) {
|
||||
_carton = widget.carton;
|
||||
_deliveryAddress = _carton!.deliveryAddress;
|
||||
_widthController.text = _carton!.width.toString();
|
||||
_heightController.text = _carton!.height.toString();
|
||||
@@ -138,11 +137,13 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
FcsShipmentModel fcsShipmentModel =
|
||||
Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
var fcsShipments = await fcsShipmentModel.getActiveFcsShipments();
|
||||
var fcsShipment =
|
||||
fcsShipments.firstWhere((e) => e.id == _carton!.fcsShipmentID);
|
||||
|
||||
// var fcsShipment =
|
||||
// fcsShipments.firstWhere((e) => e.id == _carton?.fcsShipmentID);
|
||||
|
||||
setState(() {
|
||||
_fcsShipments = fcsShipments;
|
||||
_fcsShipment = fcsShipment;
|
||||
// _fcsShipment = fcsShipment;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -195,9 +196,9 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
// }
|
||||
|
||||
_calShipmentWeight() {
|
||||
double l = double.parse(_lengthController.text);
|
||||
double w = double.parse(_widthController.text);
|
||||
double h = double.parse(_heightController.text);
|
||||
double l = double.tryParse(_lengthController.text) ?? 0;
|
||||
double w = double.tryParse(_widthController.text) ?? 0;
|
||||
double h = double.tryParse(_heightController.text) ?? 0;
|
||||
setState(() {
|
||||
shipmentWeight = l * w * h / volumetricRatio;
|
||||
});
|
||||
@@ -248,8 +249,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
labelKey: "shipment.pack.fcs.shipment",
|
||||
iconData: Ionicons.ios_airplane,
|
||||
display: (u) => u.shipmentNumber,
|
||||
selectedValue: _fcsShipment!,
|
||||
values: _fcsShipments!,
|
||||
selectedValue: _fcsShipment,
|
||||
values: _fcsShipments,
|
||||
));
|
||||
|
||||
final fcsIDBox = Container(
|
||||
|
||||
Reference in New Issue
Block a user