From e589588d8ce016b36b5956b2af0d77a6a1e96c2e Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sun, 7 Jan 2024 12:28:06 +0800 Subject: [PATCH] Fix equipment tally page --- .../Technician/TechnicianWidgets.tsx | 6 +- .../EquipmentTallyPage/EquipmentTallyPage.tsx | 130 +++++++++--------- 2 files changed, 67 insertions(+), 69 deletions(-) diff --git a/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx b/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx index 188ea7d..65726b0 100644 --- a/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx +++ b/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx @@ -38,14 +38,16 @@ export default function TechnicianWidgets() { if (isLoading) { return ( <> - +

- Loading + Loading widgets...

); diff --git a/src/Pages/EquipmentTallyPage/EquipmentTallyPage.tsx b/src/Pages/EquipmentTallyPage/EquipmentTallyPage.tsx index 6e703ab..51101bc 100644 --- a/src/Pages/EquipmentTallyPage/EquipmentTallyPage.tsx +++ b/src/Pages/EquipmentTallyPage/EquipmentTallyPage.tsx @@ -65,79 +65,75 @@ export default function EquipmentTallyPage() { width: "100%", minHeight: "100%", minWidth: "100%", - flexWrap: "wrap", }} > -
-
+ + + theme.palette.getContrastText(theme.palette.background.paper), + }, + }} + value={filter} + onChange={(_event, newValue) => { + setFilter(newValue); + }} + freeSolo + id="custom-input-demo" + options={["Glassware", "Miscellaneous"]} + renderInput={(params) => ( +
+ +
+ )} + /> +

- - - theme.palette.getContrastText( - theme.palette.background.paper - ), - }, - }} - value={filter} - onChange={(_event, newValue) => { - setFilter(newValue); - }} - freeSolo - id="custom-input-demo" - options={["Glassware", "Miscellaneous"]} - renderInput={(params) => ( -

- -
- )} - /> -

- Results Found:{" "} - { - equipments?.data?.filter((equipment) => - filter !== null - ? // If filter is not null, we filter if it matches any criteria - equipment.name - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.category - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.last_updated - .toLowerCase() - .includes(filter?.toLowerCase()) || - equipment.category.toLowerCase() == filter.toLowerCase() - : // If filter keyword is null then we just pass through everything as if we did not filter at all - true - ).length - } -

-
+ Results Found:{" "} + { + equipment_instances?.data?.filter((equipment) => + filter !== null + ? // If filter is not null, we filter if it matches any criteria + equipment.equipment_name + .toLowerCase() + .includes(filter.toLowerCase()) || + equipment.category + .toLowerCase() + .includes(filter.toLowerCase()) || + equipment.last_updated + .toLowerCase() + .includes(filter?.toLowerCase()) || + equipment.status.toLowerCase() == filter.toLowerCase() + : // If filter keyword is null then we just pass through everything as if we did not filter at all + true + ).length + } +

+