update package detal list and update cargo type input in carton section
This commit is contained in:
@@ -13,12 +13,10 @@ import '../../../domain/vo/local_step.dart';
|
||||
import '../../../helpers/theme.dart';
|
||||
import '../../domain/entities/cargo_type.dart';
|
||||
import '../../domain/entities/carton.dart';
|
||||
import '../../domain/entities/package.dart';
|
||||
import '../../domain/entities/user.dart';
|
||||
import '../carton_size/model/carton_size_model.dart';
|
||||
import '../fcs_shipment/model/fcs_shipment_model.dart';
|
||||
import '../main/util.dart';
|
||||
import '../package/model/package_model.dart';
|
||||
import '../widgets/local_text.dart';
|
||||
import '../widgets/progress.dart';
|
||||
import '../widgets/step_widget.dart';
|
||||
@@ -26,7 +24,7 @@ import 'cargo_widget.dart';
|
||||
import 'carton_size_widget.dart';
|
||||
import 'carton_submit.dart';
|
||||
import 'model/package_selection_model.dart';
|
||||
import 'packages_widget.dart';
|
||||
import 'package_selection_widget.dart';
|
||||
|
||||
class CartonPackageEditor extends StatefulWidget {
|
||||
final Carton carton;
|
||||
@@ -46,7 +44,7 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
||||
LocalStep(lable: 'Cargos', stepType: StepType.CARGOS),
|
||||
LocalStep(lable: 'Submit', stepType: StepType.SUBMIT)
|
||||
];
|
||||
List<Package> _packages = [];
|
||||
|
||||
List<CargoType> _cargoTypes = [];
|
||||
List<CargoType> _surchareItems = [];
|
||||
|
||||
@@ -86,8 +84,11 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
||||
|
||||
_billToValue = widget.carton.billTo ?? billToSender;
|
||||
_selectedLastMile = widget.carton.lastMile ?? delivery_caton;
|
||||
_cargoTypes = widget.carton.cargoTypes;
|
||||
_surchareItems = widget.carton.surchareItems;
|
||||
|
||||
_cargoTypes =
|
||||
widget.carton.cargoTypes.map((e) => e.cloneForCarton()).toList();
|
||||
_surchareItems =
|
||||
widget.carton.surchareItems.map((e) => e.cloneForSurchage()).toList();
|
||||
|
||||
// check carton size type
|
||||
List<CartonSize> cartonSizes = context.read<CartonSizeModel>().cartonSizes;
|
||||
@@ -120,11 +121,6 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
||||
.read<FcsShipmentModel>()
|
||||
.getFcsShipment(widget.carton.fcsShipmentID ?? "");
|
||||
_shipment = s;
|
||||
|
||||
_packages = await context
|
||||
.read<PackageModel>()
|
||||
.getPackagesByIds(widget.carton.packageIDs);
|
||||
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
@@ -233,19 +229,17 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
||||
));
|
||||
} else if (step.stepType == StepType.PACKAGES) {
|
||||
return Expanded(
|
||||
child: PackagesWidget(
|
||||
child: PackageSelectionWidget(
|
||||
sender: _sender!,
|
||||
consignee: _consignee!,
|
||||
shipment: _shipment!,
|
||||
onContinue: (packages) {
|
||||
onContinue: () {
|
||||
setState(() {
|
||||
_packages = List.from(packages);
|
||||
currentStep += 1;
|
||||
});
|
||||
},
|
||||
onPrevious: (packages) {
|
||||
onPrevious: () {
|
||||
setState(() {
|
||||
_packages = List.from(packages);
|
||||
currentStep -= 1;
|
||||
});
|
||||
},
|
||||
@@ -288,7 +282,7 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
||||
height: _height,
|
||||
lastMile: _selectedLastMile,
|
||||
shipment: _shipment!,
|
||||
packages: _packages,
|
||||
// packages: _packages,
|
||||
cargoTypes: _cargoTypes,
|
||||
surchareItems: _surchareItems,
|
||||
onCreate: () {
|
||||
@@ -340,7 +334,7 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
||||
length: length,
|
||||
width: width,
|
||||
height: height,
|
||||
packages: _packages,
|
||||
// packages: _packages,
|
||||
cargoTypes: _cargoTypes,
|
||||
surchareItems: _surchareItems);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user