update shipment filter
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -44,29 +44,23 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
|
||||
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(() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -74,23 +74,22 @@ class _LocalPopupMenuButtonState extends State<LocalPopupMenuButton> {
|
||||
//color: Colors.white,
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
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<LocalPopupMenuButton> {
|
||||
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<LocalPopupMenuButton> {
|
||||
Icons.check,
|
||||
color: Colors.grey,
|
||||
)
|
||||
: Container(
|
||||
),
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user