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_arrived_status = "arrived";
|
||||||
const fcs_shipment_invoiced_status = "invoiced";
|
const fcs_shipment_invoiced_status = "invoiced";
|
||||||
const fcs_shipment_delivered_status = "delivered";
|
const fcs_shipment_delivered_status = "delivered";
|
||||||
|
const fcs_shipment_canceled_status = "canceled";
|
||||||
|
|
||||||
// Package status
|
// Package status
|
||||||
const package_received_status = "received";
|
const package_received_status = "received";
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class FcsShipment {
|
|||||||
'cutoff_date': cutoffDate?.toUtc().toIso8601String(),
|
'cutoff_date': cutoffDate?.toUtc().toIso8601String(),
|
||||||
'shipment_type': shipType,
|
'shipment_type': shipType,
|
||||||
'arrival_date': arrivalDate?.toUtc().toIso8601String(),
|
'arrival_date': arrivalDate?.toUtc().toIso8601String(),
|
||||||
'departure_date': departureDate?.toUtc().toIso8601String(),
|
|
||||||
'consignee': consignee,
|
'consignee': consignee,
|
||||||
'port': port,
|
'port': port,
|
||||||
'destination': destination,
|
'destination': destination,
|
||||||
|
|||||||
@@ -44,29 +44,23 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
|
|||||||
final popupMenu = LocalPopupMenuButton(
|
final popupMenu = LocalPopupMenuButton(
|
||||||
popmenus: [
|
popmenus: [
|
||||||
LocalPopupMenu(
|
LocalPopupMenu(
|
||||||
id: 0,
|
id: 0, text: "All", selected: shipmentModel.selectedIndex == 0),
|
||||||
text: "All",
|
|
||||||
selected: shipmentModel.selectedIndex == 0),
|
|
||||||
LocalPopupMenu(
|
LocalPopupMenu(
|
||||||
id: 1,
|
id: 1, text: "Pending", selected: shipmentModel.selectedIndex == 1),
|
||||||
text: "Pending",
|
|
||||||
selected: shipmentModel.selectedIndex == 1),
|
|
||||||
LocalPopupMenu(
|
LocalPopupMenu(
|
||||||
id: 2,
|
id: 2,
|
||||||
text: "Processing",
|
text: "Processing",
|
||||||
selected: shipmentModel.selectedIndex == 2),
|
selected: shipmentModel.selectedIndex == 2),
|
||||||
LocalPopupMenu(
|
LocalPopupMenu(
|
||||||
id: 3,
|
id: 3, text: "Shipped", selected: shipmentModel.selectedIndex == 3),
|
||||||
text: "Shipped",
|
LocalPopupMenu(
|
||||||
selected: shipmentModel.selectedIndex == 3),
|
id: 4, text: "Arrived", selected: shipmentModel.selectedIndex == 4),
|
||||||
LocalPopupMenu(
|
LocalPopupMenu(
|
||||||
id: 4,
|
|
||||||
text: "Arrived",
|
|
||||||
selected: shipmentModel.selectedIndex == 4),
|
|
||||||
LocalPopupMenu(
|
|
||||||
id: 5,
|
id: 5,
|
||||||
text: "Invoiced",
|
text: "Invoiced",
|
||||||
selected: shipmentModel.selectedIndex == 5)
|
selected: shipmentModel.selectedIndex == 5),
|
||||||
|
LocalPopupMenu(
|
||||||
|
id: 6, text: "Canceled", selected: shipmentModel.selectedIndex == 6)
|
||||||
],
|
],
|
||||||
popupMenuCallback: (p) {
|
popupMenuCallback: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@@ -28,18 +28,48 @@ class FcsShipmentModel extends BaseModel {
|
|||||||
Query col = FirebaseFirestore.instance.collection(path);
|
Query col = FirebaseFirestore.instance.collection(path);
|
||||||
Query pageQuery = FirebaseFirestore.instance.collection(path);
|
Query pageQuery = FirebaseFirestore.instance.collection(path);
|
||||||
|
|
||||||
|
// pending status
|
||||||
if (index == 1) {
|
if (index == 1) {
|
||||||
col = col.where("status", isEqualTo: fcs_shipment_confirmed_status);
|
col = col.where("status", isEqualTo: fcs_shipment_pending_status);
|
||||||
pageQuery =
|
pageQuery =
|
||||||
pageQuery.where("status", isEqualTo: fcs_shipment_confirmed_status);
|
pageQuery.where("status", isEqualTo: fcs_shipment_pending_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// processing status
|
||||||
if (index == 2) {
|
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);
|
col = col.where("status", isEqualTo: fcs_shipment_shipped_status);
|
||||||
pageQuery =
|
pageQuery =
|
||||||
pageQuery.where("status", isEqualTo: fcs_shipment_shipped_status);
|
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);
|
pageQuery = pageQuery.orderBy("shipment_number", descending: true);
|
||||||
|
|
||||||
fcsShipments?.close();
|
fcsShipments?.close();
|
||||||
|
|||||||
@@ -74,23 +74,22 @@ class _LocalPopupMenuButtonState extends State<LocalPopupMenuButton> {
|
|||||||
//color: Colors.white,
|
//color: Colors.white,
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
alignment: Alignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(
|
Icon(
|
||||||
widget.buttonIcon ?? Icons.filter_list,
|
widget.buttonIcon ?? Icons.filter_list,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
|
|
||||||
hightlight
|
hightlight
|
||||||
? Positioned(
|
? Positioned(
|
||||||
bottom: 0,
|
bottom: 15,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 10,
|
width: 10,
|
||||||
height: 10,
|
height: 10,
|
||||||
decoration: new BoxDecoration(
|
decoration: new BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: secondaryColor,
|
color: secondaryColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -106,11 +105,12 @@ class _LocalPopupMenuButtonState extends State<LocalPopupMenuButton> {
|
|||||||
choice.text != null
|
choice.text != null
|
||||||
? Text(choice.text!,
|
? Text(choice.text!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 14,
|
||||||
color:
|
color:
|
||||||
choice.enabled ? primaryColor : Colors.grey))
|
choice.enabled ? primaryColor : Colors.grey))
|
||||||
: LocalText(context, choice.textKey ?? "",
|
: LocalText(context, choice.textKey ?? "",
|
||||||
color: choice.enabled ? primaryColor : Colors.grey),
|
color: choice.enabled ? primaryColor : Colors.grey,
|
||||||
|
fontSize: 14),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
@@ -119,8 +119,7 @@ class _LocalPopupMenuButtonState extends State<LocalPopupMenuButton> {
|
|||||||
Icons.check,
|
Icons.check,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
)
|
)
|
||||||
: Container(
|
: Container(),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user