add show page for other routes

This commit is contained in:
maxim
2025-02-13 17:37:25 +03:00
parent b9556d212a
commit 92ad041aa2
10 changed files with 113 additions and 7 deletions

View File

@ -1,3 +1,4 @@
export * from './create'
export * from './edit'
export * from './list'
export * from './show'

View File

@ -1,5 +1,5 @@
import {DataGrid, type GridColDef} from '@mui/x-data-grid'
import {DeleteButton, EditButton, List, useDataGrid} from '@refinedev/mui'
import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui'
import React from 'react'
export const CarrierList = () => {
@ -48,6 +48,7 @@ export const CarrierList = () => {
return (
<>
<EditButton hideText recordItemId={row.id} />
<ShowButton hideText recordItemId={row.id} />
<DeleteButton hideText recordItemId={row.id} />
</>
)

View File

@ -0,0 +1,32 @@
import {Stack, Typography} from '@mui/material'
import {useShow} from '@refinedev/core'
import {Show, TextFieldComponent as TextField} from '@refinedev/mui'
export const CarrierShow = () => {
const {query} = useShow({})
const {data, isLoading} = query
const record = data?.data
const fields = [
{label: 'ID', data: 'id'},
{label: 'City ID', data: 'city_id'},
{label: 'Full Name', data: 'full_name'},
{label: 'Short Name', data: 'short_name'},
]
return (
<Show isLoading={isLoading}>
<Stack gap={4}>
{fields.map(({label, data}) => (
<Stack key={data} gap={1}>
<Typography variant="body1" fontWeight="bold">
{label}
</Typography>
<TextField value={record?.[data]} />
</Stack>
))}
</Stack>
</Show>
)
}