From ccf8262291109dce8eb09b89d9ee841af6391132 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Tue, 5 Dec 2023 22:06:01 +0800 Subject: [PATCH] Remove groups and added list filtering pages --- src/App.tsx | 11 ++ src/Components/API/API.tsx | 2 +- src/Pages/DashboardPage/DashboardPage.tsx | 12 ++ .../EquipmentInstancesFilteredListPage.tsx | 154 ++++++++++++++++++ 4 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 src/Pages/EquipmentInstancesListPage/EquipmentInstancesFilteredListPage.tsx diff --git a/src/App.tsx b/src/App.tsx index 013db34..e5c926d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -15,6 +15,7 @@ import EquipmentInstancesListPage from "./Pages/EquipmentInstancesListPage/Equip import EquipmentListPage from "./Pages/EquipmentListPage/EquipmentListPage"; import EquipmentLogsPage from "./Pages/EquipmentLogsPage/EquipmentLogsPage"; import EquipmentInstanceLogsPage from "./Pages/EquipmentInstanceLogsPage/EquipmentInstanceLogsPage"; +import EquipmentInstancesFilteredListPage from "./Pages/EquipmentInstancesListPage/EquipmentInstancesFilteredListPage"; const queryClient = new QueryClient(); const router = createHashRouter([ @@ -48,6 +49,16 @@ const router = createHashRouter([ ), errorElement: , }, + { + path: "/view/equipment_instances/filter/:filter_by", + element: ( + <> + + + + ), + errorElement: , + }, { path: "/view/equipment_instances/logs", element: ( diff --git a/src/Components/API/API.tsx b/src/Components/API/API.tsx index d410b8e..437eb24 100644 --- a/src/Components/API/API.tsx +++ b/src/Components/API/API.tsx @@ -17,7 +17,7 @@ import { EquipmentInstanceLogListType, } from "../Types/Types"; -const debug = false; +const debug = true; let backendURL; if (debug) { diff --git a/src/Pages/DashboardPage/DashboardPage.tsx b/src/Pages/DashboardPage/DashboardPage.tsx index 92cf0f1..9d1d0e1 100644 --- a/src/Pages/DashboardPage/DashboardPage.tsx +++ b/src/Pages/DashboardPage/DashboardPage.tsx @@ -396,6 +396,9 @@ export default function Dashboard() { marginLeft: "1rem", marginRight: "1rem", }} + onClick={() => { + navigate("/view/equipment_instances/filter/PC"); + }} />

{ + navigate("/view/equipment_instances/filter/NETWORKING"); + }} />

{ + navigate("/view/equipment_instances/filter/CCTV"); + }} > { + navigate("/view/equipment_instances/filter/FURNITURE"); + }} />

+

+
+ +

+ Loading +

+
+ + ); + } + return ( +
+
+
+
+ + + + + ID + + Name + + + Status + + + Category + + + Last Modified + + + + + {equipment_instances.data ? ( + equipment_instances.data + .filter((equipment) => equipment.category === filter_by) + .map((equipment) => ( + { + SetSelectedItem(equipment.id); + SetEditModalOpen(true); + }} + > + + {equipment.id} + + + {equipment.equipment_name} + + + + {equipment.status} + + + {equipment.category} + + +
+
{equipment.last_updated}
+
+ {equipment.last_updated_by + ? "by " + equipment.last_updated_by + : ""} +
+
+
+
+ )) + ) : ( + <> + )} +
+
+
+
+
+ SetEditModalOpen(false)} + modal + position={"top center"} + contentStyle={styles.popup_center} + > + + +
+ ); +}