diff --git a/src/App.tsx b/src/App.tsx
index 01f197b..8aedd53 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -16,16 +16,14 @@ import {Register} from './pages/register'
import {ForgotPassword} from './pages/forgotPassword'
import {authProvider} from './authProvider'
-// import {BlogPostList, BlogPostCreate, BlogPostEdit, BlogPostShow} from './pages/blog-posts'
-// import {CategoryList, CategoryCreate, CategoryEdit, CategoryShow} from './pages/categories'
-
import {CountryList, CountryCreate, CountryEdit} from './pages/country'
import {CityList, CityCreate, CityEdit} from './pages/city'
import {CarrierList, CarrierCreate, CarrierEdit} from './pages/carrier'
import {MediaList, MediaCreate, MediaEdit, MediaShow} from './pages/media'
import {ArticleList, ArticleCreate, ArticleEdit} from './pages/article'
+import {SightList, SightCreate, SightEdit} from './pages/sight'
-import {CountryIcon, CityIcon, CarrierIcon, MediaIcon, ArticleIcon} from './components/ui/Icons'
+import {CountryIcon, CityIcon, CarrierIcon, MediaIcon, ArticleIcon, SightIcon} from './components/ui/Icons'
function App() {
return (
@@ -99,6 +97,18 @@ function App() {
icon: ,
},
},
+ {
+ name: 'sight',
+ list: '/sight',
+ create: '/sight/create',
+ edit: '/sight/edit/:id',
+ // добавить SHOW для sight->article (https://wn.krbl.ru/sight/2/article)
+ meta: {
+ canDelete: true,
+ label: 'Вид',
+ icon: ,
+ },
+ },
]}
options={{
syncWithLocation: true,
@@ -150,6 +160,12 @@ function App() {
} />
+
+ } />
+ } />
+ } />
+
+
} />
{
+ const {
+ saveButtonProps,
+ refineCore: {formLoading},
+ register,
+ control,
+ formState: {errors},
+ } = useForm({
+ refineCoreProps: {
+ resource: 'sight/',
+ },
+ })
+
+ const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({
+ resource: 'city',
+ })
+
+ return (
+
+
+
+
+
+
+ (
+ 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
+ }}
+ renderInput={(params) => }
+ />
+ )}
+ />
+
+
+ )
+}
diff --git a/src/pages/sight/edit.tsx b/src/pages/sight/edit.tsx
new file mode 100644
index 0000000..99868d9
--- /dev/null
+++ b/src/pages/sight/edit.tsx
@@ -0,0 +1,87 @@
+import {Autocomplete, Box, TextField} from '@mui/material'
+import {Edit, useAutocomplete} from '@refinedev/mui'
+import {useForm} from '@refinedev/react-hook-form'
+import {Controller} from 'react-hook-form'
+
+export const SightEdit = () => {
+ const {
+ saveButtonProps,
+ register,
+ control,
+ formState: {errors},
+ } = useForm({})
+
+ const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({
+ resource: 'city',
+ })
+
+ return (
+
+
+
+
+
+ (
+ 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
+ }}
+ renderInput={(params) => }
+ />
+ )}
+ />
+
+
+ )
+}
diff --git a/src/pages/sight/index.ts b/src/pages/sight/index.ts
new file mode 100644
index 0000000..fbafdcf
--- /dev/null
+++ b/src/pages/sight/index.ts
@@ -0,0 +1,3 @@
+export * from './create'
+export * from './edit'
+export * from './list'
diff --git a/src/pages/sight/list.tsx b/src/pages/sight/list.tsx
new file mode 100644
index 0000000..da251a7
--- /dev/null
+++ b/src/pages/sight/list.tsx
@@ -0,0 +1,84 @@
+import {DataGrid, type GridColDef} from '@mui/x-data-grid'
+import {DeleteButton, EditButton, List, useDataGrid} from '@refinedev/mui'
+import React from 'react'
+
+export const SightList = () => {
+ const {dataGridProps} = useDataGrid({
+ resource: 'sight/',
+ })
+
+ const columns = React.useMemo(
+ () => [
+ {
+ field: 'id',
+ headerName: 'ID',
+ type: 'number',
+ minWidth: 70,
+ display: 'flex',
+ align: 'left',
+ headerAlign: 'left',
+ },
+ {
+ field: 'name',
+ headerName: 'Name',
+ type: 'string',
+ minWidth: 200,
+ display: 'flex',
+ align: 'left',
+ headerAlign: 'left',
+ },
+ {
+ field: 'latitude',
+ headerName: 'Latitude',
+ type: 'number',
+ minWidth: 150,
+ display: 'flex',
+ align: 'left',
+ headerAlign: 'left',
+ },
+ {
+ field: 'longitude',
+ headerName: 'Longitude',
+ type: 'number',
+ minWidth: 150,
+ display: 'flex',
+ align: 'left',
+ headerAlign: 'left',
+ },
+ {
+ field: 'city_id',
+ headerName: 'City ID',
+ type: 'number',
+ minWidth: 70,
+ display: 'flex',
+ align: 'left',
+ headerAlign: 'left',
+ flex: 1,
+ },
+ {
+ field: 'actions',
+ headerName: 'Actions',
+ align: 'right',
+ headerAlign: 'center',
+ minWidth: 100,
+ sortable: false,
+ display: 'flex',
+ renderCell: function render({row}) {
+ return (
+ <>
+
+
+ >
+ )
+ },
+ },
+ ],
+ [],
+ )
+
+ return (
+
+ row.id} />
+
+ )
+}