mirror of
https://github.com/lemeow125/Borrowing-TrackerFrontend.git
synced 2024-11-17 06:19:27 +08:00
bonggang bonggang configuration T_T. p78a45k122y12u1245p56r4a446i41n1
This commit is contained in:
parent
fa89268e0a
commit
209219afb4
10 changed files with 439 additions and 213 deletions
12
src/App.tsx
12
src/App.tsx
|
@ -22,6 +22,7 @@ import AddTransactionPage from "./Pages/AddTransactionPage/AddTransactionPage";
|
|||
import TransactionPage from "./Pages/TransactionPage/TransactionPage";
|
||||
import EquipmentInstanceTallyPage from "./Pages/EquipmentTallyPage/EquipmentTallyPage";
|
||||
import TransactionReportPage from "./Pages/TransactionReportPage/TransactionReportPage";
|
||||
import ManageEquipmentPage from "./Pages/ManageEquipmentPage/ManageEquipmentPage";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
const router = createHashRouter([
|
||||
|
@ -67,6 +68,17 @@ const router = createHashRouter([
|
|||
),
|
||||
errorElement: <ErrorPage />,
|
||||
},
|
||||
{
|
||||
path: "/view/ManageEquipment",
|
||||
element: (
|
||||
<>
|
||||
<Revalidator />
|
||||
<RestrictedPage allow_only="Technician" />
|
||||
<ManageEquipmentPage />
|
||||
</>
|
||||
),
|
||||
errorElement: <ErrorPage />,
|
||||
},
|
||||
{
|
||||
path: "/view/equipment_instances/filter/:filter_by",
|
||||
element: (
|
||||
|
|
|
@ -16,18 +16,19 @@ export default function TechnicianNavigation() {
|
|||
alignItems: "center",
|
||||
gap: "24px",
|
||||
alignSelf: "stretch",
|
||||
paddingBottom: "5rem"
|
||||
}}
|
||||
>
|
||||
|
||||
<div style={{
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: "24px",
|
||||
width: "100%",
|
||||
maxWidth: "800px"
|
||||
}}>
|
||||
|
||||
maxWidth: "800px",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
overflow: "hidden",
|
||||
|
@ -39,7 +40,7 @@ export default function TechnicianNavigation() {
|
|||
maxWidth: "807px",
|
||||
flex: 1,
|
||||
textAlign: "left",
|
||||
marginLeft: "1rem"
|
||||
marginLeft: "1rem",
|
||||
}}
|
||||
>
|
||||
Feature
|
||||
|
@ -80,7 +81,7 @@ export default function TechnicianNavigation() {
|
|||
background: "#E8D3BB",
|
||||
}}
|
||||
onClick={() => {
|
||||
navigate("/dashboard");
|
||||
navigate("/view/ManageEquipment");
|
||||
}}
|
||||
>
|
||||
<img src={equipment} alt="Manage Equipment" />
|
||||
|
|
|
@ -47,173 +47,69 @@ export default function TechnicianWidgets() {
|
|||
>
|
||||
<div
|
||||
style={{
|
||||
paddingLeft: "16px",
|
||||
paddingRight: "16px",
|
||||
margin: "16px",
|
||||
borderRadius: 16,
|
||||
backgroundColor: "#a6a6a6",
|
||||
alignSelf: "center",
|
||||
justifyContent: "center",
|
||||
width: "16rem",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: "24px",
|
||||
width: "100%",
|
||||
maxWidth: "800px",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_M,
|
||||
...{ float: "left", position: "absolute" },
|
||||
overflow: "hidden",
|
||||
color: "#0E410D",
|
||||
fontSize: "24px",
|
||||
fontWeight: 700,
|
||||
display: "-webkit-box",
|
||||
width: "100%",
|
||||
maxWidth: "807px",
|
||||
flex: 1,
|
||||
textAlign: "left",
|
||||
marginLeft: "1rem",
|
||||
marginBottom: -15,
|
||||
}}
|
||||
>
|
||||
Pending Equipments
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.filter(
|
||||
(equipment) => equipment.status == "Pending"
|
||||
).length || "Loading..."}
|
||||
Summary
|
||||
</p>
|
||||
</div>
|
||||
{/* Blue Capsule */}
|
||||
<div
|
||||
className="capsule"
|
||||
style={{
|
||||
paddingLeft: "16px",
|
||||
paddingRight: "16px",
|
||||
margin: "16px",
|
||||
borderRadius: 16,
|
||||
backgroundColor: "#a6a6a6",
|
||||
alignSelf: "center",
|
||||
justifyContent: "center",
|
||||
width: "16rem",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_M,
|
||||
...{ float: "left", position: "absolute" },
|
||||
}}
|
||||
>
|
||||
Equipments in Inventory
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.length || "Loading..."}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
...styles.flex_row,
|
||||
...{
|
||||
alignSelf: "center",
|
||||
justifyContent: "center",
|
||||
flexWrap: "wrap",
|
||||
},
|
||||
background: "#DDEDF3",
|
||||
margin: 30,
|
||||
paddingTop: 50,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
paddingLeft: "16px",
|
||||
paddingRight: "16px",
|
||||
margin: "16px",
|
||||
borderRadius: 16,
|
||||
backgroundColor: "#a6a6a6",
|
||||
alignSelf: "center",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
width: "16rem",
|
||||
alignItems: "center",
|
||||
gap: "15px",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_M,
|
||||
...{ float: "left", position: "absolute" },
|
||||
}}
|
||||
>
|
||||
Available Equipments
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.filter(
|
||||
(equipment) => equipment.status == "Available"
|
||||
).length || "Loading..."}
|
||||
</p>
|
||||
</div>
|
||||
{/* Transactions all */}
|
||||
<div
|
||||
style={{
|
||||
paddingLeft: "16px",
|
||||
paddingRight: "16px",
|
||||
margin: "16px",
|
||||
borderRadius: 16,
|
||||
backgroundColor: "#a6a6a6",
|
||||
alignSelf: "center",
|
||||
justifyContent: "center",
|
||||
width: "16rem",
|
||||
display: "flex",
|
||||
width: "202px",
|
||||
height: "245px",
|
||||
padding: "25px 10px",
|
||||
flexDirection: "column",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
borderRadius: "15px",
|
||||
background: "#FFF",
|
||||
boxShadow: "0px 4px 4px 0px rgba(0, 0, 0, 0.25)",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_M,
|
||||
...{ float: "left", position: "absolute" },
|
||||
}}
|
||||
>
|
||||
Broken Equipments
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.filter(
|
||||
(equipment) => equipment.status == "Broken"
|
||||
).length || "Loading..."}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
...styles.flex_row,
|
||||
...{
|
||||
alignSelf: "center",
|
||||
justifyContent: "center",
|
||||
flexWrap: "wrap",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
paddingLeft: "16px",
|
||||
paddingRight: "16px",
|
||||
margin: "16px",
|
||||
borderRadius: 16,
|
||||
backgroundColor: "#a6a6a6",
|
||||
alignSelf: "center",
|
||||
justifyContent: "center",
|
||||
width: "16rem",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_M,
|
||||
...{ float: "left", position: "absolute" },
|
||||
...styles.text_normal,
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
Total Transactions Today
|
||||
|
@ -223,6 +119,7 @@ export default function TechnicianWidgets() {
|
|||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{queries[3].data?.filter((transaction) =>
|
||||
|
@ -230,26 +127,13 @@ export default function TechnicianWidgets() {
|
|||
todayStartOfDay,
|
||||
todayEndOfDay
|
||||
)
|
||||
).length || "Loading..."}
|
||||
).length || "0"}
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
paddingLeft: "16px",
|
||||
paddingRight: "16px",
|
||||
margin: "16px",
|
||||
borderRadius: 16,
|
||||
backgroundColor: "#a6a6a6",
|
||||
alignSelf: "center",
|
||||
justifyContent: "center",
|
||||
width: "16rem",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_M,
|
||||
...{ float: "left", position: "absolute" },
|
||||
...styles.text_normal,
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
Total Transactions this Month
|
||||
|
@ -259,6 +143,7 @@ export default function TechnicianWidgets() {
|
|||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{queries[3].data?.filter((transaction) =>
|
||||
|
@ -269,6 +154,299 @@ export default function TechnicianWidgets() {
|
|||
).length || "Loading..."}
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "40%",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: "15px",
|
||||
alignSelf: "stretch",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
height: "88px",
|
||||
width: "100%",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
alignSelf: "stretch",
|
||||
borderRadius: "15px",
|
||||
background: "#FFF",
|
||||
boxShadow: "0px 4px 4px 0px rgba(0, 0, 0, 0.25)",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: "0",
|
||||
}}
|
||||
>
|
||||
{queries[3].data?.filter(
|
||||
(transaction) =>
|
||||
transaction.transaction_status == "Approved"
|
||||
).length || 0}
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_S,
|
||||
margin: "0",
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
Pending Request
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
height: "88px",
|
||||
width: "100%",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
alignSelf: "stretch",
|
||||
borderRadius: "15px",
|
||||
background: "#FFF",
|
||||
boxShadow: "0px 4px 4px 0px rgba(0, 0, 0, 0.25)",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: "0",
|
||||
}}
|
||||
>
|
||||
{queries[3].data?.filter(
|
||||
(transaction) =>
|
||||
transaction.transaction_status == "Borrowed"
|
||||
).length || 0}
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_S,
|
||||
margin: "0",
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
On Borrow
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
height: "88px",
|
||||
width: "100%",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
alignSelf: "stretch",
|
||||
borderRadius: "15px",
|
||||
background: "#FFF",
|
||||
boxShadow: "0px 4px 4px 0px rgba(0, 0, 0, 0.25)",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: "0",
|
||||
}}
|
||||
>
|
||||
{queries[3].data?.filter(
|
||||
(transaction) =>
|
||||
transaction.transaction_status == "Finalized"
|
||||
).length || 0}
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_S,
|
||||
margin: "0",
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
Success
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p
|
||||
style={{
|
||||
margin: "0",
|
||||
fontWeight: 700,
|
||||
...styles.text_normal,
|
||||
}}
|
||||
>
|
||||
Borrowing Transaction
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Yellow Capsule */}
|
||||
<div
|
||||
className="capsule"
|
||||
style={{
|
||||
background: "#FCF2E7",
|
||||
paddingTop: 50,
|
||||
margin: 30,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: "15px",
|
||||
}}
|
||||
>
|
||||
{/* Pending Req */}
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "202px",
|
||||
height: "193px",
|
||||
padding: "25px 10px",
|
||||
flexDirection: "column",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
borderRadius: "15px",
|
||||
background: "#FFF",
|
||||
boxShadow: "0px 4px 4px 0px rgba(0, 0, 0, 0.25)",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.length || "Loading..."}
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_M,
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
Total Equipment
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "40%",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: "15px",
|
||||
alignSelf: "stretch",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
alignSelf: "stretch",
|
||||
borderRadius: "15px",
|
||||
background: "#FFF",
|
||||
boxShadow: "0px 4px 4px 0px rgba(0, 0, 0, 0.25)",
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_S,
|
||||
margin: "0",
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
Available
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.filter(
|
||||
(equipment) => equipment.status == "Available"
|
||||
).length || "Loading..."}
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_S,
|
||||
margin: "0",
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
Pending
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.filter(
|
||||
(equipment) => equipment.status == "Pending"
|
||||
).length || 0}
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_S,
|
||||
margin: "0",
|
||||
fontWeight: "400",
|
||||
color: "#a44141",
|
||||
}}
|
||||
>
|
||||
Broken
|
||||
</p>
|
||||
|
||||
<p
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...styles.text_L,
|
||||
margin: "0",
|
||||
color: "#a44141",
|
||||
}}
|
||||
>
|
||||
{queries[1].data?.filter(
|
||||
(equipment) => equipment.status == "Broken"
|
||||
).length || 0}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p
|
||||
style={{
|
||||
margin: "0",
|
||||
fontWeight: 700,
|
||||
...styles.text_normal,
|
||||
}}
|
||||
>
|
||||
Equipment Tracking
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { useState } from "react";
|
||||
import styles, { colors } from "../../styles";
|
||||
import styles from "../../styles";
|
||||
import MenuIcon from "@mui/icons-material/Menu";
|
||||
import SidebarModal from "../Drawer/Drawer";
|
||||
import { Drawer } from "@mui/material";
|
||||
|
|
|
@ -2,8 +2,6 @@ import Header from "../../Components/Header/Header";
|
|||
import styles from "../../styles";
|
||||
import RestrictedComponent from "../../Components/RestrictedComponent/RestrictedComponent";
|
||||
import TechnicianWidgets from "../../Components/DashboardPage/Technician/TechnicianWidgets";
|
||||
import TechnicianEquipmentButtons from "../../Components/DashboardPage/Technician/TechnicianEquipmentButtons";
|
||||
import TechnicianLogButtons from "../../Components/DashboardPage/Technician/TechnicianLogButtons";
|
||||
import StudentTransactionListView from "../../Components/DashboardPage/Student/StudentTransactionListView";
|
||||
import StudentDashboard from "../../Components/DashboardPage/Student/StudentDashboard";
|
||||
import TechnicianNavigation from "../../Components/DashboardPage/Technician/TechnicianNavigation";
|
||||
|
@ -16,8 +14,6 @@ export default function Dashboard() {
|
|||
<RestrictedComponent allow_only={"Technician"}>
|
||||
<TechnicianWidgets />
|
||||
<TechnicianNavigation />
|
||||
<TechnicianEquipmentButtons />
|
||||
<TechnicianLogButtons />
|
||||
</RestrictedComponent>
|
||||
<RestrictedComponent allow_only={"Student"}>
|
||||
<div
|
||||
|
@ -31,8 +27,9 @@ export default function Dashboard() {
|
|||
},
|
||||
}}
|
||||
>
|
||||
<StudentTransactionListView />
|
||||
<StudentDashboard />
|
||||
<StudentTransactionListView />
|
||||
|
||||
</div>
|
||||
</RestrictedComponent>
|
||||
<RestrictedComponent allow_only={"Teacher"}>
|
||||
|
|
20
src/Pages/ManageEquipmentPage/ManageEquipmentPage.tsx
Normal file
20
src/Pages/ManageEquipmentPage/ManageEquipmentPage.tsx
Normal file
|
@ -0,0 +1,20 @@
|
|||
import Header from "../../Components/Header/Header";
|
||||
import styles from "../../styles";
|
||||
import RestrictedComponent from "../../Components/RestrictedComponent/RestrictedComponent";
|
||||
import TechnicianEquipmentButtons from "../../Components/DashboardPage/Technician/TechnicianEquipmentButtons";
|
||||
import TechnicianLogButtons from "../../Components/DashboardPage/Technician/TechnicianLogButtons";
|
||||
|
||||
|
||||
export default function ManageEquipmentPage() {
|
||||
return (
|
||||
<div style={styles.background}>
|
||||
<Header label={"Equipment Management"} />
|
||||
<div style={{ position: "relative", zIndex: 999, marginTop: 80 , alignContent: "center", height: "100%"}}>
|
||||
<RestrictedComponent allow_only={"Technician"}>
|
||||
<TechnicianEquipmentButtons />
|
||||
<TechnicianLogButtons />
|
||||
</RestrictedComponent>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -53,6 +53,7 @@ export default function TransactionPage() {
|
|||
alignContent: "center",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
marginTop: 64
|
||||
}}
|
||||
>
|
||||
<PDFDownloadLink
|
||||
|
|
|
@ -68,6 +68,8 @@ export default function TransactionsListPage() {
|
|||
minHeight: "100%",
|
||||
minWidth: "100%",
|
||||
flexWrap: "wrap",
|
||||
marginTop: 60,
|
||||
paddingBottom: 20,
|
||||
},
|
||||
...styles.flex_column,
|
||||
}}
|
||||
|
|
|
@ -104,3 +104,18 @@ button:focus-visible {
|
|||
.custom-scrollbar::-webkit-scrollbar-track {
|
||||
background-color: #f0f0f0; /* Color of the track */
|
||||
}
|
||||
|
||||
.capsule {
|
||||
display: flex;
|
||||
width: 374px;
|
||||
padding: 10px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
gap: 30px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
border-radius: 6px;
|
||||
border: 1px dashed #000;
|
||||
background: #DDEDFF;
|
||||
}
|
Loading…
Reference in a new issue