Files
amap/frontend/src/components/Forms/Card/index.tsx
JulienAldon 04bcaa2601
All checks were successful
Deploy Amap / deploy (push) Successful in 1m51s
fix merge
2026-09-07 19:29:27 +02:00

63 lines
2.4 KiB
TypeScript

import { ActionIcon, Badge, Box, Group, Paper, Text, Title, Tooltip } from "@mantine/core";
import { Link } from "react-router";
import type { Form } from "@/services/resources/forms";
import { IconDownload, IconExternalLink } from "@tabler/icons-react";
import { t } from "@/config/i18n";
import { useGetContractFileTemplate } from "@/services/api";
export type FormCardProps = {
form: Form;
};
export function FormCard({ form }: FormCardProps) {
const contractBaseTemplate = useGetContractFileTemplate();
return (
<Paper shadow="xl" p="xl">
<Group justify="start" mb="md">
<Tooltip label={t("download base template to print", { capfirst: true })}>
<ActionIcon
variant={"outline"}
aria-label={t("download base template to print", { capfirst: true })}
onClick={async () => {
await contractBaseTemplate.mutateAsync(form.id);
}}
>
<IconDownload />
</ActionIcon>
</Tooltip>
<Tooltip label={t("fill contract online", { capfirst: true })}>
<ActionIcon
variant={"outline"}
aria-label={t("fill contract online", { capfirst: true })}
component={Link}
to={`/form/${form.id}`}
target="_blank"
rel="noopener noreferrer"
>
<IconExternalLink />
</ActionIcon>
</Tooltip>
</Group>
<Box
component={Link}
to={`/form/${form.id}`}
target="_blank"
rel="noopener noreferrer"
style={{ textDecoration: "none", color: "black" }}
>
<Group justify="space-between" wrap="nowrap">
<Title order={3} textWrap="wrap" lineClamp={1}>
{form.name}
</Title>
<Badge>{form.season}</Badge>
</Group>
<Group justify="space-between">
<Text>{form.productor.name}</Text>
<Text>{form.referer.name}</Text>
</Group>
</Box>
</Paper>
);
}