update,
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
# task
|
|
||||||
|
|
||||||
## instruction
|
|
||||||
|
|
||||||
with reference to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/_helloworld/page.tsx`
|
|
||||||
|
|
||||||
with reference to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/lesson_types/edit/[typeId]/page.tsx`
|
|
||||||
|
|
||||||
please modify `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/lesson_categories/edit/page.tsx`
|
|
||||||
|
|
||||||
please draft a tsx for showing error to user thanks,
|
|
@@ -1,3 +1,4 @@
|
|||||||
|
// src/app/dashboard/vocabularies/create/page.tsx
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
@@ -34,11 +35,11 @@ export default function Page(): React.JSX.Element {
|
|||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
>
|
>
|
||||||
<ArrowLeftIcon fontSize="var(--icon-fontSize-md)" />
|
<ArrowLeftIcon fontSize="var(--icon-fontSize-md)" />
|
||||||
{t('title',)}
|
{t('title')}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Typography variant="h4">{t('create.title', )}</Typography>
|
<Typography variant="h4">{t('create.title')}</Typography>
|
||||||
</div>
|
</div>
|
||||||
</Stack>
|
</Stack>
|
||||||
<VocabularyCreateForm />
|
<VocabularyCreateForm />
|
||||||
|
@@ -121,12 +121,22 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Stack divider={<Divider />} spacing={4}>
|
<Stack
|
||||||
|
divider={<Divider />}
|
||||||
|
spacing={4}
|
||||||
|
>
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Typography variant="h6">{t('create.typeInformation', NS_DEFAULT)}</Typography>
|
<Typography variant="h6">{t('create.basic')}</Typography>
|
||||||
<Grid container spacing={3}>
|
<Grid
|
||||||
|
container
|
||||||
|
spacing={3}
|
||||||
|
>
|
||||||
<Grid xs={12}>
|
<Grid xs={12}>
|
||||||
<Stack direction="row" spacing={3} sx={{ alignItems: 'center' }}>
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={3}
|
||||||
|
sx={{ alignItems: 'center' }}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
border: '1px dashed var(--mui-palette-divider)',
|
border: '1px dashed var(--mui-palette-divider)',
|
||||||
@@ -151,9 +161,12 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
<CameraIcon fontSize="var(--Icon-fontSize)" />
|
<CameraIcon fontSize="var(--Icon-fontSize)" />
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</Box>
|
</Box>
|
||||||
<Stack spacing={1} sx={{ alignItems: 'flex-start' }}>
|
<Stack
|
||||||
<Typography variant="subtitle1">{t('create.avatar', NS_DEFAULT)}</Typography>
|
spacing={1}
|
||||||
<Typography variant="caption">{t('create.avatarRequirements', NS_DEFAULT)}</Typography>
|
sx={{ alignItems: 'flex-start' }}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle1">{t('create.avatar')}</Typography>
|
||||||
|
<Typography variant="caption">{t('create.avatarRequirements')}</Typography>
|
||||||
<Button
|
<Button
|
||||||
color="secondary"
|
color="secondary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -161,44 +174,70 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
}}
|
}}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
{t('create.avatar_select', NS_DEFAULT)}
|
{t('create.avatar_select')}
|
||||||
</Button>
|
</Button>
|
||||||
<input hidden onChange={handleAvatarChange} ref={avatarInputRef} type="file" />
|
<input
|
||||||
|
hidden
|
||||||
|
onChange={handleAvatarChange}
|
||||||
|
ref={avatarInputRef}
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.name)} fullWidth>
|
<FormControl
|
||||||
<InputLabel required>{t('create.name', NS_DEFAULT)}</InputLabel>
|
error={Boolean(errors.name)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<InputLabel required>{t('create.name')}</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.name ? <FormHelperText>{errors.name.message}</FormHelperText> : null}
|
{errors.name ? <FormHelperText>{errors.name.message}</FormHelperText> : null}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="email"
|
name="email"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.email)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.email)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel required>Email address</InputLabel>
|
<InputLabel required>Email address</InputLabel>
|
||||||
<OutlinedInput {...field} type="email" />
|
<OutlinedInput
|
||||||
|
{...field}
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
{errors.email ? <FormHelperText>{errors.email.message}</FormHelperText> : null}
|
{errors.email ? <FormHelperText>{errors.email.message}</FormHelperText> : null}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="phone"
|
name="phone"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.phone)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.phone)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel required>Phone number</InputLabel>
|
<InputLabel required>Phone number</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.phone ? <FormHelperText>{errors.phone.message}</FormHelperText> : null}
|
{errors.phone ? <FormHelperText>{errors.phone.message}</FormHelperText> : null}
|
||||||
@@ -206,12 +245,18 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="company"
|
name="company"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.company)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.company)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel>Company</InputLabel>
|
<InputLabel>Company</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.company ? <FormHelperText>{errors.company.message}</FormHelperText> : null}
|
{errors.company ? <FormHelperText>{errors.company.message}</FormHelperText> : null}
|
||||||
@@ -222,35 +267,56 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Typography variant="h6">{t('create.detail-information', NS_DEFAULT)}</Typography>
|
<Typography variant="h6">{t('create.detail-information')}</Typography>
|
||||||
<Grid container spacing={3}>
|
<Grid
|
||||||
<Grid md={6} xs={12}>
|
container
|
||||||
|
spacing={3}
|
||||||
|
>
|
||||||
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="billingAddress.country"
|
name="billingAddress.country"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography variant="subtitle1" color="text-secondary">
|
<Typography
|
||||||
{t('create.description', NS_DEFAULT)}
|
variant="subtitle1"
|
||||||
|
color="text-secondary"
|
||||||
|
>
|
||||||
|
{t('create.description')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
||||||
<TextEditor content="" placeholder="Write something" />
|
<TextEditor
|
||||||
|
content=""
|
||||||
|
placeholder="Write something"
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="billingAddress.state"
|
name="billingAddress.state"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography variant="subtitle1" color="text.secondary">
|
<Typography
|
||||||
{t('create.remarks', NS_DEFAULT)}
|
variant="subtitle1"
|
||||||
|
color="text.secondary"
|
||||||
|
>
|
||||||
|
{t('create.remarks')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
||||||
<TextEditor content="" placeholder="Write something" />
|
<TextEditor
|
||||||
|
content=""
|
||||||
|
placeholder="Write something"
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
@@ -261,12 +327,21 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardActions sx={{ justifyContent: 'flex-end' }}>
|
<CardActions sx={{ justifyContent: 'flex-end' }}>
|
||||||
<Button color="secondary" component={RouterLink} href={paths.dashboard.lesson_categories.list}>
|
<Button
|
||||||
{t('create.cancelButton', NS_DEFAULT)}
|
color="secondary"
|
||||||
|
component={RouterLink}
|
||||||
|
href={paths.dashboard.lesson_categories.list}
|
||||||
|
>
|
||||||
|
{t('create.cancelButton')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<LoadingButton disabled={isCreating} loading={isCreating} type="submit" variant="contained">
|
<LoadingButton
|
||||||
{t('create.createButton', NS_DEFAULT)}
|
disabled={isCreating}
|
||||||
|
loading={isCreating}
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
>
|
||||||
|
{t('create.createButton')}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</CardActions>
|
</CardActions>
|
||||||
</Card>
|
</Card>
|
||||||
|
@@ -75,8 +75,6 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useTranslation(['common', 'lesson_category']);
|
const { t } = useTranslation(['common', 'lesson_category']);
|
||||||
|
|
||||||
const NS_DEFAULT = { ns: 'lesson_category' };
|
|
||||||
|
|
||||||
const [isCreating, setIsCreating] = React.useState<boolean>(false);
|
const [isCreating, setIsCreating] = React.useState<boolean>(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -121,12 +119,22 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Stack divider={<Divider />} spacing={4}>
|
<Stack
|
||||||
|
divider={<Divider />}
|
||||||
|
spacing={4}
|
||||||
|
>
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Typography variant="h6">{t('create.typeInformation', NS_DEFAULT)}</Typography>
|
<Typography variant="h6">{t('create.basic')}</Typography>
|
||||||
<Grid container spacing={3}>
|
<Grid
|
||||||
|
container
|
||||||
|
spacing={3}
|
||||||
|
>
|
||||||
<Grid xs={12}>
|
<Grid xs={12}>
|
||||||
<Stack direction="row" spacing={3} sx={{ alignItems: 'center' }}>
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={3}
|
||||||
|
sx={{ alignItems: 'center' }}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
border: '1px dashed var(--mui-palette-divider)',
|
border: '1px dashed var(--mui-palette-divider)',
|
||||||
@@ -151,9 +159,12 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
<CameraIcon fontSize="var(--Icon-fontSize)" />
|
<CameraIcon fontSize="var(--Icon-fontSize)" />
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</Box>
|
</Box>
|
||||||
<Stack spacing={1} sx={{ alignItems: 'flex-start' }}>
|
<Stack
|
||||||
<Typography variant="subtitle1">{t('create.avatar', NS_DEFAULT)}</Typography>
|
spacing={1}
|
||||||
<Typography variant="caption">{t('create.avatarRequirements', NS_DEFAULT)}</Typography>
|
sx={{ alignItems: 'flex-start' }}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle1">{t('create.avatar')}</Typography>
|
||||||
|
<Typography variant="caption">{t('create.avatarRequirements')}</Typography>
|
||||||
<Button
|
<Button
|
||||||
color="secondary"
|
color="secondary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -161,44 +172,70 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
}}
|
}}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
{t('create.avatar_select', NS_DEFAULT)}
|
{t('create.avatar_select')}
|
||||||
</Button>
|
</Button>
|
||||||
<input hidden onChange={handleAvatarChange} ref={avatarInputRef} type="file" />
|
<input
|
||||||
|
hidden
|
||||||
|
onChange={handleAvatarChange}
|
||||||
|
ref={avatarInputRef}
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.name)} fullWidth>
|
<FormControl
|
||||||
<InputLabel required>{t('create.name', NS_DEFAULT)}</InputLabel>
|
error={Boolean(errors.name)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<InputLabel required>{t('create.name')}</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.name ? <FormHelperText>{errors.name.message}</FormHelperText> : null}
|
{errors.name ? <FormHelperText>{errors.name.message}</FormHelperText> : null}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="email"
|
name="email"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.email)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.email)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel required>Email address</InputLabel>
|
<InputLabel required>Email address</InputLabel>
|
||||||
<OutlinedInput {...field} type="email" />
|
<OutlinedInput
|
||||||
|
{...field}
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
{errors.email ? <FormHelperText>{errors.email.message}</FormHelperText> : null}
|
{errors.email ? <FormHelperText>{errors.email.message}</FormHelperText> : null}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="phone"
|
name="phone"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.phone)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.phone)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel required>Phone number</InputLabel>
|
<InputLabel required>Phone number</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.phone ? <FormHelperText>{errors.phone.message}</FormHelperText> : null}
|
{errors.phone ? <FormHelperText>{errors.phone.message}</FormHelperText> : null}
|
||||||
@@ -206,12 +243,18 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="company"
|
name="company"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.company)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.company)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel>Company</InputLabel>
|
<InputLabel>Company</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.company ? <FormHelperText>{errors.company.message}</FormHelperText> : null}
|
{errors.company ? <FormHelperText>{errors.company.message}</FormHelperText> : null}
|
||||||
@@ -222,35 +265,56 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Typography variant="h6">{t('create.detail-information', NS_DEFAULT)}</Typography>
|
<Typography variant="h6">{t('create.detail-information')}</Typography>
|
||||||
<Grid container spacing={3}>
|
<Grid
|
||||||
<Grid md={6} xs={12}>
|
container
|
||||||
|
spacing={3}
|
||||||
|
>
|
||||||
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="billingAddress.country"
|
name="billingAddress.country"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography variant="subtitle1" color="text-secondary">
|
<Typography
|
||||||
{t('create.description', NS_DEFAULT)}
|
variant="subtitle1"
|
||||||
|
color="text-secondary"
|
||||||
|
>
|
||||||
|
{t('create.description')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
||||||
<TextEditor content="" placeholder="Write something" />
|
<TextEditor
|
||||||
|
content=""
|
||||||
|
placeholder="Write something"
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="billingAddress.state"
|
name="billingAddress.state"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography variant="subtitle1" color="text.secondary">
|
<Typography
|
||||||
{t('create.remarks', NS_DEFAULT)}
|
variant="subtitle1"
|
||||||
|
color="text.secondary"
|
||||||
|
>
|
||||||
|
{t('create.remarks')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
<Box sx={{ mt: '8px', '& .tiptap-container': { height: '400px' } }}>
|
||||||
<TextEditor content="" placeholder="Write something" />
|
<TextEditor
|
||||||
|
content=""
|
||||||
|
placeholder="Write something"
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
@@ -261,12 +325,21 @@ export function LessonCategoryCreateForm(): React.JSX.Element {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardActions sx={{ justifyContent: 'flex-end' }}>
|
<CardActions sx={{ justifyContent: 'flex-end' }}>
|
||||||
<Button color="secondary" component={RouterLink} href={paths.dashboard.lesson_categories.list}>
|
<Button
|
||||||
{t('create.cancelButton', NS_DEFAULT)}
|
color="secondary"
|
||||||
|
component={RouterLink}
|
||||||
|
href={paths.dashboard.lesson_categories.list}
|
||||||
|
>
|
||||||
|
{t('create.cancelButton')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<LoadingButton disabled={isCreating} loading={isCreating} type="submit" variant="contained">
|
<LoadingButton
|
||||||
{t('create.createButton', NS_DEFAULT)}
|
disabled={isCreating}
|
||||||
|
loading={isCreating}
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
>
|
||||||
|
{t('create.createButton')}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</CardActions>
|
</CardActions>
|
||||||
</Card>
|
</Card>
|
||||||
|
@@ -113,12 +113,22 @@ export function LessonTypeCreateForm(): React.JSX.Element {
|
|||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Stack divider={<Divider />} spacing={4}>
|
<Stack
|
||||||
|
divider={<Divider />}
|
||||||
|
spacing={4}
|
||||||
|
>
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Typography variant="h6">{t('dashboard.lessonTypes.create.typeInformation')}</Typography>
|
<Typography variant="h6">{t('create.basic')}</Typography>
|
||||||
<Grid container spacing={3}>
|
<Grid
|
||||||
|
container
|
||||||
|
spacing={3}
|
||||||
|
>
|
||||||
<Grid xs={12}>
|
<Grid xs={12}>
|
||||||
<Stack direction="row" spacing={3} sx={{ alignItems: 'center' }}>
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={3}
|
||||||
|
sx={{ alignItems: 'center' }}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
border: '1px dashed var(--mui-palette-divider)',
|
border: '1px dashed var(--mui-palette-divider)',
|
||||||
@@ -127,7 +137,10 @@ export function LessonTypeCreateForm(): React.JSX.Element {
|
|||||||
p: '4px',
|
p: '4px',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Stack spacing={1} sx={{ alignItems: 'flex-start' }}>
|
<Stack
|
||||||
|
spacing={1}
|
||||||
|
sx={{ alignItems: 'flex-start' }}
|
||||||
|
>
|
||||||
<Typography variant="subtitle1">{t('dashboard.lessonTypes.create.avatar')}</Typography>
|
<Typography variant="subtitle1">{t('dashboard.lessonTypes.create.avatar')}</Typography>
|
||||||
<Typography variant="caption">{t('dashboard.lessonTypes.create.avatarRequirements')}</Typography>
|
<Typography variant="caption">{t('dashboard.lessonTypes.create.avatarRequirements')}</Typography>
|
||||||
<Button
|
<Button
|
||||||
@@ -139,16 +152,27 @@ export function LessonTypeCreateForm(): React.JSX.Element {
|
|||||||
>
|
>
|
||||||
{t('dashboard.lessonTypes.create.select')}
|
{t('dashboard.lessonTypes.create.select')}
|
||||||
</Button>
|
</Button>
|
||||||
<input hidden onChange={handleAvatarChange} ref={avatarInputRef} type="file" />
|
<input
|
||||||
|
hidden
|
||||||
|
onChange={handleAvatarChange}
|
||||||
|
ref={avatarInputRef}
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.name)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.name)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel required>{t('dashboard.lessonTypes.create.name')}</InputLabel>
|
<InputLabel required>{t('dashboard.lessonTypes.create.name')}</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.name ? <FormHelperText>{errors.name.message}</FormHelperText> : null}
|
{errors.name ? <FormHelperText>{errors.name.message}</FormHelperText> : null}
|
||||||
@@ -156,12 +180,18 @@ export function LessonTypeCreateForm(): React.JSX.Element {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="type"
|
name="type"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.type)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.type)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel required>{t('dashboard.lessonTypes.create.type')}</InputLabel>
|
<InputLabel required>{t('dashboard.lessonTypes.create.type')}</InputLabel>
|
||||||
<OutlinedInput {...field} />
|
<OutlinedInput {...field} />
|
||||||
{errors.type ? <FormHelperText>{errors.type.message}</FormHelperText> : null}
|
{errors.type ? <FormHelperText>{errors.type.message}</FormHelperText> : null}
|
||||||
@@ -169,12 +199,18 @@ export function LessonTypeCreateForm(): React.JSX.Element {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="pos"
|
name="pos"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.pos)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.pos)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel required>{t('dashboard.lessonTypes.create.position')}</InputLabel>
|
<InputLabel required>{t('dashboard.lessonTypes.create.position')}</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
{...field}
|
{...field}
|
||||||
@@ -188,12 +224,18 @@ export function LessonTypeCreateForm(): React.JSX.Element {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={6} xs={12}>
|
<Grid
|
||||||
|
md={6}
|
||||||
|
xs={12}
|
||||||
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="visible_to_user"
|
name="visible_to_user"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl error={Boolean(errors.visible_to_user)} fullWidth>
|
<FormControl
|
||||||
|
error={Boolean(errors.visible_to_user)}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<InputLabel>{t('dashboard.lessonTypes.create.visibleToUser')}</InputLabel>
|
<InputLabel>{t('dashboard.lessonTypes.create.visibleToUser')}</InputLabel>
|
||||||
<Select {...field}>
|
<Select {...field}>
|
||||||
<MenuItem value="visible">visible</MenuItem>
|
<MenuItem value="visible">visible</MenuItem>
|
||||||
@@ -212,10 +254,19 @@ export function LessonTypeCreateForm(): React.JSX.Element {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardActions sx={{ justifyContent: 'flex-end' }}>
|
<CardActions sx={{ justifyContent: 'flex-end' }}>
|
||||||
<Button color="secondary" component={RouterLink} href={paths.dashboard.lesson_types.list}>
|
<Button
|
||||||
|
color="secondary"
|
||||||
|
component={RouterLink}
|
||||||
|
href={paths.dashboard.lesson_types.list}
|
||||||
|
>
|
||||||
{t('dashboard.lessonTypes.create.cancelButton')}
|
{t('dashboard.lessonTypes.create.cancelButton')}
|
||||||
</Button>
|
</Button>
|
||||||
<LoadingButton disabled={isCreating} loading={isCreating} type="submit" variant="contained">
|
<LoadingButton
|
||||||
|
disabled={isCreating}
|
||||||
|
loading={isCreating}
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
>
|
||||||
{t('dashboard.lessonTypes.create.createButton')}
|
{t('dashboard.lessonTypes.create.createButton')}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</CardActions>
|
</CardActions>
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
export interface Vocabulary {
|
|
||||||
id: string;
|
|
||||||
created?: string;
|
|
||||||
updated?: string;
|
|
||||||
image?: string;
|
|
||||||
sound?: string;
|
|
||||||
word?: string;
|
|
||||||
word_c?: string;
|
|
||||||
sample_e?: string;
|
|
||||||
sample_c?: string;
|
|
||||||
cat_id?: string;
|
|
||||||
category?: string;
|
|
||||||
lesson_type_id?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateForm {
|
|
||||||
image?: string;
|
|
||||||
sound?: string;
|
|
||||||
word?: string;
|
|
||||||
word_c?: string;
|
|
||||||
sample_e?: string;
|
|
||||||
sample_c?: string;
|
|
||||||
cat_id?: string;
|
|
||||||
category?: string;
|
|
||||||
lesson_type_id?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EditFormProps {
|
|
||||||
id: string;
|
|
||||||
defaultValues: Vocabulary;
|
|
||||||
onDone: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Helloworld {
|
|
||||||
helloworld: string;
|
|
||||||
}
|
|
@@ -185,7 +185,7 @@ export function VocabularyCreateForm(): React.JSX.Element {
|
|||||||
spacing={4}
|
spacing={4}
|
||||||
>
|
>
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Typography variant="h6">{t('create.typeInformation')}</Typography>
|
<Typography variant="h6">{t('create.basic')}</Typography>
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
spacing={3}
|
spacing={3}
|
||||||
|
Reference in New Issue
Block a user