add carton from mix_box & from cargos

This commit is contained in:
Thinzar Win
2021-01-09 19:11:47 +06:30
parent 0bbd568adc
commit 9d2f9a671f
16 changed files with 583 additions and 322 deletions

View File

@@ -51,19 +51,21 @@ class _CartonInfoState extends State<CartonInfo> {
double volumetricRatio = 0;
double shipmentWeight = 0;
String selectMixBoxType;
List<Carton> _cartons = [];
List<Carton> _mixCartons = [];
bool isMixBox;
bool isFromShipments;
bool isFromPackages;
bool isSmallBag;
bool isFromCartons;
bool isEdiable;
@override
void initState() {
super.initState();
_box = widget.box;
// _box.cartonType = carton_from_cargos;
// _box.cartonType = carton_mix_box;
//for shipment weight
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
.rate
@@ -86,21 +88,13 @@ class _CartonInfoState extends State<CartonInfo> {
isFromShipments = _box.cartonType == carton_from_shipments;
isFromPackages = _box.cartonType == carton_from_packages;
isSmallBag = _box.cartonType == carton_small_bag;
isEdiable = !isMixBox &&
(isFromPackages || isSmallBag) &&
isFromCartons = _box.cartonType == carton_from_cargos;
isEdiable = (isFromPackages || isMixBox || isFromCartons) &&
_box.status == carton_packed_status;
selectMixBoxType = _box.mixBoxType ?? "Mix Delivery";
selectMixBoxType = _box.mixBoxType ?? "";
_mixCartons = _box.mixCartons == null ? [] : _box.mixCartons;
getCartonSize();
_cartons = [
Carton(
cartonNumber: "A100B-1#1",
cargoTypes: [CargoType(name: "General", weight: 12)],
userName: "Seven 7"),
Carton(
cartonNumber: "A100B-1#2",
cargoTypes: [CargoType(name: "General", weight: 12)],
userName: "Seven 7"),
];
}
getCartonSize() {
@@ -180,6 +174,55 @@ class _CartonInfoState extends State<CartonInfo> {
iconData: Icons.person,
);
final consigneefcsIDBox = DisplayText(
text: _box.receiverFCSID != null ? _box.receiverFCSID : "",
labelTextKey: "processing.fcs.id",
icon: FcsIDIcon(),
);
final consigneeNameBox = DisplayText(
text: _box.receiverName != null ? _box.receiverName : "",
labelTextKey: "processing.consignee.name",
maxLines: 2,
iconData: Icons.person,
);
final consigneeBox = Container(
child: Column(
children: [
consigneefcsIDBox,
consigneeNameBox,
],
),
);
final shipperIDBox = Row(
children: <Widget>[
Expanded(
child: DisplayText(
text: _box.senderFCSID != null ? _box.senderFCSID : "",
labelTextKey: "processing.fcs.id",
icon: FcsIDIcon(),
)),
],
);
final shipperNamebox = DisplayText(
text: _box.senderName != null ? _box.senderName : "",
labelTextKey: "processing.shipper.name",
maxLines: 2,
iconData: Icons.person,
);
final shipperBox = Container(
child: Column(
children: [
shipperIDBox,
shipperNamebox,
],
),
);
final lengthBox = LengthPicker(
controller: _lengthController,
lableKey: "box.length",
@@ -291,17 +334,29 @@ class _CartonInfoState extends State<CartonInfo> {
cartonTypeBox,
LocalTitle(textKey: "box.shipment_info"),
shipmentBox,
isSmallBag ? mixCartonNumberBox : Container(),
isMixBox ? Container() : fcsIDBox,
isMixBox ? Container() : customerNameBox,
isMixBox ? mixTypeBox : Container(),
isMixBox ? LocalTitle(textKey: "boxes.title") : Container(),
// isSmallBag ? mixCartonNumberBox : Container(),
isMixBox
? Column(
children: _getCartons(
context,
this._cartons,
))
? Container()
: isFromPackages
? fcsIDBox
: Container(),
isMixBox
? Container()
: isFromPackages
? customerNameBox
: Container(),
isFromCartons
? Row(
children: [
Flexible(child: consigneeBox),
Flexible(child: shipperBox)
],
)
: Container(),
isMixBox ? mixTypeBox : Container(),
isMixBox ? LocalTitle(textKey: "box.mix_caton_title") : Container(),
isMixBox
? Column(children: _getCartons(context, this._mixCartons))
: Container(),
isFromPackages || isSmallBag
? CartonPackageTable(
@@ -310,7 +365,7 @@ class _CartonInfoState extends State<CartonInfo> {
: Container(),
isMixBox ? Container() : LocalTitle(textKey: "box.cargo.type"),
isMixBox ? Container() : cargoTableBox,
...(isFromPackages
...(isFromPackages || isFromCartons
? [
LocalTitle(textKey: "box.dimension"),
cartonSizeBox,