mirror of
https://github.com/lemeow125/Borrowing-TrackerFrontend.git
synced 2025-06-29 00:45:49 +08:00
Update dropdown menu for new transaction
This commit is contained in:
parent
433207f8e4
commit
48d0e8f133
4 changed files with 107 additions and 24 deletions
|
@ -20,6 +20,7 @@ import {
|
|||
CircularProgress,
|
||||
MenuItem,
|
||||
OutlinedInput,
|
||||
Autocomplete,
|
||||
} from "@mui/material";
|
||||
import React from "react";
|
||||
import Header from "../../Components/Header/Header";
|
||||
|
@ -126,29 +127,50 @@ export default function AddTransactionPage() {
|
|||
|
||||
<div style={styles.flex_column}>
|
||||
<FormControl style={{ marginTop: "8px" }}>
|
||||
<FormLabel style={styles.text_dark}>Items Requested</FormLabel>
|
||||
<Select
|
||||
<FormLabel
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...{ marginLeft: "4px", marginBottom: "8px", textAlign: "left" },
|
||||
}}
|
||||
>
|
||||
Items Requested
|
||||
</FormLabel>
|
||||
<Autocomplete
|
||||
multiple
|
||||
value={transaction.equipments}
|
||||
onChange={(event) =>
|
||||
id="equipment-autocomplete"
|
||||
options={equipments.data || []}
|
||||
getOptionLabel={(option) =>
|
||||
`${option.equipment_name} (ID:${option.id})`
|
||||
}
|
||||
value={
|
||||
equipments.data?.filter((equipment) =>
|
||||
transaction.equipments.includes(equipment.id)
|
||||
) || []
|
||||
}
|
||||
onChange={(event, newValue) => {
|
||||
SetTransaction({
|
||||
...transaction,
|
||||
equipments: event.target.value as number[],
|
||||
})
|
||||
}
|
||||
input={<OutlinedInput label="Name" />}
|
||||
>
|
||||
{equipments.data
|
||||
?.filter((equipment) => equipment.status == "Available")
|
||||
.map((equipment) => (
|
||||
<MenuItem key={equipment.id} value={equipment.id}>
|
||||
{`${equipment.equipment_name} (ID:${equipment.id})`}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
equipments: newValue.map((item) => item.id),
|
||||
});
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
variant="outlined"
|
||||
label="Items Requested"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControl style={{ marginTop: "8px" }}>
|
||||
<FormLabel style={styles.text_dark}>Assigned Teacher</FormLabel>
|
||||
<FormLabel
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...{ marginLeft: "4px", marginBottom: "4px", textAlign: "left" },
|
||||
}}
|
||||
>
|
||||
Assigned Teacher
|
||||
</FormLabel>
|
||||
<Select
|
||||
value={transaction.teacher}
|
||||
onChange={(event) =>
|
||||
|
@ -157,8 +179,7 @@ export default function AddTransactionPage() {
|
|||
teacher: event.target.value as number,
|
||||
})
|
||||
}
|
||||
label={"Assigned Teacher"}
|
||||
input={<OutlinedInput label="Assigned Teacher" />}
|
||||
input={<OutlinedInput />}
|
||||
>
|
||||
{teachers.data?.map((teacher) => (
|
||||
<MenuItem key={teacher.id} value={teacher.id}>
|
||||
|
@ -168,7 +189,14 @@ export default function AddTransactionPage() {
|
|||
</Select>
|
||||
</FormControl>
|
||||
<FormControl style={{ marginTop: "8px" }}>
|
||||
<FormLabel style={styles.text_dark}>Subject</FormLabel>
|
||||
<FormLabel
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...{ marginLeft: "4px", marginBottom: "4px", textAlign: "left" },
|
||||
}}
|
||||
>
|
||||
Subject
|
||||
</FormLabel>
|
||||
<TextField
|
||||
style={styles.input_form}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
|
@ -181,7 +209,14 @@ export default function AddTransactionPage() {
|
|||
/>
|
||||
</FormControl>
|
||||
<FormControl style={{ marginTop: "8px" }}>
|
||||
<FormLabel style={styles.text_dark}>Remarks</FormLabel>
|
||||
<FormLabel
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...{ marginLeft: "4px", marginBottom: "4px", textAlign: "left" },
|
||||
}}
|
||||
>
|
||||
Remarks
|
||||
</FormLabel>
|
||||
<TextField
|
||||
multiline
|
||||
style={styles.input_form}
|
||||
|
@ -195,7 +230,14 @@ export default function AddTransactionPage() {
|
|||
/>
|
||||
</FormControl>
|
||||
<FormControl style={{ marginTop: "8px" }}>
|
||||
<FormLabel style={styles.text_dark}>Consumables</FormLabel>
|
||||
<FormLabel
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...{ marginLeft: "4px", marginBottom: "4px", textAlign: "left" },
|
||||
}}
|
||||
>
|
||||
Consumables
|
||||
</FormLabel>
|
||||
<TextField
|
||||
multiline
|
||||
style={styles.input_form}
|
||||
|
@ -209,7 +251,14 @@ export default function AddTransactionPage() {
|
|||
/>
|
||||
</FormControl>
|
||||
<FormControl style={{ marginTop: "8px" }}>
|
||||
<FormLabel style={styles.text_dark}>Additional Members</FormLabel>
|
||||
<FormLabel
|
||||
style={{
|
||||
...styles.text_dark,
|
||||
...{ marginLeft: "4px", marginBottom: "4px", textAlign: "left" },
|
||||
}}
|
||||
>
|
||||
Additional Members
|
||||
</FormLabel>
|
||||
<TextField
|
||||
multiline
|
||||
style={styles.input_form}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue