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