Add number of search results found

This commit is contained in:
Keannu Bernasol 2024-01-05 14:12:05 +08:00
parent 28183b5424
commit eea2b590d2
3 changed files with 59 additions and 1 deletions

View file

@ -14,7 +14,7 @@ export default function TechnicianLogButtons() {
...styles.text_L,
}}
>
Logs
Metrics
</p>
<div
style={{

View file

@ -109,6 +109,33 @@ export default function EquipmentInstancesListPage() {
</div>
)}
/>
<p
style={{
...styles.text_M,
...styles.text_dark,
...{ marginLeft: "4px" },
}}
>
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
}
</p>
</div>
</div>
<TableContainer

View file

@ -125,6 +125,34 @@ export default function TransactionsListPage() {
</div>
)}
/>
<p
style={{
...styles.text_M,
...styles.text_dark,
...{ marginLeft: "4px" },
}}
>
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
}
</p>
</div>
<Table sx={{ marginTop: "8px", minWidth: "32rem" }} size="medium">
<TableHead>
@ -261,6 +289,9 @@ export default function TransactionsListPage() {
{transaction.remarks}
</TableCell>
<TableCell align="center">
<p style={{ ...styles.text_M, ...styles.text_dark }}>
Involved Items: {transaction.equipments.length}
</p>
<TableContainer
style={{
maxHeight: "256px",