enable search for select modules
				
					
				
			This commit is contained in:
		| @@ -14,6 +14,13 @@ export const CarrierCreate = () => { | |||||||
|  |  | ||||||
|   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'city', |     resource: 'city', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -37,6 +44,9 @@ export const CarrierCreate = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 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 />} |               renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|   | |||||||
| @@ -13,6 +13,13 @@ export const CarrierEdit = () => { | |||||||
|  |  | ||||||
|   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'city', |     resource: 'city', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -36,6 +43,9 @@ export const CarrierEdit = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 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 />} |               renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|   | |||||||
| @@ -18,6 +18,13 @@ export const RouteCreate = () => { | |||||||
|  |  | ||||||
|   const {autocompleteProps: carrierAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: carrierAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'carrier', |     resource: 'carrier', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'short_name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -41,7 +48,10 @@ export const RouteCreate = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 return option.id === value?.id | ||||||
|               }} |               }} | ||||||
|               renderInput={(params) => <TextField {...params} label="Выберите перевозчика" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} |               filterOptions={(options, {inputValue}) => { | ||||||
|  |                 return options.filter((option) => option.short_name.toLowerCase().includes(inputValue.toLowerCase())) | ||||||
|  |               }} | ||||||
|  |               renderInput={(params) => <TextField {...params} label="Выберите перевозчика" margin="normal" variant="outlined" error={!!errors.carrier_id} helperText={(errors as any)?.carrier_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|         /> |         /> | ||||||
|   | |||||||
| @@ -18,6 +18,13 @@ export const RouteEdit = () => { | |||||||
|  |  | ||||||
|   const {autocompleteProps: carrierAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: carrierAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'carrier', |     resource: 'carrier', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'short_name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -41,7 +48,10 @@ export const RouteEdit = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 return option.id === value?.id | ||||||
|               }} |               }} | ||||||
|               renderInput={(params) => <TextField {...params} label="Выберите перевозчика" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} |               filterOptions={(options, {inputValue}) => { | ||||||
|  |                 return options.filter((option) => option.short_name.toLowerCase().includes(inputValue.toLowerCase())) | ||||||
|  |               }} | ||||||
|  |               renderInput={(params) => <TextField {...params} label="Выберите перевозчика" margin="normal" variant="outlined" error={!!errors.carrier_id} helperText={(errors as any)?.carrier_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|         /> |         /> | ||||||
|   | |||||||
| @@ -18,6 +18,13 @@ export const SightCreate = () => { | |||||||
|  |  | ||||||
|   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'city', |     resource: 'city', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -83,6 +90,9 @@ export const SightCreate = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 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 />} |               renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|   | |||||||
| @@ -15,8 +15,16 @@ export const SightEdit = () => { | |||||||
|   } = useForm({}) |   } = useForm({}) | ||||||
|  |  | ||||||
|   const {id: sightId} = useParams<{id: string}>() |   const {id: sightId} = useParams<{id: string}>() | ||||||
|  |  | ||||||
|   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'city', |     resource: 'city', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -82,6 +90,9 @@ export const SightEdit = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 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 />} |               renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|   | |||||||
| @@ -16,6 +16,13 @@ export const VehicleCreate = () => { | |||||||
|  |  | ||||||
|   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'city', |     resource: 'city', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -79,6 +86,9 @@ export const VehicleCreate = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 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 />} |               renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|   | |||||||
| @@ -21,6 +21,13 @@ export const VehicleEdit = () => { | |||||||
|  |  | ||||||
|   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ |   const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ | ||||||
|     resource: 'city', |     resource: 'city', | ||||||
|  |     onSearch: (value) => [ | ||||||
|  |       { | ||||||
|  |         field: 'name', | ||||||
|  |         operator: 'contains', | ||||||
|  |         value, | ||||||
|  |       }, | ||||||
|  |     ], | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -84,6 +91,9 @@ export const VehicleEdit = () => { | |||||||
|               isOptionEqualToValue={(option, value) => { |               isOptionEqualToValue={(option, value) => { | ||||||
|                 return option.id === value?.id |                 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 />} |               renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />} | ||||||
|             /> |             /> | ||||||
|           )} |           )} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user