Added consumables to transaction and improved transaction entry viewing and pdf generation. Also added transactions this day and this month in technician dashboard

This commit is contained in:
Keannu Bernasol 2024-01-05 19:06:11 +08:00
parent ad9981ae44
commit 60759d50a2

View file

@ -7,8 +7,13 @@ import {
TransactionsAPI,
} from "../../API/API";
import CircularProgress from "@mui/material/CircularProgress";
import moment from "moment";
export default function TechnicianWidgets() {
const todayStartOfDay = moment().startOf("day").format("MM-DD-YYYY hh:mm A");
const todayEndOfDay = moment().endOf("day").format("MM-DD-YYYY hh:mm A");
const thisMonthStart = moment().startOf("month").format("MM-DD-YYYY hh:mm A");
const thisMonthEnd = moment().endOf("month").format("MM-DD-YYYY hh:mm A");
const queries = useQueries({
queries: [
{
@ -230,7 +235,7 @@ export default function TechnicianWidgets() {
...{ float: "left", position: "absolute" },
}}
>
Transactions Today
Total Transactions Today
</p>
<p
@ -240,8 +245,11 @@ export default function TechnicianWidgets() {
}}
>
{queries[3].data
? queries[3].data.filter(
(transactions) => transactions.timestamp == "Available"
? queries[3].data.filter((transaction) =>
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
todayStartOfDay,
todayEndOfDay
)
).length
: 0}
</p>
@ -265,7 +273,7 @@ export default function TechnicianWidgets() {
...{ float: "left", position: "absolute" },
}}
>
Broken Equipments
Total Transactions this Month
</p>
<p
@ -274,9 +282,12 @@ export default function TechnicianWidgets() {
...styles.text_L,
}}
>
{queries[1].data
? queries[1].data.filter(
(equipment) => equipment.status == "Broken"
{queries[3].data
? queries[3].data.filter((transaction) =>
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
thisMonthStart,
thisMonthEnd
)
).length
: 0}
</p>