update pages for carton
This commit is contained in:
@@ -18,7 +18,9 @@ import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../domain/entities/carton_size.dart';
|
||||
import '../../domain/entities/fcs_shipment.dart';
|
||||
import '../carton_size/model/carton_size_model.dart';
|
||||
import '../fcs_shipment/model/fcs_shipment_model.dart';
|
||||
import '../widgets/local_button.dart';
|
||||
import 'carton_package_editor.dart';
|
||||
import 'mix_carton/mix_carton_editor.dart';
|
||||
@@ -34,9 +36,9 @@ class CartonInfo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CartonInfoState extends State<CartonInfo> {
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
var dateFormatter = DateFormat('dd MMM yyyy');
|
||||
final NumberFormat numberFormatter = NumberFormat("#,###");
|
||||
MultiImgController _multiImgController = MultiImgController();
|
||||
MultiImgController multiImgController = MultiImgController();
|
||||
bool _isLoading = false;
|
||||
late Carton _carton;
|
||||
List<CargoType> _cargoTypes = [];
|
||||
@@ -46,6 +48,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
double totalWeight = 0.0;
|
||||
double totalSurchargeCount = 0.0;
|
||||
CartonSize? standardSize;
|
||||
FcsShipment? _shipment;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -57,7 +60,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
_init() async {
|
||||
try {
|
||||
_isLoading = true;
|
||||
_multiImgController.setImageUrls = _carton.photoUrls;
|
||||
multiImgController.setImageUrls = _carton.photoUrls;
|
||||
_cargoTypes = _carton.cargoTypes;
|
||||
_surchareItems = _carton.surchareItems;
|
||||
|
||||
@@ -82,6 +85,14 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
_carton.cartonSizeType = customCarton;
|
||||
}
|
||||
|
||||
if (widget.carton.fcsShipmentID != null &&
|
||||
widget.carton.fcsShipmentID != '') {
|
||||
var s = await context
|
||||
.read<FcsShipmentModel>()
|
||||
.getFcsShipment(widget.carton.fcsShipmentID!);
|
||||
_shipment = s;
|
||||
}
|
||||
|
||||
if (_carton.cartonType == carton_from_packages) {
|
||||
_packages = await context
|
||||
.read<PackageModel>()
|
||||
@@ -119,11 +130,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
? "${_carton.length.toInt()}”x${_carton.width.toInt()}”x${_carton.height.toInt()}”"
|
||||
: null;
|
||||
|
||||
final cartonNumberBox = DisplayText(
|
||||
text: _carton.cartonNumber,
|
||||
labelTextKey: "box.number",
|
||||
);
|
||||
|
||||
final cartonQrBox = IconButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
@@ -132,7 +138,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
builder: (context) => PrintQrCodePage(carton: _carton)),
|
||||
);
|
||||
},
|
||||
icon: Icon(AntDesign.qrcode, color: Colors.black));
|
||||
icon: Icon(AntDesign.qrcode, color: primaryColor));
|
||||
|
||||
final cartonTypeBox = DisplayText(
|
||||
text: _carton.cartonType == carton_from_packages
|
||||
@@ -152,11 +158,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
labelTextKey: "box.bill_to",
|
||||
);
|
||||
|
||||
final shipmentBox = DisplayText(
|
||||
text: _carton.fcsShipmentNumber,
|
||||
labelTextKey: "box.fcs_shipment_num",
|
||||
);
|
||||
|
||||
final lastMileBox = DisplayText(
|
||||
text: _carton.lastMile == delivery_caton
|
||||
? 'Delivery'
|
||||
@@ -167,22 +168,34 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
);
|
||||
|
||||
final cartonSizeBox = DisplayText(
|
||||
subText: Text("${boxDimension ?? 'No defined size'}"),
|
||||
subText: Text(boxDimension ?? 'No defined size'),
|
||||
labelTextKey: "box.select_carton_size",
|
||||
);
|
||||
|
||||
final senderBox = DisplayText(
|
||||
text: _carton.senderName == null ? "" : _carton.senderName,
|
||||
subText: Text(_carton.senderFCSID ?? "", style: textStyle),
|
||||
labelTextKey: "box.name",
|
||||
final packageLengthBox = DisplayText(
|
||||
showLabelLink: true,
|
||||
subText: Text(numberFormatter.format(_packages.length)),
|
||||
labelTextKey: "box.package",
|
||||
onTapLabel: () {},
|
||||
);
|
||||
|
||||
final consigneeNameBox = DisplayText(
|
||||
text: _carton.consigneeName != null ? _carton.consigneeName : "",
|
||||
subText: Text(_carton.consigneeFCSID ?? "", style: textStyle),
|
||||
labelTextKey: "processing.consignee.name",
|
||||
final mixCartonLengthBox = DisplayText(
|
||||
showLabelLink: true,
|
||||
subText: Text(numberFormatter.format(_mixCartons.length)),
|
||||
labelTextKey: "box.shipment.boxes",
|
||||
onTapLabel: () {},
|
||||
);
|
||||
|
||||
final senderBox = userDisplayBox(context,
|
||||
lableKey: "box.sender.title",
|
||||
name: _carton.senderName,
|
||||
fcsID: _carton.senderFCSID);
|
||||
|
||||
final consigneeNameBox = userDisplayBox(context,
|
||||
lableKey: "box.consignee.title",
|
||||
name: _carton.consigneeName,
|
||||
fcsID: _carton.consigneeFCSID);
|
||||
|
||||
// final billWidget = Expanded(
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.only(left: 0, top: 15),
|
||||
@@ -200,6 +213,21 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
consigneeNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
// _carton.billTo == billToConsignee ? billWidget : const SizedBox()
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -216,21 +244,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
consigneeNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
// _carton.billTo == billToConsignee ? billWidget : const SizedBox()
|
||||
],
|
||||
))
|
||||
],
|
||||
);
|
||||
|
||||
@@ -246,82 +259,88 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
fontWeight: FontWeight.normal),
|
||||
_cargoTypes.isNotEmpty
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(right: 50),
|
||||
padding: EdgeInsets.only(right: 0),
|
||||
child: Text("${removeTrailingZeros(totalWeight)} lb",
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _cargoTypes.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _cargoTypes.asMap().entries.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Container(
|
||||
color: e.key.isEven ? Colors.grey.shade300 : oddColor,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
e.name ?? "",
|
||||
e.value.name ?? "",
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontSize: 15),
|
||||
),
|
||||
Text("${removeTrailingZeros(e.weight)} lb",
|
||||
Text("${removeTrailingZeros(e.value.weight)} lb",
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 15))
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
final surchargeItemBox =
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _surchareItems.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
e.name ?? "",
|
||||
style: TextStyle(color: Colors.black, fontSize: 15),
|
||||
),
|
||||
Text("${removeTrailingZeros((e.qty).toDouble())} pc",
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontSize: 15))
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
]);
|
||||
]),
|
||||
);
|
||||
|
||||
final surchargeItemBox = Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
LocalText(context, 'box.input_surcharge_item',
|
||||
color: Colors.black54, fontSize: 16, fontWeight: FontWeight.normal),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _surchareItems.asMap().entries.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Container(
|
||||
color: e.key.isEven ? Colors.grey.shade300 : oddColor,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
e.value.name ?? "",
|
||||
style: TextStyle(color: Colors.black, fontSize: 15),
|
||||
),
|
||||
Text("${removeTrailingZeros((e.value.qty).toDouble())} pc",
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontSize: 15))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
final img = MultiImageFile(
|
||||
enabled: false,
|
||||
controller: _multiImgController,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
);
|
||||
|
||||
@@ -367,15 +386,74 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
),
|
||||
);
|
||||
|
||||
final shipmentBox = Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocalText(context, "package.shipment.title",
|
||||
fontSize: 15, color: Colors.black54),
|
||||
const SizedBox(height: 5),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: dividerColor),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
DisplayText(
|
||||
text: _shipment?.shipmentNumber,
|
||||
labelTextKey: "FCSshipment.number",
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
child: DisplayText(
|
||||
text: _shipment != null
|
||||
? _shipment!.cutoffDate != null
|
||||
? dateFormatter.format(_shipment!.cutoffDate!)
|
||||
: ""
|
||||
: "",
|
||||
labelTextKey: "FCSshipment.cutoff_date",
|
||||
)),
|
||||
Flexible(
|
||||
child: DisplayText(
|
||||
text: _shipment != null
|
||||
? _shipment!.etaDate != null
|
||||
? dateFormatter.format(_shipment!.etaDate!)
|
||||
: ""
|
||||
: "",
|
||||
labelTextKey: "FCSshipment.ETA",
|
||||
)),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: LocalAppBar(
|
||||
labelKey: "box.info.title",
|
||||
titleWidget: Column(
|
||||
children: [
|
||||
LocalText(context, "box.info.title",
|
||||
fontSize: 20, color: primaryColor),
|
||||
Text(_carton.cartonNumber ?? '',
|
||||
style: TextStyle(fontSize: 15, color: Colors.black))
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
labelColor: primaryColor,
|
||||
arrowColor: primaryColor,
|
||||
actions: <Widget>[
|
||||
cartonQrBox,
|
||||
_carton.status == carton_packed_status
|
||||
? IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
@@ -385,66 +463,64 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
body: Container(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: ListView(children: <Widget>[
|
||||
Row(children: [
|
||||
Flexible(child: cartonNumberBox, flex: 1),
|
||||
Flexible(
|
||||
child: cartonQrBox,
|
||||
),
|
||||
]),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(child: cartonTypeBox),
|
||||
],
|
||||
),
|
||||
fromPackage ? userRowBox : const SizedBox(),
|
||||
fromPackage
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(child: billInfoBox),
|
||||
Flexible(child: lastMileBox),
|
||||
],
|
||||
)
|
||||
: const SizedBox(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
fromPackage ? Flexible(child: billInfoBox) : SizedBox(),
|
||||
Flexible(child: shipmentBox),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
fromPackage
|
||||
? Flexible(child: lastMileBox)
|
||||
: const SizedBox(),
|
||||
Flexible(child: cartonSizeBox),
|
||||
Flexible(child: packageLengthBox),
|
||||
],
|
||||
),
|
||||
_packages.isEmpty
|
||||
? const SizedBox()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocalText(context, "box.package",
|
||||
color: Colors.black54, fontSize: 15),
|
||||
const SizedBox(height: 5),
|
||||
Column(
|
||||
children: getPackageList(_packages),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_mixCartons.isEmpty
|
||||
? const SizedBox()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocalText(context, "box.shipment.boxes",
|
||||
color: Colors.black54, fontSize: 15),
|
||||
const SizedBox(height: 5),
|
||||
Column(children: getCartonList(_mixCartons)),
|
||||
],
|
||||
),
|
||||
),
|
||||
fromPackage ? const SizedBox() : mixCartonLengthBox,
|
||||
shipmentBox,
|
||||
// _packages.isEmpty
|
||||
// ? const SizedBox()
|
||||
// : Padding(
|
||||
// padding: const EdgeInsets.only(top: 15),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// LocalText(context, "box.package",
|
||||
// color: Colors.black54, fontSize: 15),
|
||||
// const SizedBox(height: 5),
|
||||
// Column(
|
||||
// children: getPackageList(_packages),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// _mixCartons.isEmpty
|
||||
// ? const SizedBox()
|
||||
// : Padding(
|
||||
// padding: const EdgeInsets.only(top: 15),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// LocalText(context, "box.shipment.boxes",
|
||||
// color: Colors.black54, fontSize: 15),
|
||||
// const SizedBox(height: 5),
|
||||
// Column(children: getCartonList(_mixCartons)),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
cargosBox,
|
||||
surchargeItemBox,
|
||||
_surchareItems.isNotEmpty
|
||||
? surchargeItemBox
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 10),
|
||||
uploadImageBtn,
|
||||
_carton.photoUrls.isNotEmpty
|
||||
|
||||
Reference in New Issue
Block a user