Update Member Import

This commit is contained in:
2022-07-25 10:20:35 +07:00
parent 42e4129a79
commit 1edd8157c7
71 changed files with 1917 additions and 2743 deletions

View File

@@ -150,11 +150,13 @@ export default function EditorToolbar({ id, isSimple, ...other }: EditorToolbarP
<select className="ql-align" />
</div>
<div className="ql-formats">
<button type="button" className="ql-link" />
<button type="button" className="ql-image" />
<button type="button" className="ql-video" />
</div>
{!isSimple && (
<div className="ql-formats">
<button type="button" className="ql-link" />
<button type="button" className="ql-image" />
<button type="button" className="ql-video" />
</div>
)}
<div className="ql-formats">
{!isSimple && <button type="button" className="ql-formula" />}

View File

@@ -1,5 +1,6 @@
import { ReactNode } from 'react';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';
// @mui
import { styled } from '@mui/material/styles';
import { Box, BoxProps } from '@mui/material';

View File

@@ -67,3 +67,49 @@ export function RHFMultiCheckbox({ name, options, ...other }: RHFMultiCheckboxPr
/>
);
}
// ----------------------------------------------------------------------
interface optionsCustomInterface {
value: string;
label: string;
}
interface RHFCustomMultiCheckboxProps {
name: string;
options: optionsCustomInterface[];
}
export function RHFCustomMultiCheckbox({ name, options, ...other }: RHFCustomMultiCheckboxProps) {
const { control } = useFormContext();
return (
<Controller
name={name}
control={control}
render={({ field }) => {
const onSelected = (option: optionsCustomInterface) =>
field.value.includes(option.value)
? field.value.filter((value: string) => value !== option.value)
: [...field.value, option.value];
return (
<FormGroup>
{options.map((option, index) => (
<FormControlLabel
key={index}
control={
<Checkbox
checked={field.value.includes(option.value)}
onChange={() => field.onChange(onSelected(option))}
/>
}
label={option.label}
{...other}
/>
))}
</FormGroup>
);
}}
/>
);
}

View File

@@ -0,0 +1,33 @@
// form
import { useFormContext, Controller } from 'react-hook-form';
// @mui
import { TextField, TextFieldProps } from '@mui/material';
import { LocalizationProvider, MobileDatePicker } from '@mui/x-date-pickers';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
// ----------------------------------------------------------------------
interface IProps {
name: string;
}
export default function RHFDatepicker({ name, ...other }: IProps & TextFieldProps) {
const { control } = useFormContext();
return (
<Controller
name={name}
control={control}
render={({ field, fieldState: { error } }) => (
<LocalizationProvider dateAdapter={AdapterDateFns}>
<MobileDatePicker
inputFormat="yyyy-MM-dd"
value={field.value}
onChange={field.onChange}
renderInput={(field) => <TextField {...field} fullWidth error={!!error} helperText={error?.message} {...other} />}
/>
</LocalizationProvider>
)}
/>
);
}

View File

@@ -24,6 +24,7 @@ export default function RHFEditor({ name, ...other }: Props) {
value={field.value}
onChange={field.onChange}
error={!!error}
simple={true}
helperText={
<FormHelperText error sx={{ px: 2, textTransform: 'capitalize' }}>
{error?.message}

View File

@@ -8,3 +8,4 @@ export { default as RHFSelect } from './RHFSelect';
export { default as RHFEditor } from './RHFEditor';
export { default as RHFTextField } from './RHFTextField';
export { default as RHFRadioGroup } from './RHFRadioGroup';
export { default as RHFDatepicker } from './RHFDatepicker';