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,
|
||||
} 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>
|
||||
|
|
Loading…
Reference in a new issue