2022-01-24 11:44:42 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
import Box from '@mui/material/Box';
|
|
|
|
import TextField from '@mui/material/TextField';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SelectTextFields = (props) => {
|
|
|
|
|
2022-02-27 04:35:56 +00:00
|
|
|
const [currency, setCurrency] = React.useState('0');
|
|
|
|
|
|
|
|
props.currencies.push({ 'value': 0, 'label': ''})
|
2022-01-25 14:24:05 +00:00
|
|
|
|
2022-01-24 11:44:42 +00:00
|
|
|
props.func(currency);
|
|
|
|
|
|
|
|
const handleChange = (event) => {
|
|
|
|
setCurrency(event.target.value);
|
|
|
|
};
|
2022-01-26 23:56:57 +00:00
|
|
|
|
|
|
|
|
2022-01-24 11:44:42 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
|
2022-01-25 14:24:05 +00:00
|
|
|
<Box
|
2022-01-24 11:44:42 +00:00
|
|
|
component="form"
|
|
|
|
sx={{
|
2022-01-26 23:56:57 +00:00
|
|
|
"&:hover": {
|
|
|
|
"&& fieldset": {
|
|
|
|
border: "1px solid black"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-01-24 11:44:42 +00:00
|
|
|
display: 'flex',
|
|
|
|
flexDirection: 'column',
|
2022-02-27 04:35:56 +00:00
|
|
|
'& .MuiTextField-root': { m: 1, },}
|
|
|
|
}
|
2022-01-24 11:44:42 +00:00
|
|
|
noValidate
|
|
|
|
autoComplete="off"
|
|
|
|
>
|
2022-01-26 23:56:57 +00:00
|
|
|
<TextField
|
2022-01-24 11:44:42 +00:00
|
|
|
id="outlined-select-currency-native"
|
|
|
|
margin="dense"
|
|
|
|
size="small"
|
|
|
|
select
|
2022-02-27 04:35:56 +00:00
|
|
|
label={props.header}
|
2022-01-24 11:44:42 +00:00
|
|
|
value={currency}
|
2022-01-26 23:56:57 +00:00
|
|
|
onChange={handleChange}
|
2022-01-24 11:44:42 +00:00
|
|
|
SelectProps={{
|
|
|
|
native: true,
|
|
|
|
}}
|
|
|
|
//helperText="Please select your currency"
|
|
|
|
>
|
|
|
|
{props.currencies.map((option) => (
|
2022-02-27 04:35:56 +00:00
|
|
|
<option key={option.id} value={option.value}>
|
2022-01-24 11:44:42 +00:00
|
|
|
{option.label}
|
|
|
|
</option>
|
|
|
|
))}
|
|
|
|
</TextField>
|
|
|
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-02-27 04:35:56 +00:00
|
|
|
export default SelectTextFields
|
2022-01-24 11:44:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
component="form"
|
|
|
|
sx={{
|
|
|
|
'& .MuiTextField-root': { m: 1, width: '25ch' },
|
|
|
|
}}
|
|
|
|
noValidate
|
|
|
|
autoComplete="off"
|
|
|
|
>
|
|
|
|
<div>
|
|
|
|
<TextField
|
|
|
|
id="outlined-select-currency"
|
|
|
|
select
|
|
|
|
label="Select"
|
|
|
|
value={currency}
|
|
|
|
onChange={handleChange}
|
|
|
|
helperText="Please select your currency"
|
|
|
|
>
|
|
|
|
{currencies.map((option) => (
|
|
|
|
<MenuItem key={option.value} value={option.value}>
|
|
|
|
{option.label}
|
|
|
|
</MenuItem>
|
|
|
|
))}
|
|
|
|
</TextField>
|
|
|
|
<TextField
|
|
|
|
id="outlined-select-currency-native"
|
|
|
|
select
|
|
|
|
label="Native select"
|
|
|
|
value={currency}
|
|
|
|
onChange={handleChange}
|
|
|
|
SelectProps={{
|
|
|
|
native: true,
|
|
|
|
}}
|
|
|
|
helperText="Please select your currency"
|
|
|
|
>
|
|
|
|
{currencies.map((option) => (
|
|
|
|
<option key={option.value} value={option.value}>
|
|
|
|
{option.label}
|
|
|
|
</option>
|
|
|
|
))}
|
|
|
|
</TextField>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<TextField
|
|
|
|
id="filled-select-currency"
|
|
|
|
select
|
|
|
|
label="Select"
|
|
|
|
value={currency}
|
|
|
|
onChange={handleChange}
|
|
|
|
helperText="Please select your currency"
|
|
|
|
variant="filled"
|
|
|
|
>
|
|
|
|
{currencies.map((option) => (
|
|
|
|
<MenuItem key={option.value} value={option.value}>
|
|
|
|
{option.label}
|
|
|
|
</MenuItem>
|
|
|
|
))}
|
|
|
|
</TextField>
|
|
|
|
<TextField
|
|
|
|
id="filled-select-currency-native"
|
|
|
|
select
|
|
|
|
label="Native select"
|
|
|
|
value={currency}
|
|
|
|
onChange={handleChange}
|
|
|
|
SelectProps={{
|
|
|
|
native: true,
|
|
|
|
}}
|
|
|
|
helperText="Please select your currency"
|
|
|
|
variant="filled"
|
|
|
|
>
|
|
|
|
{currencies.map((option) => (
|
|
|
|
<option key={option.value} value={option.value}>
|
|
|
|
{option.label}
|
|
|
|
</option>
|
|
|
|
))}
|
|
|
|
</TextField>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<TextField
|
|
|
|
id="standard-select-currency"
|
|
|
|
select
|
|
|
|
label="Select"
|
|
|
|
value={currency}
|
|
|
|
onChange={handleChange}
|
|
|
|
helperText="Please select your currency"
|
|
|
|
variant="standard"
|
|
|
|
>
|
|
|
|
{currencies.map((option) => (
|
|
|
|
<MenuItem key={option.value} value={option.value}>
|
|
|
|
{option.label}
|
|
|
|
</MenuItem>
|
|
|
|
))}
|
|
|
|
</TextField>
|
|
|
|
<TextField
|
|
|
|
id="standard-select-currency-native"
|
|
|
|
select
|
|
|
|
label="Native select"
|
|
|
|
value={currency}
|
|
|
|
onChange={handleChange}
|
|
|
|
SelectProps={{
|
|
|
|
native: true,
|
|
|
|
}}
|
|
|
|
helperText="Please select your currency"
|
|
|
|
variant="standard"
|
|
|
|
>
|
|
|
|
{currencies.map((option) => (
|
|
|
|
<option key={option.value} value={option.value}>
|
|
|
|
{option.label}
|
|
|
|
</option>
|
|
|
|
))}
|
|
|
|
</TextField>
|
|
|
|
</div>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
|
|
|
|
*/
|