mirror of
https://github.com/lemeow125/Borrowing-TrackerFrontend.git
synced 2024-11-17 06:19:27 +08:00
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:
parent
ad9981ae44
commit
60759d50a2
1 changed files with 18 additions and 7 deletions
|
@ -7,8 +7,13 @@ import {
|
||||||
TransactionsAPI,
|
TransactionsAPI,
|
||||||
} from "../../API/API";
|
} from "../../API/API";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
export default function TechnicianWidgets() {
|
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({
|
const queries = useQueries({
|
||||||
queries: [
|
queries: [
|
||||||
{
|
{
|
||||||
|
@ -230,7 +235,7 @@ export default function TechnicianWidgets() {
|
||||||
...{ float: "left", position: "absolute" },
|
...{ float: "left", position: "absolute" },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Transactions Today
|
Total Transactions Today
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p
|
<p
|
||||||
|
@ -240,8 +245,11 @@ export default function TechnicianWidgets() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{queries[3].data
|
{queries[3].data
|
||||||
? queries[3].data.filter(
|
? queries[3].data.filter((transaction) =>
|
||||||
(transactions) => transactions.timestamp == "Available"
|
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
|
||||||
|
todayStartOfDay,
|
||||||
|
todayEndOfDay
|
||||||
|
)
|
||||||
).length
|
).length
|
||||||
: 0}
|
: 0}
|
||||||
</p>
|
</p>
|
||||||
|
@ -265,7 +273,7 @@ export default function TechnicianWidgets() {
|
||||||
...{ float: "left", position: "absolute" },
|
...{ float: "left", position: "absolute" },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Broken Equipments
|
Total Transactions this Month
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p
|
<p
|
||||||
|
@ -274,9 +282,12 @@ export default function TechnicianWidgets() {
|
||||||
...styles.text_L,
|
...styles.text_L,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{queries[1].data
|
{queries[3].data
|
||||||
? queries[1].data.filter(
|
? queries[3].data.filter((transaction) =>
|
||||||
(equipment) => equipment.status == "Broken"
|
moment(transaction.timestamp, "MM-DD-YYYY hh:mm A").isBetween(
|
||||||
|
thisMonthStart,
|
||||||
|
thisMonthEnd
|
||||||
|
)
|
||||||
).length
|
).length
|
||||||
: 0}
|
: 0}
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue