This commit is contained in:
2024-09-24 08:21:22 +06:30
18 changed files with 335 additions and 118 deletions

View File

@@ -7,7 +7,6 @@
"Buttons Start ================================================================":"", "Buttons Start ================================================================":"",
"btn.save": "Save", "btn.save": "Save",
"btn.approve":"Approve", "btn.approve":"Approve",
"btn.delete":"Delete",
"btn.select":"Select", "btn.select":"Select",
"btn.cancel":"Cancel", "btn.cancel":"Cancel",
"btn.ok": "Ok", "btn.ok": "Ok",
@@ -248,7 +247,7 @@
"pm.add.btn":"Add payment method", "pm.add.btn":"Add payment method",
"pm.save.btn":"Save payment method", "pm.save.btn":"Save payment method",
"pm.delete.confirm":"Delete this payment method?", "pm.delete.confirm":"Delete this payment method?",
"pm_.title": "PAYMENT", "pm_.title": "Payment",
"pm.date": "Date", "pm.date": "Date",
"pm.amount": "Amount", "pm.amount": "Amount",
"pm.receipt":"Payment receipt amount", "pm.receipt":"Payment receipt amount",
@@ -281,7 +280,7 @@
"box.cargo.type":"Cargos", "box.cargo.type":"Cargos",
"box.dimension":"Dimension", "box.dimension":"Dimension",
"box.delivery_address":"Delivery address", "box.delivery_address":"Delivery address",
"box.delivery_type":"Delivery type", "box.delivery_type":"Last mile",
"box.fcs_shipment_num":"Shipment", "box.fcs_shipment_num":"Shipment",
"box.fcs.id":"FCS ID", "box.fcs.id":"FCS ID",
"box.name":"Sender", "box.name":"Sender",
@@ -329,15 +328,15 @@
"box.weight":"Weight", "box.weight":"Weight",
"box.mix_carton.update.btn":"Update mix carton", "box.mix_carton.update.btn":"Update mix carton",
"box.cargo.select.btn":"Select", "box.cargo.select.btn":"Select",
"box.select.carton_type":"Select carton type", "box.select.carton_type":"Carton type",
"box.select.sender_and_consignee":"Select sender and consignee", "box.select.sender_and_consignee":"Sender and Consignee",
"box.cartion.count":"Cartons ({0})", "box.cartion.count":"Cartons ({0})",
"box.sender.title":"Sender", "box.sender.title":"Sender",
"box.consignee.title":"Consignee", "box.consignee.title":"Consignee",
"box.bill_to_sender":"Bill to sender", "box.bill_to_sender":"Bill to sender",
"box.bill_to.consignee":"Bill to consignee", "box.bill_to.consignee":"Bill to consignee",
"box.done.btn":"Done", "box.done.btn":"Done",
"box.select_carton_size":"Select the carton size", "box.select_carton_size":"Carton size",
"box.select_shipment":"Select the shipment", "box.select_shipment":"Select the shipment",
"box.shipment":"Shipment", "box.shipment":"Shipment",
"box.standard_carton_size":"Standard carton size", "box.standard_carton_size":"Standard carton size",
@@ -347,11 +346,11 @@
"box.no_carton":"There is no cartons in this shipment.", "box.no_carton":"There is no cartons in this shipment.",
"box.crete.carton":"Create carton", "box.crete.carton":"Create carton",
"box.carton.type":"Carton type", "box.carton.type":"Carton type",
"box.select.delivery":"Select delivery type", "box.select.delivery":"Last mile",
"box.select.package":"Select packages", "box.select.package":"Select packages",
"box.no_package":"There is no packages.", "box.no_package":"There is no packages.",
"box.input_cargo_weight":"Input cargo weight (lb)", "box.input_cargo_weight":"Cargo type (lb)",
"box.input_surcharge_item":"Input surcharge items", "box.input_surcharge_item":"Surcharge items",
"box.select.cargo_type":"Select surcharge item", "box.select.cargo_type":"Select surcharge item",
"box.surcharge.item":"Surcharge items", "box.surcharge.item":"Surcharge items",
"box.package.count":"Packages ({0})", "box.package.count":"Packages ({0})",
@@ -369,6 +368,8 @@
"box.invoice.confirm":"Confirm invoice?", "box.invoice.confirm":"Confirm invoice?",
"box.print.qr.title":"Print QRCode", "box.print.qr.title":"Print QRCode",
"box.print.btn":"Print", "box.print.btn":"Print",
"box.delivery":"Delivery",
"box.pickup":"Pick-up",
"Boxes End ================================================================":"", "Boxes End ================================================================":"",
"Delivery Start ================================================================":"", "Delivery Start ================================================================":"",

View File

@@ -6,7 +6,6 @@
"Buttons Start ================================================================":"", "Buttons Start ================================================================":"",
"btn.save":"သိမ်းဆည်းရန်", "btn.save":"သိမ်းဆည်းရန်",
"btn.approve":"အတည်ပြုရန်", "btn.approve":"အတည်ပြုရန်",
"btn.delete":"ဖျက်ရန်",
"btn.select":"ရွေးချယ်ပါ", "btn.select":"ရွေးချယ်ပါ",
"btn.cancel":"မလုပ်နဲ့", "btn.cancel":"မလုပ်နဲ့",
"btn.ok": "အိုကေ", "btn.ok": "အိုကေ",
@@ -282,7 +281,7 @@
"box.cargo.type":"ကုန်ပစ္စည်းအမျိုးအစားများ", "box.cargo.type":"ကုန်ပစ္စည်းအမျိုးအစားများ",
"box.dimension":"အရွယ်အစား", "box.dimension":"အရွယ်အစား",
"box.delivery_address":"ပို့ဆောင်ရမည့်လိပ်စာ", "box.delivery_address":"ပို့ဆောင်ရမည့်လိပ်စာ",
"box.delivery_type":"ပို့ဆောင်ရမည့်အမျိုးအစား", "box.delivery_type":"နောက်ဆုံးမိုင်",
"box.fcs_shipment_num":"တင်ပို့နံပါတ်", "box.fcs_shipment_num":"တင်ပို့နံပါတ်",
"box.fcs.id":"FCS ID", "box.fcs.id":"FCS ID",
"box.name":"ပေးပို့သူ", "box.name":"ပေးပို့သူ",
@@ -329,15 +328,15 @@
"box.weight":"အလေးချိန်", "box.weight":"အလေးချိန်",
"box.mix_carton.update.btn":"Update mix carton", "box.mix_carton.update.btn":"Update mix carton",
"box.cargo.select.btn":"ရွေးချယ်မည်", "box.cargo.select.btn":"ရွေးချယ်မည်",
"box.select.carton_type":"Select carton type", "box.select.carton_type":"Carton type",
"box.select.sender_and_consignee":"Select sender and consignee", "box.select.sender_and_consignee":"Sender and Consignee",
"box.cartion.count":"Cartons ({0})", "box.cartion.count":"Cartons ({0})",
"box.sender.title":"ပေးပို့သူ", "box.sender.title":"ပေးပို့သူ",
"box.consignee.title":"လက်ခံသူ", "box.consignee.title":"လက်ခံသူ",
"box.bill_to_sender":"ပေးပို့သူထံ ငွေတောင်းခံရန်", "box.bill_to_sender":"ပေးပို့သူထံ ငွေတောင်းခံရန်",
"box.bill_to.consignee":"လက်ခံသူထံ ငွေတောင်းခံရန်", "box.bill_to.consignee":"လက်ခံသူထံ ငွေတောင်းခံရန်",
"box.done.btn":"Done", "box.done.btn":"Done",
"box.select_carton_size":"Select the carton size", "box.select_carton_size":"Carton size",
"box.select_shipment":"Select the shipment", "box.select_shipment":"Select the shipment",
"box.shipment":"Shipment", "box.shipment":"Shipment",
"box.standard_carton_size":"Standard carton size", "box.standard_carton_size":"Standard carton size",
@@ -347,11 +346,11 @@
"box.no_carton":"There is no cartons in this shipment.", "box.no_carton":"There is no cartons in this shipment.",
"box.crete.carton":"Create carton", "box.crete.carton":"Create carton",
"box.carton.type":"ပုံး အမျိုးအစား", "box.carton.type":"ပုံး အမျိုးအစား",
"box.select.delivery":"Select delivery type", "box.select.delivery":"Last mile",
"box.select.package":"Select packages", "box.select.package":"Select packages",
"box.no_package":"There is no packages.", "box.no_package":"There is no packages.",
"box.input_cargo_weight":"Input cargo weight (lb)", "box.input_cargo_weight":"Cargo type (lb)",
"box.input_surcharge_item":"Input surcharge items", "box.input_surcharge_item":"Surcharge items",
"box.select.cargo_type":"Select surcharge item", "box.select.cargo_type":"Select surcharge item",
"box.surcharge.item":"Surcharge items", "box.surcharge.item":"Surcharge items",
"box.package.count":"Packages ({0})", "box.package.count":"Packages ({0})",
@@ -369,6 +368,8 @@
"box.invoice.confirm":"ပြေစာ အတည်ပြုပါ ?", "box.invoice.confirm":"ပြေစာ အတည်ပြုပါ ?",
"box.print.qr.title":"QRCode ပရင့်ထုတ်ရန်", "box.print.qr.title":"QRCode ပရင့်ထုတ်ရန်",
"box.print.btn":"ပရင့်ထုတ်မည်", "box.print.btn":"ပရင့်ထုတ်မည်",
"box.delivery":"Delivery",
"box.pickup":"Pick-up",
"Boxes End ================================================================":"", "Boxes End ================================================================":"",
"Delivery Start ================================================================":"", "Delivery Start ================================================================":"",

View File

@@ -89,8 +89,8 @@ const shipment_local_dropoff = "Local drop off";
const shipment_courier_dropoff = "Courier drop off"; const shipment_courier_dropoff = "Courier drop off";
//Carton types //Carton types
const carton_from_packages = "Carton for packages"; const carton_from_packages = "For packages";
const carton_mix_carton = "Mix carton"; const carton_mix_carton = "For cartons (Mix carton)";
const carton_from_cartons = "From cartons"; const carton_from_cartons = "From cartons";
const carton_from_shipments = "From shipments"; const carton_from_shipments = "From shipments";
@@ -140,8 +140,8 @@ const payment_confirmed_status = "confirmed";
const payment_canceled_status = "canceled"; const payment_canceled_status = "canceled";
//Delivery types //Delivery types
const delivery_caton = "Delivery carton"; const delivery_caton = "Delivery";
const pickup_carton = "Pick-up carton"; const pickup_carton = "Pick-up";
// bill // bill
const billToSender = "Bill to sender"; const billToSender = "Bill to sender";

View File

@@ -88,4 +88,24 @@ class SharedPref {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
prefs.remove(key); prefs.remove(key);
} }
static Future<void> saveRecentSearch(String key, String query) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
//Use `Set` to avoid duplication of recentSearches
Set<String> allSearches = prefs.getStringList(key)?.toSet() ?? {};
//Place it at first in the set
allSearches = {query, ...allSearches};
prefs.setStringList(key, allSearches.toList());
}
static Future<List<String>?> getRecentSearch(String key, String query) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final allSearches = prefs.getStringList(key);
return allSearches!.where((search) => search.startsWith(query)).toList();
}
static Future<void> clearRecentSearch(String key) async {
return await _remove(key);
}
} }

View File

@@ -151,6 +151,7 @@ class _CargoWidgetState extends State<CargoWidget> {
); );
final userRow = Row( final userRow = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded(child: senderBox, flex: 2), Expanded(child: senderBox, flex: 2),
Flexible(child: consigneeBox) Flexible(child: consigneeBox)
@@ -265,7 +266,7 @@ class _CargoWidgetState extends State<CargoWidget> {
_surchargeControllers.clear(); _surchargeControllers.clear();
_surchareItems.asMap().entries.forEach((e) { _surchareItems.asMap().entries.forEach((e) {
var editor = new TextEditingController(); var editor = new TextEditingController();
editor.text = e.value.qty == 0 ? "" : e.value.qty.toString(); editor.text = e.value.qty.toString();
_surchargeControllers.add(editor); _surchargeControllers.add(editor);
}); });
@@ -314,6 +315,12 @@ class _CargoWidgetState extends State<CargoWidget> {
final continueBtn = ContinueButton( final continueBtn = ContinueButton(
onTap: () { onTap: () {
if (widget.onContinue != null) { if (widget.onContinue != null) {
if(_surchareItems.isNotEmpty && _surchareItems.any((item)=> item.qty == 0)){
showMsgDialog(context, "Error", "Please insert surcharge item quantity");
return;
}
widget.onContinue!(_cargoTypes, _surchareItems); widget.onContinue!(_cargoTypes, _surchareItems);
} }
}, },

View File

@@ -167,27 +167,33 @@ class _CartonFilterState extends State<CartonFilter> {
final _titleWidget = SizedBox( final _titleWidget = SizedBox(
height: 30, height: 30,
child: TabBar( child: Theme(
unselectedLabelColor: Colors.grey, data: ThemeData(
labelColor: primaryColor, highlightColor: Colors.transparent,
indicatorColor: primaryColor, splashColor: Colors.transparent,
indicatorSize: TabBarIndicatorSize.tab, ),
labelPadding: const EdgeInsets.all(0), child: TabBar(
indicatorPadding: const EdgeInsets.all(0), unselectedLabelColor: Colors.grey,
tabs: [ labelColor: primaryColor,
Tab( indicatorColor: primaryColor,
text: AppTranslations.of(context)?.text("box.fcs_shipment_num"), indicatorSize: TabBarIndicatorSize.tab,
), labelPadding: const EdgeInsets.all(0),
Tab( indicatorPadding: const EdgeInsets.all(0),
text: AppTranslations.of(context)?.text("box.consignee.title"), tabs: [
), Tab(
Tab( text: AppTranslations.of(context)?.text("box.fcs_shipment_num"),
text: AppTranslations.of(context)?.text("box.sender.title"), ),
), Tab(
Tab( text: AppTranslations.of(context)?.text("box.consignee.title"),
text: AppTranslations.of(context)?.text("box.status"), ),
), Tab(
], text: AppTranslations.of(context)?.text("box.sender.title"),
),
Tab(
text: AppTranslations.of(context)?.text("box.status"),
),
],
),
), ),
); );

View File

@@ -90,7 +90,7 @@ class _CartonInfoState extends State<CartonInfo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String? boxDimension = _carton.cartonSizeType == standardCarton String? boxDimension = _carton.cartonSizeType == standardCarton
? "${standardSize?.name} - ${standardSize?.length.toInt()}”x${standardSize?.width.toInt()}”x${standardSize?.height.toInt()}" ? "${standardSize?.name} - ${standardSize?.length.toInt()}”x${standardSize?.width.toInt()}”x${standardSize?.height.toInt()}"
: _carton.cartonSizeType == customCarton : _carton.cartonSizeType == customCarton
? "${_carton.length.toInt()}”x${_carton.width.toInt()}”x${_carton.height.toInt()}" ? "${_carton.length.toInt()}”x${_carton.width.toInt()}”x${_carton.height.toInt()}"
@@ -113,12 +113,20 @@ class _CartonInfoState extends State<CartonInfo> {
final cartonSubTypeBox = DisplayText( final cartonSubTypeBox = DisplayText(
text: _carton.cartonType == carton_from_packages text: _carton.cartonType == carton_from_packages
? "Carton for packages" ? "For packages"
: "Mix carton", : "Mix carton",
subText: boxDimension == null ? null : Text("$boxDimension"),
labelTextKey: "box.carton.type", labelTextKey: "box.carton.type",
); );
final billInfoBox = DisplayText(
text: _carton.billTo == billToSender
? "Sender"
: _carton.billTo == billToConsignee
? "Consignee"
: null,
labelTextKey: "box.bill_to",
);
final shipmentBox = DisplayText( final shipmentBox = DisplayText(
text: _carton.fcsShipmentNumber, text: _carton.fcsShipmentNumber,
labelTextKey: "box.fcs_shipment_num", labelTextKey: "box.fcs_shipment_num",
@@ -129,6 +137,11 @@ class _CartonInfoState extends State<CartonInfo> {
labelTextKey: "box.delivery_type", labelTextKey: "box.delivery_type",
); );
final cartonSizeBox = DisplayText(
subText: boxDimension == null ? null : Text("$boxDimension"),
labelTextKey: "box.carton_size",
);
final senderBox = DisplayText( final senderBox = DisplayText(
text: _carton.senderName == null ? "" : _carton.senderName, text: _carton.senderName == null ? "" : _carton.senderName,
subText: Text(_carton.senderFCSID ?? "", style: textStyle), subText: Text(_carton.senderFCSID ?? "", style: textStyle),
@@ -141,18 +154,18 @@ class _CartonInfoState extends State<CartonInfo> {
labelTextKey: "processing.consignee.name", labelTextKey: "processing.consignee.name",
); );
final billWidget = Expanded( // final billWidget = Expanded(
child: Padding( // child: Padding(
padding: EdgeInsets.only(left: 0, top: 15), // padding: EdgeInsets.only(left: 0, top: 15),
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
children: [ // children: [
Icon(Ionicons.document_text_outline, // Icon(Ionicons.document_text_outline,
color: primaryColor, size: 20), // color: primaryColor, size: 20),
Text("Bill to", // Text("Bill to",
style: TextStyle(color: primaryColor, fontSize: 15)) // style: TextStyle(color: primaryColor, fontSize: 15))
], // ],
))); // )));
final userRowBox = Row( final userRowBox = Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@@ -169,7 +182,7 @@ class _CartonInfoState extends State<CartonInfo> {
], ],
), ),
), ),
_carton.billTo == billToSender ? billWidget : const SizedBox() // _carton.billTo == billToSender ? billWidget : const SizedBox()
], ],
), ),
), ),
@@ -185,7 +198,7 @@ class _CartonInfoState extends State<CartonInfo> {
], ],
), ),
), ),
_carton.billTo == billToConsignee ? billWidget : const SizedBox() // _carton.billTo == billToConsignee ? billWidget : const SizedBox()
], ],
)) ))
], ],
@@ -354,26 +367,34 @@ class _CartonInfoState extends State<CartonInfo> {
padding: const EdgeInsets.only(left: 20, right: 20), padding: const EdgeInsets.only(left: 20, right: 20),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
Row(children: [ Row(children: [
Flexible(child: cartonTypeBox), Flexible(child: cartonTypeBox,flex: 1),
Flexible( Flexible(
child: cartonQrBox, child: cartonQrBox,
), ),
]), ]),
Row( Row(
children: [ children: [
Flexible(child: cartonSubTypeBox), Flexible(child: cartonSubTypeBox),
], ],
), ),
_mixCartons.isEmpty ? userRowBox : const SizedBox(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Flexible(child: billInfoBox),
Flexible(child: shipmentBox), Flexible(child: shipmentBox),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_mixCartons.isEmpty _mixCartons.isEmpty
? Flexible(child: deliveryBox) ? Flexible(child: deliveryBox)
: const SizedBox(), : const SizedBox(),
Flexible(child: cartonSizeBox),
], ],
), ),
_mixCartons.isEmpty ? userRowBox : const SizedBox(),
_packages.isEmpty _packages.isEmpty
? const SizedBox() ? const SizedBox()
: Padding( : Padding(

View File

@@ -16,7 +16,6 @@ import '../widgets/box_size_picker.dart';
import '../widgets/continue_button.dart'; import '../widgets/continue_button.dart';
import '../widgets/display_text.dart'; import '../widgets/display_text.dart';
import '../widgets/local_dropdown.dart'; import '../widgets/local_dropdown.dart';
import '../widgets/local_radio_buttons.dart';
import '../widgets/local_text.dart'; import '../widgets/local_text.dart';
import '../widgets/local_title.dart'; import '../widgets/local_title.dart';
import '../widgets/previous_button.dart'; import '../widgets/previous_button.dart';
@@ -62,7 +61,7 @@ class CartonSizeWidget extends StatefulWidget {
} }
class _CartonSizeWidgetState extends State<CartonSizeWidget> { class _CartonSizeWidgetState extends State<CartonSizeWidget> {
List<String> _deliveryTypes = [delivery_caton, pickup_carton]; // List<String> _deliveryTypes = [delivery_caton, pickup_carton];
FcsShipment? _shipment; FcsShipment? _shipment;
String _cartonSizeType = standardCarton; String _cartonSizeType = standardCarton;
@@ -132,7 +131,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
text: widget.sender.name, text: widget.sender.name,
labelTextKey: "box.sender.title", labelTextKey: "box.sender.title",
iconData: MaterialCommunityIcons.account_arrow_right, iconData: MaterialCommunityIcons.account_arrow_right,
subText: Text(widget.sender.fcsID!, subText: Text(widget.sender.fcsID ?? "",
style: TextStyle(fontSize: 13, color: labelColor)), style: TextStyle(fontSize: 13, color: labelColor)),
); );
@@ -145,6 +144,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
); );
final userRow = Row( final userRow = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: senderBox, child: senderBox,
@@ -154,14 +154,71 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
], ],
); );
final deliveryTypeBox = LocalRadioButtons( final deliveryTypeBox = Container(
values: _deliveryTypes, child: Row(
selectedValue: _selectedDeliveryType, children: [
callback: (String? v) { Flexible(
setState(() { child: InkWell(
_selectedDeliveryType = v!; onTap: () {
}); setState(() {
}); _selectedDeliveryType = delivery_caton;
});
},
child: Row(children: <Widget>[
LocalRadio(
value: delivery_caton,
groupValue: _selectedDeliveryType,
onChanged: (p0) {
setState(() {
_selectedDeliveryType = delivery_caton;
});
},
),
Flexible(
child: Padding(
padding: const EdgeInsets.only(left: 10),
child: LocalText(context, 'box.delivery',
fontSize: 15,
color: _selectedDeliveryType == delivery_caton
? primaryColor
: Colors.black),
),
)
]),
)),
Flexible(
child: InkWell(
onTap: () {
setState(() {
_selectedDeliveryType = pickup_carton;
});
},
child: Row(children: <Widget>[
LocalRadio(
value: pickup_carton,
groupValue: _selectedDeliveryType,
onChanged: (p0) {
setState(() {
_selectedDeliveryType = pickup_carton;
});
},
),
Flexible(
child: Padding(
padding: const EdgeInsets.only(left: 10),
child: LocalText(context, 'box.pickup',
fontSize: 15,
color: _selectedDeliveryType == pickup_carton
? primaryColor
: Colors.black),
),
)
]),
),
)
],
),
);
final billRadioBox = Container( final billRadioBox = Container(
child: Row( child: Row(
@@ -186,7 +243,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
Flexible( Flexible(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 10), padding: const EdgeInsets.only(left: 10),
child: LocalText(context, 'box.bill_to_sender', child: LocalText(context, 'box.sender.title',
fontSize: 15, fontSize: 15,
color: _billToValue == billToSender color: _billToValue == billToSender
? primaryColor ? primaryColor
@@ -215,7 +272,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
Flexible( Flexible(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 10), padding: const EdgeInsets.only(left: 10),
child: LocalText(context, 'box.bill_to.consignee', child: LocalText(context, 'box.consignee.title',
fontSize: 15, fontSize: 15,
color: _billToValue == billToConsignee color: _billToValue == billToConsignee
? primaryColor ? primaryColor
@@ -465,12 +522,14 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
children: [ children: [
const SizedBox(height: 8), const SizedBox(height: 8),
userRow, userRow,
LocalTitle(textKey: "box.bill_to", topPadding: 8),
const SizedBox(height: 5), const SizedBox(height: 5),
billRadioBox, billRadioBox,
const SizedBox(height: 8),
LocalTitle(textKey: "box.select.delivery"), LocalTitle(textKey: "box.select.delivery"),
const SizedBox(height: 5), const SizedBox(height: 5),
deliveryTypeBox, deliveryTypeBox,
const SizedBox(height: 5), const SizedBox(height: 8),
LocalTitle(textKey: "box.select_carton_size"), LocalTitle(textKey: "box.select_carton_size"),
const SizedBox(height: 8), const SizedBox(height: 8),
cartonSizedBox, cartonSizedBox,

View File

@@ -71,7 +71,8 @@ class CartonSubmit extends StatelessWidget {
child: SubmitTextWidget( child: SubmitTextWidget(
labelKey: 'box.carton.type', labelKey: 'box.carton.type',
text: carton_from_packages, text: carton_from_packages,
subText: boxDimension), // subText: boxDimension
),
); );
final shipmentBox = Padding( final shipmentBox = Padding(
@@ -135,9 +136,9 @@ class CartonSubmit extends StatelessWidget {
], ],
), ),
), ),
billToValue == billToSender // billToValue == billToSender
? billWidget(context) // ? billWidget(context)
: const SizedBox() // : const SizedBox()
], ],
), ),
), ),
@@ -162,9 +163,9 @@ class CartonSubmit extends StatelessWidget {
], ],
), ),
), ),
billToValue == billToConsignee // billToValue == billToConsignee
? billWidget(context) // ? billWidget(context)
: const SizedBox() // : const SizedBox()
], ],
), ),
)) ))
@@ -174,14 +175,30 @@ class CartonSubmit extends StatelessWidget {
]), ]),
); );
final billToBox = Padding(
padding: const EdgeInsets.only(top: 10),
child: SubmitTextWidget(
labelKey: 'box.bill_to',
text: billToValue == billToSender ? 'Sender' : 'Consignee',
),
);
final deliveryTypeBox = Padding( final deliveryTypeBox = Padding(
padding: const EdgeInsets.only(top: 10), padding: const EdgeInsets.only(top: 10),
child: SubmitTextWidget( child: SubmitTextWidget(
labelKey: 'box.delivery_type', labelKey: 'box.select.delivery',
text: deliveryType, text: deliveryType,
), ),
); );
final cartonSizeBox = Padding(
padding: const EdgeInsets.only(top: 10),
child: SubmitTextWidget(
labelKey: 'box.carton_size',
text: boxDimension??'',
),
);
final packagesBox = Padding( final packagesBox = Padding(
padding: const EdgeInsets.only(top: 10), padding: const EdgeInsets.only(top: 10),
child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
@@ -341,12 +358,16 @@ class CartonSubmit extends StatelessWidget {
children: [ children: [
cartonType, cartonType,
const SizedBox(height: 10), const SizedBox(height: 10),
shipmentBox,
const SizedBox(height: 10),
usersBox, usersBox,
const SizedBox(height: 10), const SizedBox(height: 10),
billToBox,
const SizedBox(height: 10),
deliveryTypeBox, deliveryTypeBox,
const SizedBox(height: 10), const SizedBox(height: 10),
cartonSizeBox,
const SizedBox(height: 10),
shipmentBox,
const SizedBox(height: 10),
packages.isNotEmpty ? packagesBox : const SizedBox(), packages.isNotEmpty ? packagesBox : const SizedBox(),
const SizedBox(height: 10), const SizedBox(height: 10),
cargosBox, cargosBox,

View File

@@ -3,7 +3,6 @@ import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/rates/model/shipment_rate_model.dart'; import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
import 'package:fcs/pages/widgets/local_app_bar.dart'; import 'package:fcs/pages/widgets/local_app_bar.dart';
import 'package:fcs/pages/widgets/local_title.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -117,9 +116,6 @@ class _CustomDutyAdditionState extends State<CustomDutyAddition> {
child: ListView( child: ListView(
shrinkWrap: true, shrinkWrap: true,
children: <Widget>[ children: <Widget>[
LocalTitle(
textKey: "box.select.cargo.title",
),
Column( Column(
children: getCargoRowList(customDuties), children: getCargoRowList(customDuties),
), ),

View File

@@ -112,7 +112,15 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
child: SubmitTextWidget( child: SubmitTextWidget(
labelKey: 'box.carton.type', labelKey: 'box.carton.type',
text: carton_mix_carton, text: carton_mix_carton,
subText: boxDimension, // subText: boxDimension,
),
);
final cartonSizeBox = Padding(
padding: const EdgeInsets.only(top: 10),
child: SubmitTextWidget(
labelKey: 'box.carton_size',
text: boxDimension ?? '',
), ),
); );
@@ -284,6 +292,8 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
children: [ children: [
cartonType, cartonType,
const SizedBox(height: 10), const SizedBox(height: 10),
cartonSizeBox,
const SizedBox(height: 10),
shipmentBox, shipmentBox,
const SizedBox(height: 10), const SizedBox(height: 10),
widget.cartons.isNotEmpty ? cartonsBox : const SizedBox(), widget.cartons.isNotEmpty ? cartonsBox : const SizedBox(),

View File

@@ -126,6 +126,7 @@ class _PackageSelectionWidgetState extends State<PackageSelectionWidget> {
); );
final userRow = Row( final userRow = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: senderBox, child: senderBox,

View File

@@ -31,7 +31,7 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
bool _isLoading = false; bool _isLoading = false;
bool _isNew = true; bool _isNew = true;
final _deliveryFormKey=GlobalKey<FormState>(); final _deliveryFormKey = GlobalKey<FormState>();
@override @override
void initState() { void initState() {
@@ -64,8 +64,8 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
controller: _nameController, controller: _nameController,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) { validator: (value) {
if(value==null || value.isEmpty){ if (value == null || value.isEmpty) {
return"Please enter full name"; return "Please enter full name";
} }
return null; return null;
}); });
@@ -74,10 +74,10 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
labelTextKey: 'delivery_address.address_line1', labelTextKey: 'delivery_address.address_line1',
iconData: Icons.location_on, iconData: Icons.location_on,
controller: _address1Controller, controller: _address1Controller,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) { validator: (value) {
if(value==null || value.isEmpty){ if (value == null || value.isEmpty) {
return"Please enter address"; return "Please enter address";
} }
return null; return null;
}); });
@@ -91,10 +91,10 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
labelTextKey: 'delivery_address.city', labelTextKey: 'delivery_address.city',
iconData: Icons.location_city, iconData: Icons.location_city,
controller: _cityController, controller: _cityController,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) { validator: (value) {
if(value==null || value.isEmpty){ if (value == null || value.isEmpty) {
return"Please enter city"; return "Please enter city";
} }
return null; return null;
}); });
@@ -103,10 +103,10 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
labelTextKey: 'delivery_address.state_region', labelTextKey: 'delivery_address.state_region',
iconData: Entypo.location, iconData: Entypo.location,
controller: _stateController, controller: _stateController,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) { validator: (value) {
if(value==null || value.isEmpty){ if (value == null || value.isEmpty) {
return"Please enter state/region"; return "Please enter state/region";
} }
return null; return null;
}); });
@@ -116,10 +116,10 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
iconData: Icons.phone, iconData: Icons.phone,
textInputType: TextInputType.phone, textInputType: TextInputType.phone,
controller: _phoneController, controller: _phoneController,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) { validator: (value) {
if(value==null || value.isEmpty){ if (value == null || value.isEmpty) {
return"Please enter phone number"; return "Please enter phone number";
} }
return null; return null;
}); });
@@ -207,7 +207,7 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
} }
Future<bool> _validate(DeliveryAddress deliveryAddress) async { Future<bool> _validate(DeliveryAddress deliveryAddress) async {
if(_deliveryFormKey.currentState!.validate()){ if (!_deliveryFormKey.currentState!.validate()) {
return false; return false;
} }
// if (deliveryAddress.addressLine1 == "") { // if (deliveryAddress.addressLine1 == "") {

View File

@@ -87,7 +87,7 @@ class FcsShipmentModel extends BaseModel {
try { try {
var snaps = await FirebaseFirestore.instance var snaps = await FirebaseFirestore.instance
.collection("/$fcs_shipment_collection") .collection("/$fcs_shipment_collection")
.where("status", isEqualTo: fcs_shipment_processed_status) // .where("status", isEqualTo: fcs_shipment_processed_status)
.get(const GetOptions(source: Source.server)); .get(const GetOptions(source: Source.server));
fcsShipments = snaps.docs.map((documentSnapshot) { fcsShipments = snaps.docs.map((documentSnapshot) {
var fcs = var fcs =

View File

@@ -13,6 +13,8 @@ import 'package:fcs/pagination/paginator_listener.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:path/path.dart' as Path; import 'package:path/path.dart' as Path;
import '../../../helpers/shared_pref.dart';
class PackageModel extends BaseModel { class PackageModel extends BaseModel {
final log = Logger('PackageModel'); final log = Logger('PackageModel');
@@ -214,7 +216,10 @@ class PackageModel extends BaseModel {
return packages; return packages;
} }
Future<List<User>> searchUser(String term) { Future<List<User>> searchUser(String term) async {
if (term != '') {
await SharedPref.saveRecentSearch('account_search', term);
}
return Services.instance.userService.searchUser(term); return Services.instance.userService.searchUser(term);
} }

View File

@@ -86,7 +86,7 @@ class _ProfileState extends State<Profile> {
); );
final deleteAccountBox = DisplayText( final deleteAccountBox = DisplayText(
labelTextKey: "profile.delete.title", labelTextKey: "profile.delete.title",
iconData: MaterialCommunityIcons.delete, iconData: MaterialCommunityIcons.account_remove,
); );
final phonenumberbox = DisplayText( final phonenumberbox = DisplayText(

View File

@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../data/services/services.dart'; import '../../data/services/services.dart';
import '../../helpers/shared_pref.dart';
import '../widgets/suggest_list.dart';
typedef OnUserSelect(User suer); typedef OnUserSelect(User suer);
typedef OnUserRowSelect(User suer); typedef OnUserRowSelect(User suer);
@@ -79,7 +81,7 @@ class UserSearchDelegate extends SearchDelegate<User> {
child: Text( child: Text(
"No result found", "No result found",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color:Colors.black), style: TextStyle(color: Colors.black),
), ),
), ),
); );
@@ -118,12 +120,26 @@ class UserSearchDelegate extends SearchDelegate<User> {
@override @override
Widget buildSuggestions(BuildContext context) { Widget buildSuggestions(BuildContext context) {
return Container( return FutureBuilder<List<String>?>(
child: Center( future: SharedPref.getRecentSearch('account_search', query),
child: Opacity( builder: (context, snapshot) {
opacity: 0.2, List<String> _oldFilters = snapshot.data ?? [];
child: Icon(Icons.perm_identity, size: 200, color: primaryColor)), if (_oldFilters.isEmpty) {
), return const Center(
child: Opacity(
opacity: 0.2,
child: Icon(Icons.perm_identity, color: primaryColor, size: 200),
),
);
}
return SuggestList(
recentSearchList: _oldFilters,
onTap: (String s) {
query = s;
showResults(context);
},
prefKey: 'account_search');
},
); );
} }

View File

@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../helpers/theme.dart';
typedef OnTap = Function(String query);
class SuggestList extends StatefulWidget {
final List<String>? recentSearchList;
final String prefKey;
final OnTap? onTap;
const SuggestList(
{Key? key, this.recentSearchList, this.onTap, required this.prefKey})
: super(key: key);
@override
_SuggestListState createState() => _SuggestListState();
}
class _SuggestListState extends State<SuggestList> {
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: widget.recentSearchList?.length,
itemBuilder: (context, index) {
return ListTile(
leading: const Icon(Icons.restore, color: labelColor),
title: Text(
widget.recentSearchList?[index] ?? '',
style: const TextStyle(color: primaryColor),
),
onTap: () {
if (widget.onTap != null) {
widget.onTap!(widget.recentSearchList![index]);
}
},
trailing: IconButton(
icon: const Icon(Icons.close, color: labelColor),
onPressed: () async {
setState(() {
widget.recentSearchList
?.remove(widget.recentSearchList?[index]);
});
final prefs = await SharedPreferences.getInstance();
prefs.setStringList(widget.prefKey, widget.recentSearchList!);
setState(() {});
},
),
);
},
);
}
}