integrate LinkedItems into /route pages

This commit is contained in:
maxim
2025-03-19 16:19:23 +03:00
parent 9cb939deac
commit 451e1da308
4 changed files with 62 additions and 302 deletions

View File

@ -104,7 +104,7 @@ export const LinkedItems = <T extends {id: number; [key: string]: any}>({parentI
<AccordionDetails sx={{background: theme.palette.background.paper}}>
<Stack gap={2}>
<Grid container gap={2}>
<Grid container gap={1.25}>
{isLoading ? (
<Typography>Загрузка...</Typography>
) : linkedItems.length > 0 ? (
@ -112,20 +112,20 @@ export const LinkedItems = <T extends {id: number; [key: string]: any}>({parentI
<Box
key={index}
sx={{
marginBottom: '8px',
marginTop: '8px',
padding: '14px',
borderRadius: 2,
border: `2px solid ${theme.palette.divider}`,
}}
>
<Stack gap={0.5}>
<Stack gap={0.25}>
{fields.map(({label, data}) => (
<Typography key={String(data)}>
<Typography variant="body2" color="textSecondary" key={String(data)}>
<strong>{label}:</strong> {item[data]}
</Typography>
))}
{type === 'edit' && (
<Button variant="outlined" color="error" onClick={() => deleteItem(item.id)} sx={{mt: 1.5}}>
<Button variant="outlined" color="error" size="small" onClick={() => deleteItem(item.id)} sx={{mt: 1.5}}>
Отвязать
</Button>
)}