mirror of
https://github.com/lemeow125/Borrowing-TrackerFrontend.git
synced 2024-11-17 06:19:27 +08:00
Add number of search results found
This commit is contained in:
parent
28183b5424
commit
eea2b590d2
3 changed files with 59 additions and 1 deletions
|
@ -14,7 +14,7 @@ export default function TechnicianLogButtons() {
|
|||
...styles.text_L,
|
||||
}}
|
||||
>
|
||||
Logs
|
||||
Metrics
|
||||
</p>
|
||||
<div
|
||||
style={{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue