upgrade edit
for /sight
route to create articles
This commit is contained in:
@ -4,9 +4,12 @@ import {useForm} from '@refinedev/react-hook-form'
|
||||
import {Controller} from 'react-hook-form'
|
||||
import {useParams} from 'react-router'
|
||||
import {LinkedItems} from '../../components/LinkedItems'
|
||||
import {CreateSightArticle} from '../../components/CreateSightArticle'
|
||||
import {ArticleItem, articleFields} from './types'
|
||||
|
||||
export const SightEdit = () => {
|
||||
const {id: sightId} = useParams<{id: string}>()
|
||||
|
||||
const {
|
||||
saveButtonProps,
|
||||
register,
|
||||
@ -14,8 +17,6 @@ export const SightEdit = () => {
|
||||
formState: {errors},
|
||||
} = useForm({})
|
||||
|
||||
const {id: sightId} = useParams<{id: string}>()
|
||||
|
||||
const {autocompleteProps: cityAutocompleteProps} = useAutocomplete({
|
||||
resource: 'city',
|
||||
onSearch: (value) => [
|
||||
@ -98,7 +99,14 @@ export const SightEdit = () => {
|
||||
)}
|
||||
/>
|
||||
</Box>
|
||||
{sightId && <LinkedItems<ArticleItem> type="edit" parentId={sightId} parentResource="sight" childResource="article" fields={articleFields} title="статьи" />}
|
||||
|
||||
{sightId && (
|
||||
<Box sx={{mt: 3}}>
|
||||
<LinkedItems<ArticleItem> type="edit" parentId={sightId} parentResource="sight" childResource="article" fields={articleFields} title="статьи" />
|
||||
|
||||
<CreateSightArticle parentId={sightId} parentResource="sight" childResource="article" title="статью" />
|
||||
</Box>
|
||||
)}
|
||||
</Edit>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user