From f9b4729ee738054c5074bbd999e59a88812cbfd9 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Fri, 29 Dec 2023 18:44:18 +0800 Subject: [PATCH] Update transaction entry to reflect borrower's course --- .../RegisterModal/RegisterModal.tsx | 56 +++++++++++++++++++ .../TransactionEntry/TransactionEntry.tsx | 18 ++++++ .../TransactionPDF/TransactionPDF.tsx | 20 +++++++ src/Components/Types/Types.tsx | 4 ++ .../AddTransactionPage/AddTransactionPage.tsx | 42 ++++++++++---- 5 files changed, 129 insertions(+), 11 deletions(-) diff --git a/src/Components/RegisterModal/RegisterModal.tsx b/src/Components/RegisterModal/RegisterModal.tsx index e9ea675..ca49625 100644 --- a/src/Components/RegisterModal/RegisterModal.tsx +++ b/src/Components/RegisterModal/RegisterModal.tsx @@ -11,6 +11,13 @@ import Button from "../Button/Button"; import { useNavigate } from "react-router-dom"; import { RegisterAPI } from "../API/API"; import { toast } from "react-toastify"; +import { + Radio, + RadioGroup, + FormControlLabel, + FormControl, + FormLabel, +} from "@mui/material"; export default function RegisterModal() { const navigate = useNavigate(); const [showPassword, setShowPassword] = useState(false); @@ -20,6 +27,7 @@ export default function RegisterModal() { last_name: "", username: "", email: "", + course: "", password: "", confirm_password: "", }); @@ -78,6 +86,53 @@ export default function RegisterModal() { value={user.email} placeholder={"Enter your email"} /> + + + Course + + ) => { + setUser({ ...user, course: e.target.value }); + setError(""); + }} + > +
+ } + label="BS Chemistry" + style={styles.text_dark} + /> + } + label="BS Food Technology" + style={styles.text_dark} + /> + } + label="BS Applied Physics" + style={styles.text_dark} + /> + } + label="BS Environmental Science" + style={styles.text_dark} + /> +
+
+
+

+ {`(${props.transaction.borrower.course})`} +

+

+ Subject: {props.transaction.subject} +

+ + {`(${props.transaction.borrower.course})`} + + + Subject: {props.transaction.subject} + ; @@ -134,6 +137,7 @@ export type TransactionCreateType = { remarks: string; teacher: number; borrower: number; + subject: string; transaction_status: "Pending Approval"; }; diff --git a/src/Pages/AddTransactionPage/AddTransactionPage.tsx b/src/Pages/AddTransactionPage/AddTransactionPage.tsx index 741e9fa..1b864a6 100644 --- a/src/Pages/AddTransactionPage/AddTransactionPage.tsx +++ b/src/Pages/AddTransactionPage/AddTransactionPage.tsx @@ -30,6 +30,7 @@ export default function AddTransactionPage() { const queryClient = useQueryClient(); const [selecteditems, SetSelectedItems] = useState([]); const [selectedteacher, SetSelectedTeacher] = useState(0); + const [subject, SetSubject] = useState(""); const [remarks, SetRemarks] = useState(""); const [error, setError] = useState(""); @@ -129,7 +130,8 @@ export default function AddTransactionPage() { onChange={(event) => SetSelectedTeacher(event.target.value as number) } - input={} + label={"Assigned Teacher"} + input={} > {teachers.data?.map((teacher) => ( @@ -138,16 +140,33 @@ export default function AddTransactionPage() { ))} - ) => { - SetRemarks(e.target.value); - setError(""); - }} - value={remarks} - placeholder={"Optionally add a brief description of the request"} - /> + + Subject + ) => { + SetSubject(e.target.value); + setError(""); + }} + label={"Subject"} + value={subject} + placeholder={"The subject requiring the equipments"} + /> + + + Remarks + ) => { + SetRemarks(e.target.value); + setError(""); + }} + label={"Remarks"} + value={remarks} + placeholder={"Optionally add a brief description of the request"} + /> +

{error}