Fix equipment tally page

This commit is contained in:
Keannu Bernasol 2024-01-07 12:28:06 +08:00
parent b5f4fc7326
commit e589588d8c
2 changed files with 67 additions and 69 deletions

View file

@ -38,14 +38,16 @@ export default function TechnicianWidgets() {
if (isLoading) { if (isLoading) {
return ( return (
<> <>
<CircularProgress style={{ height: "128px", width: "128px" }} /> <CircularProgress
style={{ marginTop: "8px", height: "128px", width: "128px" }}
/>
<p <p
style={{ style={{
...styles.text_dark, ...styles.text_dark,
...styles.text_L, ...styles.text_L,
}} }}
> >
Loading Loading widgets...
</p> </p>
</> </>
); );

View file

@ -65,10 +65,8 @@ export default function EquipmentTallyPage() {
width: "100%", width: "100%",
minHeight: "100%", minHeight: "100%",
minWidth: "100%", minWidth: "100%",
flexWrap: "wrap",
}} }}
> >
<div style={{ alignSelf: "flex-start", paddingLeft: "32px" }}>
<div <div
style={{ style={{
...styles.flex_row, ...styles.flex_row,
@ -91,9 +89,7 @@ export default function EquipmentTallyPage() {
width: "256x", width: "256x",
bgcolor: "background.paper", bgcolor: "background.paper",
color: (theme) => color: (theme) =>
theme.palette.getContrastText( theme.palette.getContrastText(theme.palette.background.paper),
theme.palette.background.paper
),
}, },
}} }}
value={filter} value={filter}
@ -118,10 +114,10 @@ export default function EquipmentTallyPage() {
> >
Results Found:{" "} Results Found:{" "}
{ {
equipments?.data?.filter((equipment) => equipment_instances?.data?.filter((equipment) =>
filter !== null filter !== null
? // If filter is not null, we filter if it matches any criteria ? // If filter is not null, we filter if it matches any criteria
equipment.name equipment.equipment_name
.toLowerCase() .toLowerCase()
.includes(filter.toLowerCase()) || .includes(filter.toLowerCase()) ||
equipment.category equipment.category
@ -130,14 +126,14 @@ export default function EquipmentTallyPage() {
equipment.last_updated equipment.last_updated
.toLowerCase() .toLowerCase()
.includes(filter?.toLowerCase()) || .includes(filter?.toLowerCase()) ||
equipment.category.toLowerCase() == 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 : // If filter keyword is null then we just pass through everything as if we did not filter at all
true true
).length ).length
} }
</p> </p>
</div> </div>
</div> <div style={{ alignSelf: "flex-start", paddingLeft: "32px" }}></div>
<TableContainer <TableContainer
style={{ width: "90%", overflowY: "scroll", marginTop: "2rem" }} style={{ width: "90%", overflowY: "scroll", marginTop: "2rem" }}
component={Paper} component={Paper}