diff --git a/src/pages/carrier/create.tsx b/src/pages/carrier/create.tsx index 5ff07d5..20b3dd7 100644 --- a/src/pages/carrier/create.tsx +++ b/src/pages/carrier/create.tsx @@ -14,6 +14,13 @@ export const CarrierCreate = () => { const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ resource: 'city', + onSearch: (value) => [ + { + field: 'name', + operator: 'contains', + value, + }, + ], }) return ( @@ -37,6 +44,9 @@ export const CarrierCreate = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.name.toLowerCase().includes(inputValue.toLowerCase())) + }} renderInput={(params) => } /> )} diff --git a/src/pages/carrier/edit.tsx b/src/pages/carrier/edit.tsx index 850a7af..c572eb7 100644 --- a/src/pages/carrier/edit.tsx +++ b/src/pages/carrier/edit.tsx @@ -13,6 +13,13 @@ export const CarrierEdit = () => { const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ resource: 'city', + onSearch: (value) => [ + { + field: 'name', + operator: 'contains', + value, + }, + ], }) return ( @@ -36,6 +43,9 @@ export const CarrierEdit = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.name.toLowerCase().includes(inputValue.toLowerCase())) + }} renderInput={(params) => } /> )} diff --git a/src/pages/route/create.tsx b/src/pages/route/create.tsx index 67aa7b5..b6f6cb6 100644 --- a/src/pages/route/create.tsx +++ b/src/pages/route/create.tsx @@ -18,6 +18,13 @@ export const RouteCreate = () => { const {autocompleteProps: carrierAutocompleteProps} = useAutocomplete({ resource: 'carrier', + onSearch: (value) => [ + { + field: 'short_name', + operator: 'contains', + value, + }, + ], }) return ( @@ -41,7 +48,10 @@ export const RouteCreate = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} - renderInput={(params) => } + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.short_name.toLowerCase().includes(inputValue.toLowerCase())) + }} + renderInput={(params) => } /> )} /> diff --git a/src/pages/route/edit.tsx b/src/pages/route/edit.tsx index a87193e..0e03a62 100644 --- a/src/pages/route/edit.tsx +++ b/src/pages/route/edit.tsx @@ -18,6 +18,13 @@ export const RouteEdit = () => { const {autocompleteProps: carrierAutocompleteProps} = useAutocomplete({ resource: 'carrier', + onSearch: (value) => [ + { + field: 'short_name', + operator: 'contains', + value, + }, + ], }) return ( @@ -41,7 +48,10 @@ export const RouteEdit = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} - renderInput={(params) => } + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.short_name.toLowerCase().includes(inputValue.toLowerCase())) + }} + renderInput={(params) => } /> )} /> diff --git a/src/pages/sight/create.tsx b/src/pages/sight/create.tsx index b1bb90c..1412308 100644 --- a/src/pages/sight/create.tsx +++ b/src/pages/sight/create.tsx @@ -18,6 +18,13 @@ export const SightCreate = () => { const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ resource: 'city', + onSearch: (value) => [ + { + field: 'name', + operator: 'contains', + value, + }, + ], }) return ( @@ -83,6 +90,9 @@ export const SightCreate = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.name.toLowerCase().includes(inputValue.toLowerCase())) + }} renderInput={(params) => } /> )} diff --git a/src/pages/sight/edit.tsx b/src/pages/sight/edit.tsx index fd8405b..585f5d0 100644 --- a/src/pages/sight/edit.tsx +++ b/src/pages/sight/edit.tsx @@ -15,8 +15,16 @@ export const SightEdit = () => { } = useForm({}) const {id: sightId} = useParams<{id: string}>() + const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ resource: 'city', + onSearch: (value) => [ + { + field: 'name', + operator: 'contains', + value, + }, + ], }) return ( @@ -82,6 +90,9 @@ export const SightEdit = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.name.toLowerCase().includes(inputValue.toLowerCase())) + }} renderInput={(params) => } /> )} diff --git a/src/pages/vehicle/create.tsx b/src/pages/vehicle/create.tsx index 7884dfb..1e95781 100644 --- a/src/pages/vehicle/create.tsx +++ b/src/pages/vehicle/create.tsx @@ -16,6 +16,13 @@ export const VehicleCreate = () => { const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ resource: 'city', + onSearch: (value) => [ + { + field: 'name', + operator: 'contains', + value, + }, + ], }) return ( @@ -79,6 +86,9 @@ export const VehicleCreate = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.name.toLowerCase().includes(inputValue.toLowerCase())) + }} renderInput={(params) => } /> )} diff --git a/src/pages/vehicle/edit.tsx b/src/pages/vehicle/edit.tsx index d82905b..9723e2c 100644 --- a/src/pages/vehicle/edit.tsx +++ b/src/pages/vehicle/edit.tsx @@ -21,6 +21,13 @@ export const VehicleEdit = () => { const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({ resource: 'city', + onSearch: (value) => [ + { + field: 'name', + operator: 'contains', + value, + }, + ], }) return ( @@ -84,6 +91,9 @@ export const VehicleEdit = () => { isOptionEqualToValue={(option, value) => { return option.id === value?.id }} + filterOptions={(options, {inputValue}) => { + return options.filter((option) => option.name.toLowerCase().includes(inputValue.toLowerCase())) + }} renderInput={(params) => } /> )}