Changes Dashboard, Form, Added divs lang gyud. fix fix lang gamay

This commit is contained in:
Pongot, Jophiel 2024-01-09 06:17:30 +08:00
parent f00432aab7
commit 0574bb2a41
4 changed files with 84 additions and 41 deletions

View file

@ -23,7 +23,7 @@ import {
TransactionCreateType, TransactionCreateType,
} from "../Types/Types"; } from "../Types/Types";
const debug = false; const debug = true;
let backendURL; let backendURL;
if (debug) { if (debug) {

View file

@ -48,7 +48,7 @@ export default function TeacherTransactionListView() {
<div <div
style={{ style={{
...styles.flex_column, ...styles.flex_column,
...{ height: "50vh", overflowY: "scroll", width: "85%", marginInline: "6.5%" }, ...{ height: "50vh", overflowY: "scroll", width: "100%", },
}} }}
> >
{transactions.data ? ( {transactions.data ? (

View file

@ -22,7 +22,8 @@ export default function TransactionEntry(props: props) {
borderRadius: 16, borderRadius: 16,
marginTop: "10px", marginTop: "10px",
paddingTop: "15px", paddingTop: "15px",
width: "100%" width: "100%",
maxWidth: "550px"
}} }}
onClick={props.onClick} onClick={props.onClick}

View file

@ -3,7 +3,6 @@ import styles from "../../styles";
import { colors } from "../../styles"; import { colors } from "../../styles";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import AddToQueueIcon from "@mui/icons-material/AddToQueue"; import AddToQueueIcon from "@mui/icons-material/AddToQueue";
import Button from "../../Components/Button/Button";
import { toast } from "react-toastify"; import { toast } from "react-toastify";
import { import {
AvailableEquipmentInstancesAPI, AvailableEquipmentInstancesAPI,
@ -21,6 +20,9 @@ import {
MenuItem, MenuItem,
OutlinedInput, OutlinedInput,
Autocomplete, Autocomplete,
Alert,
Stack
} from "@mui/material"; } from "@mui/material";
import React from "react"; import React from "react";
import Header from "../../Components/Header/Header"; import Header from "../../Components/Header/Header";
@ -125,11 +127,17 @@ export default function AddTransactionPage() {
<p style={{ ...styles.text_dark, ...styles.text_L }}>Borrowing Form</p> <p style={{ ...styles.text_dark, ...styles.text_L }}>Borrowing Form</p>
</div> </div>
<div style={{...styles.flex_column, marginLeft: "1rem", marginRight: "1rem"}}> <div
style={{
...styles.flex_column,
marginLeft: "1rem",
marginRight: "1rem",
}}
>
<FormControl style={{ marginTop: "8px" }}> <FormControl style={{ marginTop: "8px" }}>
<FormLabel <FormLabel
style={{ style={{
...{...styles.text_dark, ...styles.bform_label2}, ...{ ...styles.text_dark, ...styles.bform_label2 },
...{ marginLeft: "4px", marginBottom: "8px", textAlign: "left" }, ...{ marginLeft: "4px", marginBottom: "8px", textAlign: "left" },
}} }}
> >
@ -207,26 +215,7 @@ export default function AddTransactionPage() {
placeholder={"The subject requiring the equipments"} placeholder={"The subject requiring the equipments"}
/> />
</FormControl> </FormControl>
<FormControl style={{ marginTop: "8px" }}>
<FormLabel
style={{
...styles.text_dark,
...{ marginLeft: "4px", marginBottom: "4px", textAlign: "left" },
}}
>
Remarks
</FormLabel>
<TextField
multiline
style={styles.input_form}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
SetTransaction({ ...transaction, remarks: e.target.value });
setError("");
}}
value={transaction.remarks}
placeholder={"Optionally add a brief description of the request"}
/>
</FormControl>
<FormControl style={{ marginTop: "8px" }}> <FormControl style={{ marginTop: "8px" }}>
<FormLabel <FormLabel
style={{ style={{
@ -244,7 +233,9 @@ export default function AddTransactionPage() {
setError(""); setError("");
}} }}
value={transaction.consumables} value={transaction.consumables}
placeholder={"Write down any consumables here"} placeholder={
"ex. Filter Papers, Acids, Solvent, Cleaning Agents"
}
/> />
</FormControl> </FormControl>
<FormControl style={{ marginTop: "8px" }}> <FormControl style={{ marginTop: "8px" }}>
@ -268,24 +259,63 @@ export default function AddTransactionPage() {
}} }}
value={transaction.additional_members} value={transaction.additional_members}
placeholder={ placeholder={
"Write down any additional members borrowing on behalf of this transaction" "1. Full Name ex. (Daniel John Padilla)\n2. Kathryn Bernardo \n3. ..."
} }
/> />
</FormControl> </FormControl>
<FormControl style={{ marginTop: "8px" }}>
<FormLabel
style={{
...styles.text_dark,
...{ marginLeft: "4px", marginBottom: "4px", textAlign: "left" },
}}
>
Remarks (optional)
</FormLabel>
<TextField
multiline
style={styles.input_form}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
SetTransaction({ ...transaction, remarks: e.target.value });
setError("");
}}
value={transaction.remarks}
placeholder={"Add a brief description of the request or N/A."}
/>
</FormControl>
</div> </div>
<p style={{ ...styles.text_dark, ...styles.text_M }}>{error}</p>
<div <div
style={{ style={{
backgroundColor: colors.button_border, display: "flex",
marginTop: "16px", flex: 1,
alignContent: "center",
width: "100%", width: "100%",
height: "2px", marginTop: "1rem"
marginBottom: 8,
}} }}
/> >
<Button <Stack
type={"dark"} sx={{
label={"Create Transaction"} width: "100%",
}}
spacing={2}
>
<Alert
icon={false}
severity="warning"
sx={{ alignItems: "center", justifyContent: "center" }}
>
NOTE: please be reminded that borrowing of lab apparatus can only be
made once. Further requests of additional apparatus will not be
entertained.
</Alert>
</Stack>
</div>
<p style={{ ...styles.text_dark, ...styles.text_M }}>{error}</p>
<button
onClick={async () => { onClick={async () => {
console.log(JSON.stringify(transaction)); console.log(JSON.stringify(transaction));
const data = await TransactionCreateAPI(transaction); const data = await TransactionCreateAPI(transaction);
@ -309,9 +339,6 @@ export default function AddTransactionPage() {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["equipment_instances"], queryKey: ["equipment_instances"],
}); });
queryClient.invalidateQueries({
queryKey: ["equipment_instances_available"],
});
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["transactions"], queryKey: ["transactions"],
}); });
@ -320,7 +347,22 @@ export default function AddTransactionPage() {
setError(JSON.stringify(data[1])); setError(JSON.stringify(data[1]));
} }
}} }}
/> style={{
display: "flex",
padding: "25px 38px",
justifyContent: "center",
alignItems: "center",
background: "#A7DA96",
height: "40px",
width: "100%",
marginTop: "1rem",
marginBottom: "1rem",
}}
>
<p style={{ ...styles.text_light, ...styles.text_M, ...{ flex: 1 } }}>Create Transaction</p>
</button>
</div> </div>
); );
} }