diff --git a/lib/domain/entities/carton.dart b/lib/domain/entities/carton.dart index cb94a19..c6fded6 100644 --- a/lib/domain/entities/carton.dart +++ b/lib/domain/entities/carton.dart @@ -36,8 +36,10 @@ class Carton { String? mixCartonNumber; String? cartonSizeID; String? cartonSizeName; + String? cartonSizeType; + String? cartonStandardSize; double cartonWeight; - String? billTo; + String? billTo; bool isSelected; int rate; @@ -49,6 +51,7 @@ class Carton { String? remark; DateTime? arrivedDate; String? cartonNumber; + String? deliveryCarton; List packageIDs; List packages; @@ -159,6 +162,9 @@ class Carton { this.deliveryAddress, this.cartonSizeID, this.cartonSizeName, + this.cartonSizeType, + this.cartonStandardSize, + this.deliveryCarton, this.mixBoxType, this.mixCartons = const [], this.mixCartonIDs = const [], diff --git a/lib/pages/carton/carton_image_upload_editor.dart b/lib/pages/carton/carton_image_upload_editor.dart index 37b60c2..9e5a645 100644 --- a/lib/pages/carton/carton_image_upload_editor.dart +++ b/lib/pages/carton/carton_image_upload_editor.dart @@ -39,47 +39,40 @@ class _CartonImageUploaState extends State { labelColor: primaryColor, arrowColor: primaryColor, actions: [] - // isEdiable - // ? [ - // IconButton( - // icon: Icon(Icons.edit, color: primaryColor), - // onPressed: _gotoEditor, - // ), - // IconButton( - // icon: Icon(Icons.delete, color: primaryColor), - // onPressed: _delete, - // ), - // ] - // : [], + ), - body: ListView( - children: [ - Center( - child: Text("${_box?.cartonNumber}", - style: TextStyle( - color: primaryColor, - fontSize: 25, - ))), - MultiImageFile( - enabled: true, - controller: multiImgController, - title: "Receipt File", - ), - Center( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xff272262), - elevation: 3, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5.0)), - minimumSize: Size(300, 45), //////// HERE - ), - onPressed: () {}, - child: - const Text('Save', style: TextStyle(fontSize: 20)), + body: + Padding(padding:EdgeInsets.only(left: 12.0, right: 12), + child: ListView( + children: [ + Center( + child: Text("${_box?.cartonNumber}", + style: TextStyle( + color: primaryColor, + fontSize: 25, + ))), + + MultiImageFile( + enabled: true, + controller: multiImgController, + title: "Receipt File", ), - ), - ], - ))); + Center( + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xff272262), + elevation: 3, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0)), + minimumSize: Size(300, 45), //////// HERE + ), + onPressed: () {}, + child: + const Text('Save', style: TextStyle(fontSize: 20)), + ), + ), + ], + ), + ))); } } diff --git a/lib/pages/carton/carton_info.dart b/lib/pages/carton/carton_info.dart index 8cb50ca..c87eb82 100644 --- a/lib/pages/carton/carton_info.dart +++ b/lib/pages/carton/carton_info.dart @@ -34,14 +34,14 @@ class _CartonInfoState extends State { final DateFormat dateFormat = DateFormat("d MMM yyyy"); final NumberFormat numberFormatter = NumberFormat("#,###"); MultiImgController multiImgController = MultiImgController(); - bool _isLoading = false; late Carton _carton; - List _cargoTypes = []; List _surchareItems = []; List _mixCartons = []; List _packages = []; + double totalWeight=0.0; + double totalSurchargeCount=0.0; @override void initState() { @@ -52,6 +52,7 @@ class _CartonInfoState extends State { _init() async { _carton.billTo = billToSender; + _carton.cartonSizeType=standardCarton; _carton.cartonType = carton_from_packages; multiImgController.setImageUrls = _carton.photos; _cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList(); @@ -71,14 +72,16 @@ class _CartonInfoState extends State { if (mounted) { setState(() {}); } + _carton.cartonType="Carton for packages"; + totalWeight = + _carton.cargoTypes.fold(0, (sum, value) => sum + value.weight); + totalSurchargeCount = + _surchareItems.fold(0, (sum, value) => sum + value.qty); } @override Widget build(BuildContext context) { - double totalWeight = - _carton.cargoTypes.fold(0, (sum, value) => sum + value.weight); - double totalSurchargeCount = - _surchareItems.fold(0, (sum, value) => sum + value.qty); + final cartonTypeBox = DisplayText( text: _carton.cartonNumber, @@ -86,6 +89,11 @@ class _CartonInfoState extends State { ); final cartonQrBox = DisplayText(iconData: AntDesign.qrcode); + final cartonSubTypeBox = DisplayText( + text: _carton.cartonType==carton_from_packages ? "Carton for packages":"Mix carton", + subText:Text( "${_carton.cartonStandardSize}"), + labelTextKey: "box.carton.type", + ); final shipmentBox = DisplayText( text: _carton.fcsShipmentNumber, @@ -93,19 +101,19 @@ class _CartonInfoState extends State { ); final deliveryBox = DisplayText( - text: "Delivery Carton", + text: _carton.deliveryCarton, labelTextKey: "box.delivery_type", ); final senderBox = DisplayText( - text: _carton.userName == null ? "" : _carton.userName, - subText: Text(_carton.fcsID ?? "", style: textStyle), + text: _carton.senderName== null ? "" : _carton.senderName, + subText: Text(_carton.senderFCSID?? "", style: textStyle), labelTextKey: "box.name", ); final consigneeNameBox = DisplayText( - text: _carton.senderName != null ? _carton.senderName : "", - subText: Text(_carton.senderFCSID ?? "", style: textStyle), + text: _carton.userName != null ? _carton.userName : "", + subText: Text(_carton.fcsID?? "", style: textStyle), labelTextKey: "processing.consignee.name", ); @@ -338,14 +346,20 @@ class _CartonInfoState extends State { child: cartonQrBox, ), ]), + Row(children: [Flexible(child: cartonSubTypeBox),],), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Flexible(child: shipmentBox), - Flexible(child: deliveryBox), + _mixCartons.isEmpty + ? + Flexible(child: deliveryBox):const SizedBox(), ], ), - userRowBox, + _mixCartons.isEmpty + ? + userRowBox: + const SizedBox(), _packages.isEmpty ? const SizedBox() : Padding(