moved city into other tab
This commit is contained in:
parent
7c920eb81e
commit
86947d6332
@ -596,46 +596,11 @@ export const SightEdit = observer(() => {
|
|||||||
|
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
|
|
||||||
name="city_id"
|
name="city_id"
|
||||||
rules={{ required: "Это поле является обязательным" }}
|
rules={{ required: "Это поле является обязательным" }}
|
||||||
defaultValue={null}
|
defaultValue={null}
|
||||||
render={({ field }) => (
|
render={() => (<div/>)}
|
||||||
<Autocomplete
|
|
||||||
{...cityAutocompleteProps}
|
|
||||||
value={
|
|
||||||
cityAutocompleteProps.options.find(
|
|
||||||
(option) => option.id === field.value
|
|
||||||
) || null
|
|
||||||
}
|
|
||||||
onChange={(_, value) => {
|
|
||||||
field.onChange(value?.id || "");
|
|
||||||
}}
|
|
||||||
getOptionLabel={(item) => {
|
|
||||||
return item ? item.name : "";
|
|
||||||
}}
|
|
||||||
isOptionEqualToValue={(option, value) => {
|
|
||||||
return option.id === value?.id;
|
|
||||||
}}
|
|
||||||
filterOptions={(options, { inputValue }) => {
|
|
||||||
return options.filter((option) =>
|
|
||||||
option.name
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(inputValue.toLowerCase())
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
renderInput={(params) => (
|
|
||||||
<TextField
|
|
||||||
{...params}
|
|
||||||
label="Выберите город"
|
|
||||||
margin="normal"
|
|
||||||
variant="outlined"
|
|
||||||
error={!!errors.city_id}
|
|
||||||
helperText={(errors as any)?.city_id?.message}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Box sx={{ display: "none" }}>
|
<Box sx={{ display: "none" }}>
|
||||||
@ -1458,6 +1423,51 @@ export const SightEdit = observer(() => {
|
|||||||
name="address"
|
name="address"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="city_id"
|
||||||
|
rules={{ required: "Это поле является обязательным" }}
|
||||||
|
defaultValue={null}
|
||||||
|
render={({ field }) => (
|
||||||
|
<Autocomplete
|
||||||
|
{...cityAutocompleteProps}
|
||||||
|
value={
|
||||||
|
cityAutocompleteProps.options.find(
|
||||||
|
(option) => option.id === field.value
|
||||||
|
) || null
|
||||||
|
}
|
||||||
|
onChange={(_, value) => {
|
||||||
|
field.onChange(value?.id || "");
|
||||||
|
}}
|
||||||
|
getOptionLabel={(item) => {
|
||||||
|
return item ? item.name : "";
|
||||||
|
}}
|
||||||
|
isOptionEqualToValue={(option, value) => {
|
||||||
|
console.log(cityAutocompleteProps.options)
|
||||||
|
return option.id === value?.id;
|
||||||
|
}}
|
||||||
|
filterOptions={(options, { inputValue }) => {
|
||||||
|
return options.filter((option) =>
|
||||||
|
option.name
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(inputValue.toLowerCase())
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
{...params}
|
||||||
|
label="Выберите город"
|
||||||
|
margin="normal"
|
||||||
|
variant="outlined"
|
||||||
|
error={!!errors.city_id}
|
||||||
|
helperText={(errors as any)?.city_id?.message}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="thumbnail"
|
name="thumbnail"
|
||||||
|
Loading…
Reference in New Issue
Block a user