update cartion editor
This commit is contained in:
@@ -36,8 +36,9 @@ class Carton {
|
|||||||
String? mixCartonNumber;
|
String? mixCartonNumber;
|
||||||
String? cartonSizeID;
|
String? cartonSizeID;
|
||||||
String? cartonSizeName;
|
String? cartonSizeName;
|
||||||
|
String? deliveryType;
|
||||||
String? cartonSizeType;
|
String? cartonSizeType;
|
||||||
String? cartonStandardSize;
|
|
||||||
double cartonWeight;
|
double cartonWeight;
|
||||||
String? billTo;
|
String? billTo;
|
||||||
bool isSelected;
|
bool isSelected;
|
||||||
@@ -51,7 +52,6 @@ class Carton {
|
|||||||
String? remark;
|
String? remark;
|
||||||
DateTime? arrivedDate;
|
DateTime? arrivedDate;
|
||||||
String? cartonNumber;
|
String? cartonNumber;
|
||||||
String? deliveryCarton;
|
|
||||||
|
|
||||||
List<String> packageIDs;
|
List<String> packageIDs;
|
||||||
List<Package> packages;
|
List<Package> packages;
|
||||||
@@ -163,8 +163,7 @@ class Carton {
|
|||||||
this.cartonSizeID,
|
this.cartonSizeID,
|
||||||
this.cartonSizeName,
|
this.cartonSizeName,
|
||||||
this.cartonSizeType,
|
this.cartonSizeType,
|
||||||
this.cartonStandardSize,
|
this.deliveryType,
|
||||||
this.deliveryCarton,
|
|
||||||
this.mixBoxType,
|
this.mixBoxType,
|
||||||
this.mixCartons = const [],
|
this.mixCartons = const [],
|
||||||
this.mixCartonIDs = const [],
|
this.mixCartonIDs = const [],
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import '../../domain/entities/carton_size.dart';
|
||||||
import '../widgets/local_button.dart';
|
import '../widgets/local_button.dart';
|
||||||
import 'carton_package_editor.dart';
|
import 'carton_package_editor.dart';
|
||||||
import 'mix_carton/mix_carton_editor.dart';
|
import 'mix_carton/mix_carton_editor.dart';
|
||||||
@@ -42,6 +43,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
List<Package> _packages = [];
|
List<Package> _packages = [];
|
||||||
double totalWeight = 0.0;
|
double totalWeight = 0.0;
|
||||||
double totalSurchargeCount = 0.0;
|
double totalSurchargeCount = 0.0;
|
||||||
|
CartonSize? standardSize;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -51,13 +53,14 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_init() async {
|
_init() async {
|
||||||
_carton.billTo = billToSender;
|
_carton.billTo = billToConsignee;
|
||||||
_carton.cartonSizeType=standardCarton;
|
_carton.cartonSizeType = customCarton;
|
||||||
_carton.cartonType = carton_from_packages;
|
_carton.cartonType = carton_from_packages;
|
||||||
multiImgController.setImageUrls = _carton.photos;
|
multiImgController.setImageUrls = _carton.photos;
|
||||||
_cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
|
_cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
|
||||||
_surchareItems = _carton.cargoTypes.where((e) => e.isCutomDuty).toList();
|
_surchareItems = _carton.cargoTypes.where((e) => e.isCutomDuty).toList();
|
||||||
if (_carton.cartonType == carton_from_packages) {
|
if (_carton.cartonType == carton_from_packages) {
|
||||||
|
_carton.deliveryType = delivery_caton;
|
||||||
_packages = await context
|
_packages = await context
|
||||||
.read<PackageModel>()
|
.read<PackageModel>()
|
||||||
.getPackagesByIds(_carton.packageIDs);
|
.getPackagesByIds(_carton.packageIDs);
|
||||||
@@ -81,7 +84,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
String? boxDimension = _carton.cartonSizeType == standardCarton
|
||||||
|
? "${standardSize?.name} - ${standardSize?.length.toInt()}”x${standardSize?.width.toInt()}”x${standardSize?.height.toInt()}”"
|
||||||
|
: _carton.cartonSizeType == customCarton
|
||||||
|
? "${_carton.length.toInt()}”x${_carton.width.toInt()}”x${_carton.height.toInt()}”"
|
||||||
|
: null;
|
||||||
|
|
||||||
final cartonTypeBox = DisplayText(
|
final cartonTypeBox = DisplayText(
|
||||||
text: _carton.cartonNumber,
|
text: _carton.cartonNumber,
|
||||||
@@ -90,8 +97,10 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
|
|
||||||
final cartonQrBox = DisplayText(iconData: AntDesign.qrcode);
|
final cartonQrBox = DisplayText(iconData: AntDesign.qrcode);
|
||||||
final cartonSubTypeBox = DisplayText(
|
final cartonSubTypeBox = DisplayText(
|
||||||
text: _carton.cartonType==carton_from_packages ? "Carton for packages":"Mix carton",
|
text: _carton.cartonType == carton_from_packages
|
||||||
subText:Text( "${_carton.cartonStandardSize}"),
|
? "Carton for packages"
|
||||||
|
: "Mix carton",
|
||||||
|
subText: boxDimension == null ? null : Text("$boxDimension"),
|
||||||
labelTextKey: "box.carton.type",
|
labelTextKey: "box.carton.type",
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -101,7 +110,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final deliveryBox = DisplayText(
|
final deliveryBox = DisplayText(
|
||||||
text: _carton.deliveryCarton,
|
text: _carton.deliveryType,
|
||||||
labelTextKey: "box.delivery_type",
|
labelTextKey: "box.delivery_type",
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -183,7 +192,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
//),
|
|
||||||
Container(
|
Container(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(right: 100),
|
padding: const EdgeInsets.only(right: 100),
|
||||||
@@ -346,20 +354,21 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
child: cartonQrBox,
|
child: cartonQrBox,
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
Row(children: [Flexible(child: cartonSubTypeBox),],),
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(child: cartonSubTypeBox),
|
||||||
|
],
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Flexible(child: shipmentBox),
|
Flexible(child: shipmentBox),
|
||||||
_mixCartons.isEmpty
|
_mixCartons.isEmpty
|
||||||
?
|
? Flexible(child: deliveryBox)
|
||||||
Flexible(child: deliveryBox):const SizedBox(),
|
: const SizedBox(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_mixCartons.isEmpty
|
_mixCartons.isEmpty ? userRowBox : const SizedBox(),
|
||||||
?
|
|
||||||
userRowBox:
|
|
||||||
const SizedBox(),
|
|
||||||
_packages.isEmpty
|
_packages.isEmpty
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
: Padding(
|
: Padding(
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import '../../domain/entities/package.dart';
|
|||||||
import '../../domain/entities/user.dart';
|
import '../../domain/entities/user.dart';
|
||||||
import '../fcs_shipment/model/fcs_shipment_model.dart';
|
import '../fcs_shipment/model/fcs_shipment_model.dart';
|
||||||
import '../main/util.dart';
|
import '../main/util.dart';
|
||||||
|
import '../package/model/package_model.dart';
|
||||||
import '../widgets/local_text.dart';
|
import '../widgets/local_text.dart';
|
||||||
import '../widgets/progress.dart';
|
import '../widgets/progress.dart';
|
||||||
import '../widgets/step_widget.dart';
|
import '../widgets/step_widget.dart';
|
||||||
@@ -70,6 +71,7 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_init() async {
|
_init() async {
|
||||||
|
context.read<PackageSelectionModel>().clearSelection();
|
||||||
_sender = User(
|
_sender = User(
|
||||||
name: widget.carton.senderName,
|
name: widget.carton.senderName,
|
||||||
fcsID: widget.carton.senderFCSID,
|
fcsID: widget.carton.senderFCSID,
|
||||||
@@ -81,18 +83,23 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
|
|||||||
fcsID: widget.carton.fcsID);
|
fcsID: widget.carton.fcsID);
|
||||||
|
|
||||||
_billToValue = widget.carton.billTo ?? billToSender;
|
_billToValue = widget.carton.billTo ?? billToSender;
|
||||||
_selectedDeliveryType = delivery_caton;
|
_selectedDeliveryType = widget.carton.deliveryType ?? delivery_caton;
|
||||||
_cartonSizeType = customCarton;
|
_cartonSizeType = widget.carton.cartonSizeType ?? customCarton;
|
||||||
_length = widget.carton.length;
|
_length = widget.carton.length;
|
||||||
_width = widget.carton.width;
|
_width = widget.carton.width;
|
||||||
_height = widget.carton.height;
|
_height = widget.carton.height;
|
||||||
|
_cargoTypes = widget.carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
|
||||||
|
_surchareItems = widget.carton.cargoTypes.where((e) => e.isCutomDuty).toList();
|
||||||
|
|
||||||
var s = await context
|
var s = await context
|
||||||
.read<FcsShipmentModel>()
|
.read<FcsShipmentModel>()
|
||||||
.getFcsShipment(widget.carton.fcsShipmentID ?? "");
|
.getFcsShipment(widget.carton.fcsShipmentID ?? "");
|
||||||
_shipment = s;
|
_shipment = s;
|
||||||
|
|
||||||
context.read<PackageSelectionModel>().clearSelection();
|
_packages = await context
|
||||||
|
.read<PackageModel>()
|
||||||
|
.getPackagesByIds(widget.carton.packageIDs);
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,4 +144,5 @@ class CartonSelectionModel extends BaseModel {
|
|||||||
cartons.clear();
|
cartons.clear();
|
||||||
query = "";
|
query = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ class PackageSelectionModel extends BaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addSelectedPackage(List<Package> list){
|
||||||
|
selectedPackageList = list;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _refresh(
|
Future<void> _refresh(
|
||||||
{required String shipmentId,
|
{required String shipmentId,
|
||||||
required String senderId,
|
required String senderId,
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ class _PackageSelectionWidgetState extends State<PackageSelectionWidget> {
|
|||||||
consigneeId: widget.consignee.id!,
|
consigneeId: widget.consignee.id!,
|
||||||
senderId: widget.sender.id!);
|
senderId: widget.sender.id!);
|
||||||
|
|
||||||
|
searchModel.addSelectedPackage(widget.packages);
|
||||||
|
|
||||||
_controller.text = searchModel.query;
|
_controller.text = searchModel.query;
|
||||||
_query = searchModel.query;
|
_query = searchModel.query;
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user