[2] fix required problem for project fields

This commit is contained in:
maxim 2025-03-28 02:26:18 +03:00
parent 754569b41d
commit d2e243ba64
6 changed files with 29 additions and 30 deletions

View File

@ -93,7 +93,7 @@ export const CarrierCreate = () => {
<TextField
{...register('main_color', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.main_color}
helperText={(errors as any)?.main_color?.message}
@ -101,7 +101,7 @@ export const CarrierCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="color"
label={'Основной цвет *'}
label={'Основной цвет'}
name="main_color"
sx={{
'& input': {
@ -115,7 +115,7 @@ export const CarrierCreate = () => {
<TextField
{...register('left_color', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.left_color}
helperText={(errors as any)?.left_color?.message}
@ -123,7 +123,7 @@ export const CarrierCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="color"
label={'Цвет левого виджета *'}
label={'Цвет левого виджета'}
name="left_color"
sx={{
'& input': {
@ -136,7 +136,7 @@ export const CarrierCreate = () => {
/>
<TextField
{...register('right_color', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.right_color}
helperText={(errors as any)?.right_color?.message}
@ -144,7 +144,7 @@ export const CarrierCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="color"
label={'Цвет правого виджета *'}
label={'Цвет правого виджета'}
name="right_color"
sx={{
'& input': {
@ -158,7 +158,7 @@ export const CarrierCreate = () => {
<TextField
{...register('slogan', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.slogan}
helperText={(errors as any)?.slogan?.message}
@ -166,14 +166,14 @@ export const CarrierCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Слоган *'}
label={'Слоган'}
name="slogan"
/>
<Controller
control={control}
name="logo"
rules={{required: 'Это поле является обязательным'}}
// rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -191,7 +191,7 @@ export const CarrierCreate = () => {
filterOptions={(options, {inputValue}) => {
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
}}
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} />}
/>
)}
/>

View File

@ -92,7 +92,7 @@ export const CarrierEdit = () => {
<TextField
{...register('main_color', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.main_color}
helperText={(errors as any)?.main_color?.message}
@ -100,7 +100,7 @@ export const CarrierEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="color"
label={'Основной цвет *'}
label={'Основной цвет'}
name="main_color"
sx={{
'& input': {
@ -114,7 +114,7 @@ export const CarrierEdit = () => {
<TextField
{...register('left_color', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.left_color}
helperText={(errors as any)?.left_color?.message}
@ -122,7 +122,7 @@ export const CarrierEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="color"
label={'Цвет левого виджета *'}
label={'Цвет левого виджета'}
name="left_color"
sx={{
'& input': {
@ -135,7 +135,7 @@ export const CarrierEdit = () => {
/>
<TextField
{...register('right_color', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.right_color}
helperText={(errors as any)?.right_color?.message}
@ -143,7 +143,7 @@ export const CarrierEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="color"
label={'Цвет правого виджета *'}
label={'Цвет правого виджета'}
name="right_color"
sx={{
'& input': {
@ -157,7 +157,7 @@ export const CarrierEdit = () => {
<TextField
{...register('slogan', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.slogan}
helperText={(errors as any)?.slogan?.message}
@ -165,14 +165,14 @@ export const CarrierEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Слоган *'}
label={'Слоган'}
name="slogan"
/>
<Controller
control={control}
name="logo"
rules={{required: 'Это поле является обязательным'}}
// rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -190,7 +190,7 @@ export const CarrierEdit = () => {
filterOptions={(options, {inputValue}) => {
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
}}
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} />}
/>
)}
/>

View File

@ -70,7 +70,6 @@ export const CityCreate = () => {
<Controller
control={control}
name="arms"
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -88,7 +87,7 @@ export const CityCreate = () => {
filterOptions={(options, {inputValue}) => {
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
}}
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} />}
/>
)}
/>

View File

@ -69,7 +69,7 @@ export const CityEdit = () => {
<Controller
control={control}
name="arms"
rules={{required: 'Это поле является обязательным'}}
// rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -87,7 +87,7 @@ export const CityEdit = () => {
filterOptions={(options, {inputValue}) => {
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
}}
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} />}
/>
)}
/>

View File

@ -32,7 +32,7 @@ export const StationCreate = () => {
/>
<TextField
{...register('description', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.description}
helperText={(errors as any)?.description?.message}
@ -40,7 +40,7 @@ export const StationCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Описание *'}
label={'Описание'}
name="description"
/>
<TextField

View File

@ -27,12 +27,12 @@ export const StationEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Название'}
label={'Название *'}
name="name"
/>
<TextField
{...register('description', {
required: 'Это поле является обязательным',
// required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.description}
helperText={(errors as any)?.description?.message}
@ -54,7 +54,7 @@ export const StationEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Широта'}
label={'Широта *'}
name="latitude"
/>
<TextField
@ -68,7 +68,7 @@ export const StationEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Долгота'}
label={'Долгота *'}
name="longitude"
/>
</Box>