From 00f76c03413598171c5f8995d7b4f57adac18a37 Mon Sep 17 00:00:00 2001 From: tzw Date: Wed, 31 Jan 2024 11:16:05 +0630 Subject: [PATCH 1/5] update local popup button --- lib/pages/widgets/local_popup_menu_button.dart | 10 ++++++++-- lib/pages/widgets/local_popupmenu.dart | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/pages/widgets/local_popup_menu_button.dart b/lib/pages/widgets/local_popup_menu_button.dart index 44facd4..2c556af 100644 --- a/lib/pages/widgets/local_popup_menu_button.dart +++ b/lib/pages/widgets/local_popup_menu_button.dart @@ -102,8 +102,14 @@ class _LocalPopupMenuButtonState extends State { value: choice, child: Row( children: [ - LocalText(context, choice.textKey ?? "", - color: choice.enabled ? primaryColor : Colors.grey), + choice.text != null + ? Text(choice.text!, + style: TextStyle( + fontSize: 13, + color: + choice.enabled ? primaryColor : Colors.grey)) + : LocalText(context, choice.textKey ?? "", + color: choice.enabled ? primaryColor : Colors.grey), SizedBox( width: 10, ), diff --git a/lib/pages/widgets/local_popupmenu.dart b/lib/pages/widgets/local_popupmenu.dart index d5931b1..1df056a 100644 --- a/lib/pages/widgets/local_popupmenu.dart +++ b/lib/pages/widgets/local_popupmenu.dart @@ -1,12 +1,14 @@ class LocalPopupMenu { int id; String? textKey; + String? text; bool selected; bool highlight; bool enabled; LocalPopupMenu( {required this.id, this.textKey, + this.text, this.selected = false, this.highlight = false, this.enabled = true}); From 1dcc6413528edb610bd189e7f77ad0bf4d85eeca Mon Sep 17 00:00:00 2001 From: sma Date: Wed, 31 Jan 2024 16:20:59 +0630 Subject: [PATCH 2/5] add buttons in shipment info page --- assets/local/localization_en.json | 6 ++-- assets/local/localization_mu.json | 5 ++- lib/domain/constants.dart | 4 +++ lib/pages/fcs_shipment/fcs_shipment_info.dart | 36 +++++++++++++++++-- lib/pages/fcs_shipment/fcs_shipment_list.dart | 21 ++++++++--- .../widgets/local_popup_menu_button.dart | 10 +++--- 6 files changed, 66 insertions(+), 16 deletions(-) diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index da7bde5..fe04696 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -340,12 +340,12 @@ "FCSshipment.create":"Create new shipment", "FCSshipment.update":"Update shipment", "FCSshipment.ship.btn":"Ship this shipment", + "FCSshipment.process.btn":"Processed this shipment", + "FCSshipment.arrive.btn":"Arrived this shipment", + "FCSshipment.invoiced.btn":"Invoiced this shipment", "FCSshipment.ship.confirm":"Confirm ship?", "FCSshipment.cancel.btn":"Cancel this shipment", "FCSshipment.cancel.confirm":"Cancel this shipment?", - "FCSshipment.popupmenu.all":"All shipments", - "FCSshipment.popupmenu.active":"Active shipments", - "FCSshipment.popupmenu.shipped":"Shipped shipments", "FCSshipment.carton":"Cartons", "FCSshipment.package":"Packages", "FCS Shipment End ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index cd7111f..2371d47 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -338,7 +338,10 @@ "FCSshipment.cargo_manifest":"ကုန်ပစ္စည်းကိုဒေါင်းမည်", "FCSshipment.create":"တင်ပို့ခြင်းအသစ်ပြုလုပ်မည်", "FCSshipment.update":"တင်ပို့ခြင်းပြုပြင်မည်", - "FCSshipment.ship.btn":"Ship this shipment", + "FCSshipment.ship.btn":"ပို့ဆောင်နေသည်", + "FCSshipment.process.btn":"လုပ်ဆောင်နေသည်", + "FCSshipment.arrive.btn":"ရောက်ရှိသည်", + "FCSshipment.invoiced.btn":"ပြေစာယူသည်", "FCSshipment.ship.confirm":"Confirm ship?", "FCSshipment.cancel.btn":"Cancel this shipment", "FCSshipment.cancel.confirm":"Cancel this shipment?", diff --git a/lib/domain/constants.dart b/lib/domain/constants.dart index 05142e1..e962337 100644 --- a/lib/domain/constants.dart +++ b/lib/domain/constants.dart @@ -49,6 +49,10 @@ const message_type_shipment = "t_s"; // Fcs shipment status const fcs_shipment_confirmed_status = "confirmed"; const fcs_shipment_shipped_status = "shipped"; +const fcs_shipment_pending_status = "pending"; +const fcs_shipment_processing_status = "processing"; +const fcs_shipment_arrived_status = "arrived"; +const fcs_shipment_invoiced_status = "invoiced"; const fcs_shipment_delivered_status = "delivered"; // Package status diff --git a/lib/pages/fcs_shipment/fcs_shipment_info.dart b/lib/pages/fcs_shipment/fcs_shipment_info.dart index 356e3f5..9d14633 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_info.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_info.dart @@ -131,6 +131,27 @@ class _FcsShipmentInfoState extends State { callBack: _ship, ), ); + final processBtn = Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: LocalButton( + textKey: "FCSshipment.process.btn", + callBack: _ship, + ), + ); + final arriveBtn = Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: LocalButton( + textKey: "FCSshipment.arrive.btn", + callBack: _ship, + ), + ); + final invoiceBtn = Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: LocalButton( + textKey: "FCSshipment.invoice.btn", + callBack: _ship, + ), + ); final cancelBtn = Padding( padding: const EdgeInsets.symmetric(horizontal: 30), @@ -189,13 +210,22 @@ class _FcsShipmentInfoState extends State { portBox, destinationBox, const SizedBox(height: 30), - _fcsShipment?.status == fcs_shipment_confirmed_status - ? shipBtn + _fcsShipment?.status == fcs_shipment_pending_status + ? processBtn : Container(), - _fcsShipment?.status == fcs_shipment_confirmed_status + _fcsShipment?.status == fcs_shipment_pending_status ? Container( padding: EdgeInsets.only(top: 3), child: cancelBtn) : Container(), + _fcsShipment?.status == fcs_shipment_processing_status + ? shipBtn + : Container(), + _fcsShipment?.status == fcs_shipment_shipped_status + ? arriveBtn + : Container(), + _fcsShipment?.status == fcs_shipment_arrived_status + ? invoiceBtn + : Container(), SizedBox( height: 20, ) diff --git a/lib/pages/fcs_shipment/fcs_shipment_list.dart b/lib/pages/fcs_shipment/fcs_shipment_list.dart index 920553b..894083b 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_list.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_list.dart @@ -9,7 +9,6 @@ import 'package:fcs/pagination/paginator_listview.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - import '../../domain/entities/fcs_shipment.dart'; import 'fcs_shipment_editor.dart'; import 'fcs_shipment_list_row.dart'; @@ -46,16 +45,28 @@ class _FcsShipmentListState extends State { popmenus: [ LocalPopupMenu( id: 0, - textKey: "FCSshipment.popupmenu.all", + text: "All", selected: shipmentModel.selectedIndex == 0), LocalPopupMenu( id: 1, - textKey: "FCSshipment.popupmenu.active", + text: "Pending", selected: shipmentModel.selectedIndex == 1), LocalPopupMenu( id: 2, - textKey: "FCSshipment.popupmenu.shipped", - selected: shipmentModel.selectedIndex == 2) + text: "Processing", + selected: shipmentModel.selectedIndex == 2), + LocalPopupMenu( + id: 3, + text: "Shipped", + selected: shipmentModel.selectedIndex == 3), + LocalPopupMenu( + id: 4, + text: "Arrived", + selected: shipmentModel.selectedIndex == 4), + LocalPopupMenu( + id: 5, + text: "Invoiced", + selected: shipmentModel.selectedIndex == 5) ], popupMenuCallback: (p) { setState(() { diff --git a/lib/pages/widgets/local_popup_menu_button.dart b/lib/pages/widgets/local_popup_menu_button.dart index 2c556af..5c0eae1 100644 --- a/lib/pages/widgets/local_popup_menu_button.dart +++ b/lib/pages/widgets/local_popup_menu_button.dart @@ -71,15 +71,16 @@ class _LocalPopupMenuButtonState extends State { height: 30, decoration: new BoxDecoration( shape: BoxShape.circle, - color: Colors.white, + //color: Colors.white, ), child: Stack( fit: StackFit.expand, children: [ Icon( widget.buttonIcon ?? Icons.filter_list, - color: widget.buttonColor, + color: Colors.white, ), + hightlight ? Positioned( bottom: 0, @@ -89,7 +90,7 @@ class _LocalPopupMenuButtonState extends State { height: 10, decoration: new BoxDecoration( shape: BoxShape.circle, - color: secondaryColor, + color: secondaryColor, ), ), ) @@ -118,7 +119,8 @@ class _LocalPopupMenuButtonState extends State { Icons.check, color: Colors.grey, ) - : Container(), + : Container( + ), ], ), ); From 50f6c711a518a4bf72826eb58472c25375b4f87b Mon Sep 17 00:00:00 2001 From: sma Date: Wed, 31 Jan 2024 17:14:14 +0630 Subject: [PATCH 3/5] add status in info page of carton --- lib/pages/carton/carton_list.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/pages/carton/carton_list.dart b/lib/pages/carton/carton_list.dart index 1cf133d..226666c 100644 --- a/lib/pages/carton/carton_list.dart +++ b/lib/pages/carton/carton_list.dart @@ -46,11 +46,19 @@ class _CartonListState extends State { popmenus: [ LocalPopupMenu( id: 1, - textKey: "box.popupmenu.active", + text: "Processing", selected: boxModel.selectedIndex == 1), LocalPopupMenu( id: 2, - textKey: "box.popupmenu.delivered", + text: "Shipped", + selected: boxModel.selectedIndex == 2), + LocalPopupMenu( + id: 3, + text: "Arrived", + selected: boxModel.selectedIndex == 2), + LocalPopupMenu( + id: 4, + text: "Invoiced", selected: boxModel.selectedIndex == 2) ], popupMenuCallback: (p) { From a5924134499882e37d6f9fd4620669d3f1cce91a Mon Sep 17 00:00:00 2001 From: tzw Date: Wed, 31 Jan 2024 17:54:22 +0630 Subject: [PATCH 4/5] update shipment filter --- lib/domain/constants.dart | 1 + lib/domain/entities/fcs_shipment.dart | 1 - lib/pages/fcs_shipment/fcs_shipment_list.dart | 26 ++++++-------- .../model/fcs_shipment_model.dart | 34 +++++++++++++++++-- .../widgets/local_popup_menu_button.dart | 15 ++++---- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/lib/domain/constants.dart b/lib/domain/constants.dart index e962337..5173553 100644 --- a/lib/domain/constants.dart +++ b/lib/domain/constants.dart @@ -54,6 +54,7 @@ const fcs_shipment_processing_status = "processing"; const fcs_shipment_arrived_status = "arrived"; const fcs_shipment_invoiced_status = "invoiced"; const fcs_shipment_delivered_status = "delivered"; +const fcs_shipment_canceled_status = "canceled"; // Package status const package_received_status = "received"; diff --git a/lib/domain/entities/fcs_shipment.dart b/lib/domain/entities/fcs_shipment.dart index 4f015dd..933be02 100644 --- a/lib/domain/entities/fcs_shipment.dart +++ b/lib/domain/entities/fcs_shipment.dart @@ -59,7 +59,6 @@ class FcsShipment { 'cutoff_date': cutoffDate?.toUtc().toIso8601String(), 'shipment_type': shipType, 'arrival_date': arrivalDate?.toUtc().toIso8601String(), - 'departure_date': departureDate?.toUtc().toIso8601String(), 'consignee': consignee, 'port': port, 'destination': destination, diff --git a/lib/pages/fcs_shipment/fcs_shipment_list.dart b/lib/pages/fcs_shipment/fcs_shipment_list.dart index 894083b..d170022 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_list.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_list.dart @@ -44,29 +44,23 @@ class _FcsShipmentListState extends State { final popupMenu = LocalPopupMenuButton( popmenus: [ LocalPopupMenu( - id: 0, - text: "All", - selected: shipmentModel.selectedIndex == 0), + id: 0, text: "All", selected: shipmentModel.selectedIndex == 0), LocalPopupMenu( - id: 1, - text: "Pending", - selected: shipmentModel.selectedIndex == 1), + id: 1, text: "Pending", selected: shipmentModel.selectedIndex == 1), LocalPopupMenu( id: 2, text: "Processing", selected: shipmentModel.selectedIndex == 2), - LocalPopupMenu( - id: 3, - text: "Shipped", - selected: shipmentModel.selectedIndex == 3), - LocalPopupMenu( - id: 4, - text: "Arrived", - selected: shipmentModel.selectedIndex == 4), - LocalPopupMenu( + LocalPopupMenu( + id: 3, text: "Shipped", selected: shipmentModel.selectedIndex == 3), + LocalPopupMenu( + id: 4, text: "Arrived", selected: shipmentModel.selectedIndex == 4), + LocalPopupMenu( id: 5, text: "Invoiced", - selected: shipmentModel.selectedIndex == 5) + selected: shipmentModel.selectedIndex == 5), + LocalPopupMenu( + id: 6, text: "Canceled", selected: shipmentModel.selectedIndex == 6) ], popupMenuCallback: (p) { setState(() { diff --git a/lib/pages/fcs_shipment/model/fcs_shipment_model.dart b/lib/pages/fcs_shipment/model/fcs_shipment_model.dart index 26f501e..9d6a6d5 100644 --- a/lib/pages/fcs_shipment/model/fcs_shipment_model.dart +++ b/lib/pages/fcs_shipment/model/fcs_shipment_model.dart @@ -28,18 +28,48 @@ class FcsShipmentModel extends BaseModel { Query col = FirebaseFirestore.instance.collection(path); Query pageQuery = FirebaseFirestore.instance.collection(path); + // pending status if (index == 1) { - col = col.where("status", isEqualTo: fcs_shipment_confirmed_status); + col = col.where("status", isEqualTo: fcs_shipment_pending_status); pageQuery = - pageQuery.where("status", isEqualTo: fcs_shipment_confirmed_status); + pageQuery.where("status", isEqualTo: fcs_shipment_pending_status); } + // processing status if (index == 2) { + col = col.where("status", isEqualTo: fcs_shipment_processing_status); + pageQuery = + pageQuery.where("status", isEqualTo: fcs_shipment_processing_status); + } + + // shipped status + if (index == 3) { col = col.where("status", isEqualTo: fcs_shipment_shipped_status); pageQuery = pageQuery.where("status", isEqualTo: fcs_shipment_shipped_status); } + // arrived status + if (index == 4) { + col = col.where("status", isEqualTo: fcs_shipment_arrived_status); + pageQuery = + pageQuery.where("status", isEqualTo: fcs_shipment_arrived_status); + } + + // invoiced status + if (index == 5) { + col = col.where("status", isEqualTo: fcs_shipment_invoiced_status); + pageQuery = + pageQuery.where("status", isEqualTo: fcs_shipment_invoiced_status); + } + + // canceled status + if (index == 6) { + col = col.where("status", isEqualTo: fcs_shipment_canceled_status); + pageQuery = + pageQuery.where("status", isEqualTo: fcs_shipment_canceled_status); + } + pageQuery = pageQuery.orderBy("shipment_number", descending: true); fcsShipments?.close(); diff --git a/lib/pages/widgets/local_popup_menu_button.dart b/lib/pages/widgets/local_popup_menu_button.dart index 5c0eae1..1493eda 100644 --- a/lib/pages/widgets/local_popup_menu_button.dart +++ b/lib/pages/widgets/local_popup_menu_button.dart @@ -74,23 +74,22 @@ class _LocalPopupMenuButtonState extends State { //color: Colors.white, ), child: Stack( - fit: StackFit.expand, + alignment: Alignment.center, children: [ Icon( widget.buttonIcon ?? Icons.filter_list, color: Colors.white, ), - hightlight ? Positioned( - bottom: 0, + bottom: 15, right: 0, child: Container( width: 10, height: 10, decoration: new BoxDecoration( shape: BoxShape.circle, - color: secondaryColor, + color: secondaryColor, ), ), ) @@ -106,11 +105,12 @@ class _LocalPopupMenuButtonState extends State { choice.text != null ? Text(choice.text!, style: TextStyle( - fontSize: 13, + fontSize: 14, color: choice.enabled ? primaryColor : Colors.grey)) : LocalText(context, choice.textKey ?? "", - color: choice.enabled ? primaryColor : Colors.grey), + color: choice.enabled ? primaryColor : Colors.grey, + fontSize: 14), SizedBox( width: 10, ), @@ -119,8 +119,7 @@ class _LocalPopupMenuButtonState extends State { Icons.check, color: Colors.grey, ) - : Container( - ), + : Container(), ], ), ); From 46a70df415333ebc4895bf2e71a1c6c152039a30 Mon Sep 17 00:00:00 2001 From: tzw Date: Wed, 31 Jan 2024 18:01:54 +0630 Subject: [PATCH 5/5] merge --- lib/domain/constants.dart | 9 ++++++--- lib/pages/carton/carton_list.dart | 12 ++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/domain/constants.dart b/lib/domain/constants.dart index 5173553..a9ab54e 100644 --- a/lib/domain/constants.dart +++ b/lib/domain/constants.dart @@ -20,7 +20,6 @@ const cartons_collection = "cartons"; const discounts_collection = "discounts"; const pickup_collection = "pickups"; - // docs const setting_doc_id = "setting"; const rate_doc_id = "rate"; @@ -78,8 +77,8 @@ const privilege_invoice = "inv"; const privilege_processing = "pr"; const privilege_receiving = "rc"; const privilege_pickup = "pku"; -const privilege_collect ="col"; -const privilege_report ="rpt"; +const privilege_collect = "col"; +const privilege_report = "rpt"; // Pickup types const shipment_local_pickup = "Local pickup"; @@ -103,6 +102,10 @@ const mix_pickup = "Mix Pickup"; const carton_packed_status = "packed"; const carton_shipped_status = "shipped"; const carton_delivered_status = "delivered"; +const carton_processing_status = "processing"; +const carton_arrived_status = "arrived"; +const carton_invoiced_status = "invoiced"; +const carton_canceled_status = "canceled"; // shipment status const shipment_pending_status = "pending"; diff --git a/lib/pages/carton/carton_list.dart b/lib/pages/carton/carton_list.dart index 226666c..1cf133d 100644 --- a/lib/pages/carton/carton_list.dart +++ b/lib/pages/carton/carton_list.dart @@ -46,19 +46,11 @@ class _CartonListState extends State { popmenus: [ LocalPopupMenu( id: 1, - text: "Processing", + textKey: "box.popupmenu.active", selected: boxModel.selectedIndex == 1), LocalPopupMenu( id: 2, - text: "Shipped", - selected: boxModel.selectedIndex == 2), - LocalPopupMenu( - id: 3, - text: "Arrived", - selected: boxModel.selectedIndex == 2), - LocalPopupMenu( - id: 4, - text: "Invoiced", + textKey: "box.popupmenu.delivered", selected: boxModel.selectedIndex == 2) ], popupMenuCallback: (p) {