|
|
@@ -15,6 +15,7 @@ import { |
|
|
|
Checkbox, |
|
|
|
FormControlLabel, |
|
|
|
Button, |
|
|
|
Chip, |
|
|
|
} from "@mui/material"; |
|
|
|
import { DataGrid, GridColDef, GridRowSelectionModel } from "@mui/x-data-grid"; |
|
|
|
import { darken, lighten, styled } from "@mui/material/styles"; |
|
|
@@ -31,6 +32,7 @@ import { useCallback, useEffect, useState } from "react"; |
|
|
|
import { Check, Close, RestartAlt } from "@mui/icons-material"; |
|
|
|
import { NumericFormat, NumericFormatProps } from "react-number-format"; |
|
|
|
import * as React from "react"; |
|
|
|
import CancelIcon from "@mui/icons-material/Cancel"; |
|
|
|
|
|
|
|
interface Options { |
|
|
|
id: any; |
|
|
@@ -286,7 +288,7 @@ const CustomInputForm: React.FC<CustomInputFormProps> = ({ |
|
|
|
</Grid> |
|
|
|
); |
|
|
|
} else if (field.type === "multiDate") { |
|
|
|
console.log(dayjs(field.value)) |
|
|
|
// console.log(dayjs(field.value)) |
|
|
|
return ( |
|
|
|
<Grid item xs={field.size ?? 6} key={field.id}> |
|
|
|
<LocalizationProvider dateAdapter={AdapterDayjs}> |
|
|
@@ -343,8 +345,6 @@ const CustomInputForm: React.FC<CustomInputFormProps> = ({ |
|
|
|
id={field.id} |
|
|
|
value={value} |
|
|
|
onChange={(event) => { |
|
|
|
console.log(event); |
|
|
|
console.log(event.target); |
|
|
|
onChange(event.target.value); |
|
|
|
const newValue = event.target.value; |
|
|
|
const selectedOption = field.options?.find( |
|
|
@@ -379,6 +379,68 @@ const CustomInputForm: React.FC<CustomInputFormProps> = ({ |
|
|
|
</FormControl> |
|
|
|
</Grid> |
|
|
|
); |
|
|
|
} else if (field.type === "multiSelect-Obj") { |
|
|
|
return ( |
|
|
|
<Grid item xs={field.size ?? 6} key={field.id}> |
|
|
|
<FormControl fullWidth> |
|
|
|
<InputLabel id={`${field.id}-label`}>{field.label}</InputLabel> |
|
|
|
<Controller |
|
|
|
name={field.id} |
|
|
|
control={control} |
|
|
|
defaultValue={ |
|
|
|
field.value !== undefined ? field.value : [] |
|
|
|
} |
|
|
|
render={({ field: { onChange, value } }) => ( |
|
|
|
<Select |
|
|
|
labelId={`${field.id}-label`} |
|
|
|
id={field.id} |
|
|
|
value={value} |
|
|
|
multiple |
|
|
|
onChange={(event) => { |
|
|
|
onChange(event.target.value); |
|
|
|
const newValue = event.target.value; |
|
|
|
const selectedOption = field.options?.find( |
|
|
|
(option) => option.id === newValue |
|
|
|
); |
|
|
|
handleAutocompleteChange( |
|
|
|
field.id, |
|
|
|
selectedOption |
|
|
|
); |
|
|
|
}} |
|
|
|
renderValue={(selected) => { |
|
|
|
const selectedOption = field.options?.filter((option) => selected.includes(option.id)); |
|
|
|
return ( |
|
|
|
<Stack gap={1} direction="row" flexWrap="wrap"> |
|
|
|
{selectedOption ? selectedOption.map(({id, label}) => { |
|
|
|
return ( |
|
|
|
<Chip key={id} label={label} /> |
|
|
|
)}) : null} |
|
|
|
</Stack> |
|
|
|
)}} |
|
|
|
required={field.required} |
|
|
|
> |
|
|
|
{field.options?.map((option) => ( |
|
|
|
<MenuItem |
|
|
|
value={ |
|
|
|
option.id !== undefined |
|
|
|
? option.id |
|
|
|
: option |
|
|
|
} |
|
|
|
key={ |
|
|
|
option.id !== undefined |
|
|
|
? option.id |
|
|
|
: option |
|
|
|
} |
|
|
|
> |
|
|
|
{option.id ? option.label : ""} |
|
|
|
</MenuItem> |
|
|
|
))} |
|
|
|
</Select> |
|
|
|
)} |
|
|
|
/> |
|
|
|
</FormControl> |
|
|
|
</Grid> |
|
|
|
); |
|
|
|
} else if (field.type === "numeric") { |
|
|
|
return ( |
|
|
|
<Grid item xs={field.size ?? 6} key={field.id}> |
|
|
|