init LinkedItems
component for show, edit
pages
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
import {Box, TextField} from '@mui/material'
|
||||
import {Edit} from '@refinedev/mui'
|
||||
import {useForm} from '@refinedev/react-hook-form'
|
||||
import {useParams} from 'react-router'
|
||||
import {LinkedItems} from '../../components/LinkedItems'
|
||||
import {type SightItem, sightFields} from './types'
|
||||
|
||||
export const StationEdit = () => {
|
||||
const {
|
||||
@ -9,6 +12,8 @@ export const StationEdit = () => {
|
||||
formState: {errors},
|
||||
} = useForm({})
|
||||
|
||||
const {id: stationId} = useParams<{id: string}>()
|
||||
|
||||
return (
|
||||
<Edit saveButtonProps={saveButtonProps}>
|
||||
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
|
||||
@ -67,6 +72,17 @@ export const StationEdit = () => {
|
||||
name="longitude"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{stationId && (
|
||||
<LinkedItems<SightItem>
|
||||
type="edit" // display and manage
|
||||
parentId={stationId}
|
||||
parentResource="station"
|
||||
childResource="sight"
|
||||
fields={sightFields}
|
||||
title="достопримечательности"
|
||||
/>
|
||||
)}
|
||||
</Edit>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user