From eea2b590d2754d29d1eae50edc4f2a22e1702b16 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Fri, 5 Jan 2024 14:12:05 +0800 Subject: [PATCH] Add number of search results found --- .../Technician/TechnicianLogButtons.tsx | 2 +- .../EquipmentInstancesListPage.tsx | 27 ++++++++++++++++ .../TransactionsListPage.tsx | 31 +++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/Components/DashboardPage/Technician/TechnicianLogButtons.tsx b/src/Components/DashboardPage/Technician/TechnicianLogButtons.tsx index 22a3b5e..2b7d4cf 100644 --- a/src/Components/DashboardPage/Technician/TechnicianLogButtons.tsx +++ b/src/Components/DashboardPage/Technician/TechnicianLogButtons.tsx @@ -14,7 +14,7 @@ export default function TechnicianLogButtons() { ...styles.text_L, }} > - Logs + Metrics

)} /> +

+ 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 + } +

)} /> +

+ Results Found:{" "} + { + transactions?.data?.filter((transaction) => + filter !== null + ? // If filter is not null, we filter if it matches any criteria + transaction.borrower.name + .toLowerCase() + .includes(filter.toLowerCase()) || + transaction.teacher.name + .toLowerCase() + .includes(filter.toLowerCase()) || + transaction.remarks + .toLowerCase() + .includes(filter?.toLowerCase()) || + transaction.transaction_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 + } +

@@ -261,6 +289,9 @@ export default function TransactionsListPage() { {transaction.remarks} +

+ Involved Items: {transaction.equipments.length} +