Optimized code for technician widget and changed widget to pending equipments

This commit is contained in:
Keannu Bernasol 2024-01-05 20:43:16 +08:00
parent 4cd5712f6f
commit 928782d80d

View file

@ -81,7 +81,7 @@ export default function TechnicianWidgets() {
...{ float: "left", position: "absolute" },
}}
>
SKUs in Inventory
Pending Equipments
</p>
<p
@ -90,7 +90,9 @@ export default function TechnicianWidgets() {
...styles.text_L,
}}
>
{queries[0].data ? queries[0].data.length : 0}
{queries[1].data?.filter(
(equipment) => equipment.status == "Pending"
).length || 0}
</p>
</div>
<div
@ -121,7 +123,7 @@ export default function TechnicianWidgets() {
...styles.text_L,
}}
>
{queries[1].data ? queries[1].data.length : 0}
{queries[1].data?.length || 0}
</p>
</div>
</div>
@ -163,11 +165,9 @@ export default function TechnicianWidgets() {
...styles.text_L,
}}
>
{queries[1].data
? queries[1].data.filter(
(equipment) => equipment.status == "Available"
).length
: 0}
{queries[1].data?.filter(
(equipment) => equipment.status == "Available"
).length || 0}
</p>
</div>
<div
@ -198,11 +198,9 @@ export default function TechnicianWidgets() {
...styles.text_L,
}}
>
{queries[1].data
? queries[1].data.filter(
(equipment) => equipment.status == "Broken"
).length
: 0}
{queries[1].data?.filter(
(equipment) => equipment.status == "Broken"
).length || 0}
</p>
</div>
</div>
@ -244,14 +242,12 @@ export default function TechnicianWidgets() {
...styles.text_L,
}}
>
{queries[3].data
? queries[3].data.filter((transaction) =>
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
todayStartOfDay,
todayEndOfDay
)
).length
: 0}
{queries[3].data?.filter((transaction) =>
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
todayStartOfDay,
todayEndOfDay
)
).length || 0}
</p>
</div>
<div
@ -282,14 +278,12 @@ export default function TechnicianWidgets() {
...styles.text_L,
}}
>
{queries[3].data
? queries[3].data.filter((transaction) =>
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
thisMonthStart,
thisMonthEnd
)
).length
: 0}
{queries[3].data?.filter((transaction) =>
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
thisMonthStart,
thisMonthEnd
)
).length || 0}
</p>
</div>
</div>