active select

This commit is contained in:
Sonika 2024-01-10 10:49:04 +05:30
parent e22b9bacbc
commit bbb5acb67c
3 changed files with 84 additions and 18 deletions

View File

@ -20,6 +20,9 @@ import {
Grid,
InputAdornment,
Box,
Select,
MenuItem,
InputLabel,
} from '@mui/material';
import EditIcon from '@mui/icons-material/Edit';
import AddIcon from '@mui/icons-material/Add';
@ -49,6 +52,31 @@ const StyledTextField = (props:any) => (
/>
);
const StyledSelect = (props: any) => (
<div>
<InputLabel htmlFor={props.name} sx={{ color: 'white', fontSize:13 }}>
{props.label}
</InputLabel>
<Select
variant="standard"
margin="dense"
fullWidth
{...props}
sx={{
color: 'white',
'& .MuiInputBase-input': { color: 'white' },
'& .MuiInput-underline:after': { borderBottomColor: 'white' },
'& .MuiOutlinedInput-root': {
'& fieldset': { borderColor: 'white' },
'&:hover fieldset': { borderColor: 'white', borderWidth: 2 },
},
...props.sx,
}}
>
{props.children}
</Select>
</div>
);
interface Row {
username: string;
role: string;
@ -233,7 +261,7 @@ export default function IntranetUsers(){
/>
<Dialog open={open} onClose={handleClose}>
<DialogTitle sx={{bgcolor:'rgb(24 24 23)', color:'white'}}>{selectedRow && selectedRow.id ? 'Edit Row' : 'Add New Row'}</DialogTitle>
<DialogContent sx={{ bgcolor: 'rgb(24 24 23)' }}>
<DialogContent sx={{ bgcolor: 'rgb(24 24 23)' }} className="dialog-class">
<StyledTextField
label="Name"
type="text"
@ -247,14 +275,19 @@ export default function IntranetUsers(){
value={selectedRow && selectedRow.role}
onChange={handleChange}
/>
<StyledTextField
<StyledSelect
label="Active"
placeholder="Active"
name="active"
value={selectedRow && selectedRow.active}
onChange={handleChange}
/>
</DialogContent>
<DialogActions sx={{bgcolor:'rgb(24 24 23)'}}>
>
<MenuItem value='Active'>Active</MenuItem>
<MenuItem value='Inactive'>Inactive</MenuItem>
</StyledSelect>
</DialogContent >
<DialogActions sx={{bgcolor:'rgb(24 24 23)'}} className="dialog-class-actions">
<Button onClick={handleClose} color="primary">
Cancel
</Button>

View File

@ -19,6 +19,9 @@ import {
TablePagination,
InputAdornment,
Box,
InputLabel,
Select,
MenuItem,
} from '@mui/material';
import SearchIcon from '@mui/icons-material/Search';
import EditIcon from '@mui/icons-material/Edit';
@ -47,6 +50,32 @@ const StyledTextField = (props:any) => (
/>
);
const StyledSelect = (props: any) => (
<div>
<InputLabel htmlFor={props.name} sx={{ color: 'white', fontSize:13 }}>
{props.label}
</InputLabel>
<Select
variant="standard"
margin="dense"
fullWidth
{...props}
sx={{
color: 'white',
'& .MuiInputBase-input': { color: 'white' },
'& .MuiInput-underline:after': { borderBottomColor: 'white' },
'& .MuiOutlinedInput-root': {
'& fieldset': { borderColor: 'white' },
'&:hover fieldset': { borderColor: 'white', borderWidth: 2 },
},
...props.sx,
}}
>
{props.children}
</Select>
</div>
);
interface Row {
username: string;
email_id: string;
@ -236,7 +265,7 @@ export default function ManageUsers(){
/>
<Dialog open={open} onClose={handleClose}>
<DialogTitle sx={{bgcolor:'rgb(24 24 23)', color:'white'}}>{selectedRow && selectedRow.id ? 'Edit Row' : 'Add New Row'}</DialogTitle>
<DialogContent sx={{ bgcolor: 'rgb(24 24 23)' }}>
<DialogContent sx={{ bgcolor: 'rgb(24 24 23)' }} className="dialog-class">
<StyledTextField
label="Name"
type="text"
@ -256,14 +285,18 @@ export default function ManageUsers(){
value={selectedRow && selectedRow.last_login}
onChange={handleChange}
/>
<StyledTextField
<StyledSelect
label="Active"
placeholder="Active"
name="active"
value={selectedRow && selectedRow.active}
onChange={handleChange}
/>
>
<MenuItem value='Active'>Active</MenuItem>
<MenuItem value='Inactive'>Inactive</MenuItem>
</StyledSelect>
</DialogContent>
<DialogActions sx={{bgcolor:'rgb(24 24 23)'}}>
<DialogActions sx={{bgcolor:'rgb(24 24 23)'}} className="dialog-class-actions">
<Button onClick={handleClose} color="primary">
Cancel
</Button>