diff --git a/src/components/CustomDataGrid.tsx b/src/components/CustomDataGrid.tsx
index 8f5a8c7..897394a 100644
--- a/src/components/CustomDataGrid.tsx
+++ b/src/components/CustomDataGrid.tsx
@@ -12,7 +12,7 @@ interface CustomDataGridProps extends DataGridProps {
resource?: string // Add this prop
}
-const DEV_FIELDS = ['id', 'code', 'country_code', 'city_id', 'carrier_id', 'main_color', 'left_color', 'right_color', 'logo', 'slogan', 'filename'] as const
+const DEV_FIELDS = ['id', 'code', 'country_code', 'city_id', 'carrier_id', 'main_color', 'left_color', 'right_color', 'logo', 'slogan', 'filename', 'arms', 'thumbnail'] as const
export const CustomDataGrid = ({hasCoordinates = false, columns = [], resource, ...props}: CustomDataGridProps) => {
// const isDev = import.meta.env.DEV
diff --git a/src/pages/city/list.tsx b/src/pages/city/list.tsx
index 95b7cf0..d477288 100644
--- a/src/pages/city/list.tsx
+++ b/src/pages/city/list.tsx
@@ -39,6 +39,12 @@ export const CityList = () => {
minWidth: 150,
flex: 1,
},
+ {
+ field: 'arms',
+ headerName: 'Герб',
+ type: 'string',
+ flex: 1,
+ },
{
field: 'actions',
headerName: 'Действия',
diff --git a/src/pages/sight/create.tsx b/src/pages/sight/create.tsx
index 72da1eb..adc79e9 100644
--- a/src/pages/sight/create.tsx
+++ b/src/pages/sight/create.tsx
@@ -27,6 +27,17 @@ export const SightCreate = () => {
],
})
+ const {autocompleteProps: mediaAutocompleteProps} = useAutocomplete({
+ resource: 'media',
+ onSearch: (value) => [
+ {
+ field: 'media_name',
+ operator: 'contains',
+ value,
+ },
+ ],
+ })
+
return (
@@ -97,6 +108,31 @@ export const SightCreate = () => {
/>
)}
/>
+
+ (
+ option.id === field.value) || null}
+ onChange={(_, value) => {
+ field.onChange(value?.id || '')
+ }}
+ getOptionLabel={(item) => {
+ return item ? item.media_name : ''
+ }}
+ isOptionEqualToValue={(option, value) => {
+ return option.id === value?.id
+ }}
+ filterOptions={(options, {inputValue}) => {
+ return options.filter((option) => option.media_name.toLowerCase().includes(inputValue.toLowerCase()))
+ }}
+ renderInput={(params) => }
+ />
+ )}
+ />
)
diff --git a/src/pages/sight/edit.tsx b/src/pages/sight/edit.tsx
index f0366fe..efdd5d9 100644
--- a/src/pages/sight/edit.tsx
+++ b/src/pages/sight/edit.tsx
@@ -28,6 +28,17 @@ export const SightEdit = () => {
],
})
+ const {autocompleteProps: mediaAutocompleteProps} = useAutocomplete({
+ resource: 'media',
+ onSearch: (value) => [
+ {
+ field: 'media_name',
+ operator: 'contains',
+ value,
+ },
+ ],
+ })
+
return (
@@ -98,6 +109,31 @@ export const SightEdit = () => {
/>
)}
/>
+
+ (
+ option.id === field.value) || null}
+ onChange={(_, value) => {
+ field.onChange(value?.id || '')
+ }}
+ getOptionLabel={(item) => {
+ return item ? item.media_name : ''
+ }}
+ isOptionEqualToValue={(option, value) => {
+ return option.id === value?.id
+ }}
+ filterOptions={(options, {inputValue}) => {
+ return options.filter((option) => option.media_name.toLowerCase().includes(inputValue.toLowerCase()))
+ }}
+ renderInput={(params) => }
+ />
+ )}
+ />
{sightId && (
diff --git a/src/pages/sight/list.tsx b/src/pages/sight/list.tsx
index abbb69d..6b13c78 100644
--- a/src/pages/sight/list.tsx
+++ b/src/pages/sight/list.tsx
@@ -64,6 +64,12 @@ export const SightList = () => {
headerAlign: 'left',
flex: 1,
},
+ {
+ field: 'thumbnail',
+ headerName: 'Карточка',
+ type: 'string',
+ flex: 1,
+ },
{
field: 'actions',
headerName: 'Действия',