diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index 855390e..9a53ccb 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -288,6 +288,7 @@ "box.package":"Packages", "box.mix.desc":"Description", "box.info.title":"Carton Info", + "box.imageupload.title":"Upload images", "box.popupmenu.active":"Active Cartons", "box.popupmenu.delivered":"Delivered Cartons", "box.cargo.total":"Total Weight", @@ -334,6 +335,7 @@ "box.input_cargo_weight":"Input cargo weight (lb)", "box.input_surcharge_item":"Input surcharge items", "box.select.cargo_type":"Select surcharge item", + "box.surcharge.item":"Surcharge items", "box.package.count":"Packages ({0})", "Boxes End ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 3270107..b3202d8 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -288,6 +288,7 @@ "box.mix.number":"သေတ္တာ နံပါတ်", "box.mix.desc":"ဖော်ပြချက်", "box.info.title":"သေတ္တာ", + "box.imageupload.title":"ပုံများထည့်ခြင်း", "box.popupmenu.active":"လာမည့် သေတ္တာများ", "box.popupmenu.delivered":"ပို့ပြီးသော သေတ္တာများ", "box.cargo.total":"စုစုပေါင်း အလေးချိန်", @@ -333,6 +334,7 @@ "box.input_cargo_weight":"Input cargo weight (lb)", "box.input_surcharge_item":"Input surcharge items", "box.select.cargo_type":"Select surcharge item", + "box.surcharge.item":"Surcharge items", "box.package.count":"Packages ({0})", "Boxes End ================================================================":"", diff --git a/lib/pages/carton/carton_image_upload.dart b/lib/pages/carton/carton_image_upload.dart new file mode 100644 index 0000000..66cc338 --- /dev/null +++ b/lib/pages/carton/carton_image_upload.dart @@ -0,0 +1,80 @@ +import 'package:fcs/domain/entities/carton.dart'; +import 'package:fcs/domain/entities/package.dart'; +import 'package:fcs/domain/entities/user.dart'; +import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/main/util.dart'; +import 'package:fcs/pages/package/model/package_model.dart'; +import 'package:fcs/pages/user_search/user_serach.dart'; +import 'package:fcs/pages/widgets/barcode_scanner.dart'; +import 'package:fcs/pages/widgets/display_text.dart'; +import 'package:fcs/pages/widgets/fcs_id_icon.dart'; +import 'package:fcs/pages/widgets/input_text.dart'; +import 'package:fcs/pages/widgets/local_app_bar.dart'; +import 'package:fcs/pages/widgets/multi_img_controller.dart'; +import 'package:fcs/pages/widgets/multi_img_file.dart'; +import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/material.dart'; + + +typedef void FindCallBack(); + +class CartonImageUpload extends StatefulWidget { + final Carton? box; + const CartonImageUpload({this.box}); + @override + _CartonImageUploaState createState() => _CartonImageUploaState(); +} + +class _CartonImageUploaState extends State { + bool _isLoading = false; + Carton? _box; + late bool _isNew; + MultiImgController multiImgController = MultiImgController(); + + @override + void initState() { + super.initState(); + multiImgController.setImageUrls = _box!.photos; + } + + @override + Widget build(BuildContext context) { + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: LocalAppBar( + labelKey: "box.imageupload.title", + backgroundColor: Colors.white, + 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: [ + + //img + ], + ) + + + ) + ); + } + // final img = MultiImageFile( + // enabled: true, + // controller:multiImgController, + // title: "Receipt File", + // ); +} diff --git a/lib/pages/carton/carton_info.dart b/lib/pages/carton/carton_info.dart index 9236348..65982eb 100644 --- a/lib/pages/carton/carton_info.dart +++ b/lib/pages/carton/carton_info.dart @@ -5,6 +5,7 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/entities/pickup.dart'; import 'package:fcs/domain/vo/delivery_address.dart'; import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/carton/carton_image_upload.dart'; import 'package:fcs/pages/carton_size/model/carton_size_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/package/model/package_model.dart'; @@ -24,6 +25,7 @@ import 'package:fcs/pages/widgets/status_tree.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; +import 'package:image_picker/image_picker.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; @@ -35,6 +37,7 @@ import 'model/carton_model.dart'; import 'widgets.dart'; final DateFormat dateFormat = DateFormat("d MMM yyyy"); +final NumberFormat numberFormatter = NumberFormat("#,###"); class CartonInfo extends StatefulWidget { final Package? package; @@ -51,7 +54,7 @@ class _CartonInfoState extends State { Carton? _box; - List? cargoTypes; + DeliveryAddress? _deliveryAddress = new DeliveryAddress(); MultiImgController multiImgController = MultiImgController(); TextEditingController _widthController = new TextEditingController(); @@ -67,17 +70,9 @@ class _CartonInfoState extends State { bool isFromPackages = false; bool isSmallBag = false; bool isFromCartons = false; - bool isEdiable = false; - Package? _package; - final List packages=[Package(packageType: "2303HH"), - Package(packageType: "540FH"), - Package(packageType: "440WFH"), - ]; - final List cargos=[CargoType(name: "Electronics"), - CargoType(name: "General"), - CargoType(name: "Dangerous"), - ]; - + bool isEdiable = false; + final List cargoTypes=[]; +final List surchareItems=[]; @override void initState() { super.initState(); @@ -90,7 +85,7 @@ class _CartonInfoState extends State { _lengthController.addListener(_calShipmentWeight); _widthController.addListener(_calShipmentWeight); _heightController.addListener(_calShipmentWeight); - //multiImgController.setImageUrls = _box.photoUrls; + multiImgController.setImageUrls = _box!.photos; _updateBoxData(); _loadPackages(); _loadMixCartons(); @@ -185,7 +180,8 @@ class _CartonInfoState extends State { @override Widget build(BuildContext context) { var cartonModel = Provider.of(context); - + double totalWeight = _box!.cargoTypes.fold(0, (sum, value) => sum + value.weight); +double totalPieces = surchareItems.fold(0, (sum, value) => sum + value.qty); // final cartonTypeBox = LocalRadioButtons( // readOnly: true, // values: cartonModel.cartonTypesInfo, @@ -213,11 +209,11 @@ class _CartonInfoState extends State { //icon: FcsIDIcon(), ); - final fcsIDBox = DisplayText( - text: _box!.fcsID == null ? "" : _box!.fcsID, - labelTextKey: "box.fcs.id", - //icon: FcsIDIcon(), - ); + // final fcsIDBox = DisplayText( + // text: _box!.fcsID == null ? "" : _box!.fcsID, + // labelTextKey: "box.fcs.id", + // //icon: FcsIDIcon(), + // ); final customerNameBox = DisplayText( text: _box!.userName == null ? "" : _box!.userName, @@ -227,11 +223,11 @@ class _CartonInfoState extends State { //iconData: Icons.person, ); - final consigneefcsIDBox = DisplayText( - text: _box!.fcsID != null ? _box!.fcsID : "", - labelTextKey: "processing.fcs.id", - icon: FcsIDIcon(), - ); + // final consigneefcsIDBox = DisplayText( + // text: _box!.fcsID != null ? _box!.fcsID : "", + // labelTextKey: "processing.fcs.id", + // icon: FcsIDIcon(), + // ); final consigneeNameBox = DisplayText( text: _box!.senderName != null ? _box!.senderName : "", @@ -242,44 +238,44 @@ class _CartonInfoState extends State { // iconData: Ionicons.document_text_outline, ); - final consigneeBox = Container( - child: Column( - children: [ - consigneeNameBox, - IconButton(icon:Icon(Ionicons.document_text_outline), - onPressed:() {},), - Text("Bill to",style:TextStyle(color:Color.fromARGB(255, 57, 80, 233))) + // final consigneeBox = Container( + // child: Column( + // children: [ + // consigneeNameBox, + // IconButton(icon:Icon(Ionicons.document_text_outline), + // onPressed:() {},), + // Text("Bill to",style:TextStyle(color:Color.fromARGB(255, 57, 80, 233))) - ], - ), - ); + // ], + // ), + // ); - final shipperIDBox = Row( - children: [ - Expanded( - child: DisplayText( - text: _box!.senderFCSID, - labelTextKey: "processing.fcs.id", - icon: FcsIDIcon(), - )), - ], - ); + // final shipperIDBox = Row( + // children: [ + // Expanded( + // child: DisplayText( + // text: _box!.senderFCSID, + // labelTextKey: "processing.fcs.id", + // icon: FcsIDIcon(), + // )), + // ], + // ); - final shipperNamebox = DisplayText( - text: _box!.senderName, - labelTextKey: "processing.shipper.name", - maxLines: 2, - iconData: Icons.person, - ); + // final shipperNamebox = DisplayText( + // text: _box!.senderName, + // labelTextKey: "processing.shipper.name", + // maxLines: 2, + // iconData: Icons.person, + // ); - final shipperBox = Container( - child: Column( - children: [ - shipperIDBox, - shipperNamebox, - ], - ), - ); + // final shipperBox = Container( + // child: Column( + // children: [ + // shipperIDBox, + // shipperNamebox, + // ], + // ), + // ); final lengthBox = LengthPicker( controller: _lengthController, @@ -314,16 +310,154 @@ class _CartonInfoState extends State { labelTextKey: "box.package", ); - final subPackageBox=ListView(children: packages.map((pack)=> - Card(child: Row(children: [ - Container(child:Text((pack.packageType).toString())) - ]),) - ).toList(),); + final cargosBox = Padding( + padding: const EdgeInsets.only(top: 10), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // Padding( + // padding: const EdgeInsets.only(left: 5, bottom: 5, right: 20), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocalText(context, 'box.cargo.type', + color: Colors.black54, + fontSize: 16, + fontWeight: FontWeight.normal), + Padding(padding: EdgeInsets.only(right: 100), + child: + Text("${removeTrailingZeros(totalWeight)} lb", + style: TextStyle(color: Colors.black54, fontSize: 15))) + ], + ), + //), + Container( + // decoration: BoxDecoration( + // border: Border.all(color: primaryColor), + // borderRadius: BorderRadius.circular(5), + // ), + child: Padding( + padding: const EdgeInsets.only(right: 100), + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: _box!.cargoTypes.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.weight)} lb", + style: TextStyle( + color: Colors.black, fontSize: 15)) + ], + ), + ); + }).toList()), + const SizedBox(height: 10), + + ], + ), + ), + ), + ]), + ); + final surchargeItemBox = Padding( + padding: const EdgeInsets.only(top: 10), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // Padding( + // padding: const EdgeInsets.only(left: 5, bottom: 5, right: 20), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocalText(context, 'box.surcharge.item', + color: Colors.black54, + fontSize: 16, + fontWeight: FontWeight.normal), + Padding(padding: EdgeInsets.only(right: 100), + child: + Text("${removeTrailingZeros(totalPieces)} pcs", + style: TextStyle(color: Colors.black54, fontSize: 15))) + ], + ), + //), + Container( + // decoration: BoxDecoration( + // border: Border.all(color: primaryColor), + // borderRadius: BorderRadius.circular(5), + // ), + child: Padding( + padding: const EdgeInsets.only(right: 100), + 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", + style: TextStyle( + color: Colors.black, fontSize: 15)) + ], + ), + ); + }).toList()), + const SizedBox(height: 10), + 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: labelColor, fontSize: 15), + ), + Text("${numberFormatter.format(e.qty)} pc", + style: + TextStyle(color: labelColor, fontSize: 15)) + ], + ), + ); + }).toList()), + ], + ), + ), + ), + ]), + ); + final img = MultiImageFile( enabled: false, controller: multiImgController, title: "Receipt File", ); + final billWidget + = Expanded(child:Padding( + padding: EdgeInsets.only(left: 0,top: 15), + child: + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Ionicons.document_text_outline, color: primaryColor, size: 20), + Text("Bill to", style: TextStyle(color: primaryColor, fontSize: 15)) + ], + ))); + final cargoBox = DisplayText( //text: "203FVH", labelTextKey: "box.cargo.type", @@ -336,9 +470,9 @@ class _CartonInfoState extends State { labelTextKey: "box.carton_size", iconData: AntDesign.CodeSandbox, ); - final cargoTableBox = CargoTable( - cargoTypes: _box!.cargoTypes, - ); + // final cargoTableBox = CargoTable( + // cargoTypes: _box!.cargoTypes, + // ); // final mixCartonNumberBox = DisplayText( // text: _box!.mixCartonNumber, // labelTextKey: "box.mix.carton", @@ -396,10 +530,11 @@ class _CartonInfoState extends State { ] : [], ), - body: Container( - - padding: const EdgeInsets.all(10.0), - child: Column( children: [ + body: + Container( + padding: const EdgeInsets.all(10.0), + child: + Column(children: [ Row(children:[ Flexible(child: @@ -416,104 +551,58 @@ class _CartonInfoState extends State { ],), + Row( - - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Flexible(child: customerNameBox,), - Flexible(child: consigneeNameBox), - - - - ]), + Expanded( + child: Row( + //crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + customerNameBox, + ], + ), + ), + CargoType().isCutomDuty == false + ? billWidget + : const SizedBox() + ], + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only(left: 0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + consigneeNameBox, + ], + ), + ), + CargoType().isCutomDuty == true + ? billWidget + : const SizedBox() + ], + ), + )) + + ],), + packageBox, Column(children: - getPackageList(packages), + getPackageList(_box!.packages), ), - Column(children: getCargoList(cargos),), - //subPackageBox, - - - // packages.map((pack)=> - // Card(child: Row(children: [ - // Container(child:Text(pack.packageType,)) - // ]),) - // ).toList(), - - // flex: 1, - // ), -// Expanded( -// child: IconButton( -// alignment: Alignment.centerLeft, -// iconSize: 30, -// icon: const Icon( AntDesign.qrcode), -// onPressed: () { -// // ... -// }, -// ), -// ), - - // ], - // )), - - // Padding( - // padding: EdgeInsets.only(left: 10), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // Expanded( - // child: shipmentBox, - // flex: 1, - // ), - // Flexible( - // child: deliveryBox, - // ), - // ], - // )), - // Padding( - // padding: EdgeInsets.only(left: 10), - // child: Row( - // children: [ - // Flexible( - // child: customerNameBox, - // ), - // Column( - // crossAxisAlignment: CrossAxisAlignment.end, - // children: [ - // Row( - // children: [consigneeNameBox,Flexible( - // child: Column(children: [ - // Icon(Ionicons.document_text_outline), - // Text("Bill to", style: TextStyle(color: Colors.blue)) - // ])),], - // ) - // ], - // // child: consigneeNameBox, - // ), - // // Flexible( - // // child: Column(children: [ - // // Icon(Ionicons.document_text_outline), - // // Text("Bill to", style: TextStyle(color: Colors.blue)) - // // ])), - // ], - // )), - // Padding(padding: EdgeInsets.only(left:10), - // child: Flexible(child: packageBox)), - //for(int pack=0;pack { borderRadius: BorderRadius.circular(5.0)), minimumSize: Size(10, 35), //////// HERE ), - onPressed: (){}, + onPressed: (){ + Navigator.push( + context, + CupertinoPageRoute(builder: (context) => CartonImageUpload()), + ); + }, child: const Text('Upload Images'), ),)), img, @@ -541,18 +635,11 @@ class _CartonInfoState extends State { onPressed: (){}, child: const Text('Delete Carton',style:TextStyle(fontSize: 20)), ),), - + //_package!.photoUrls.length == 0 || _package!.photoUrls.isEmpty ? Container() : img, - // Padding(padding: EdgeInsets.only(left: 10.0), - // child: Column(children: [ - // cargos.isEmpty?Container(): - // Text(cargos[cargo].key), - // Text(cargos[cargo].value), - // ]),), - - //_packageList, - + + //LocalTitle(textKey: "box.shipment_info"), // shipmentBox, // isSmallBag ? mixCartonNumberBox : Container(), @@ -584,7 +671,7 @@ class _CartonInfoState extends State { // title: Text(pickups[index]), // ); // },) - + // ])), // // isMixBox ? mixTypeBox : Container(), // isMixBox ? LocalTitle(textKey: "box.mix_caton_title") : Container(), @@ -620,6 +707,7 @@ class _CartonInfoState extends State { ]) ) ) + // ]) // ) // )