41 lines
994 B
TypeScript
41 lines
994 B
TypeScript
import { FormDialog } from "@repo/shadcn-ui/components/form-dialog";
|
|
import type { ComponentProps } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { TicketInterventionForm } from "./ticket-intervention-form";
|
|
|
|
export function TicketInterventionDialog({
|
|
interventionTicket,
|
|
csrfToken,
|
|
onClose,
|
|
}: {
|
|
interventionTicket: ComponentProps<typeof TicketInterventionForm>["ticket"] | undefined;
|
|
csrfToken: string;
|
|
onClose: () => void;
|
|
}) {
|
|
const { t } = useTranslation("companies");
|
|
|
|
return (
|
|
<FormDialog
|
|
cancelLabel={t("cancel")}
|
|
formActions
|
|
onOpenChange={(value) => {
|
|
if (!value) {
|
|
onClose();
|
|
}
|
|
}}
|
|
open={Boolean(interventionTicket)}
|
|
title={t("interventions.new")}
|
|
wide
|
|
>
|
|
{interventionTicket && (
|
|
<TicketInterventionForm
|
|
csrfToken={csrfToken}
|
|
onSaved={() => onClose()}
|
|
ticket={interventionTicket}
|
|
/>
|
|
)}
|
|
</FormDialog>
|
|
);
|
|
}
|