2024-03-16 19:39:20 +01:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { FC } from "react";
|
2024-04-24 21:44:05 +02:00
|
|
|
import { Grid } from "@mui/material";
|
2024-03-16 19:39:20 +01:00
|
|
|
import { useRouter } from "next/navigation";
|
2024-04-24 21:44:05 +02:00
|
|
|
import { Dialog, Button } from "ui";
|
2024-03-16 19:39:20 +01:00
|
|
|
|
|
|
|
|
interface DetailProps {
|
|
|
|
|
title: string;
|
|
|
|
|
entity: string;
|
2024-04-24 21:44:05 +02:00
|
|
|
id: string;
|
2024-03-16 19:39:20 +01:00
|
|
|
children: any;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 21:44:05 +02:00
|
|
|
export const Detail: FC<DetailProps> = ({ title, entity, id, children }) => {
|
2024-03-16 19:39:20 +01:00
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
return (
|
2024-04-23 13:36:51 +02:00
|
|
|
<Dialog
|
2024-04-24 21:44:05 +02:00
|
|
|
open
|
|
|
|
|
title={title}
|
2024-04-23 13:36:51 +02:00
|
|
|
onClose={() => router.push(`/${entity}`)}
|
2024-04-24 21:44:05 +02:00
|
|
|
buttons={
|
|
|
|
|
<Grid container justifyContent="space-between">
|
|
|
|
|
<Grid item container xs="auto" spacing={2}>
|
|
|
|
|
<Grid item>
|
|
|
|
|
<Button text="Delete" kind="destructive" />
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item>
|
|
|
|
|
<Button
|
|
|
|
|
text="Edit"
|
|
|
|
|
kind="secondary"
|
|
|
|
|
href={`/${entity}/${id}/edit`}
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
2024-04-23 13:36:51 +02:00
|
|
|
<Grid item>
|
2024-04-24 21:44:05 +02:00
|
|
|
<Button text="Done" kind="primary" href={`/${entity}`} />
|
2024-04-23 13:36:51 +02:00
|
|
|
</Grid>
|
2024-03-16 19:39:20 +01:00
|
|
|
</Grid>
|
2024-04-24 21:44:05 +02:00
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
2024-04-23 13:36:51 +02:00
|
|
|
</Dialog>
|
2024-03-16 19:39:20 +01:00
|
|
|
);
|
|
|
|
|
};
|