43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { FormDialog } from "@repo/shadcn-ui/components/form-dialog";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { CompanyForm } from "../components/company-form";
|
|
import { PersonForm } from "../components/person-form";
|
|
export function TicketQuickForms({
|
|
kind,
|
|
companyId,
|
|
csrfToken,
|
|
onClose,
|
|
onCompany,
|
|
onPerson,
|
|
}: {
|
|
kind: "company" | "person" | undefined;
|
|
companyId: string;
|
|
csrfToken: string;
|
|
onClose: () => void;
|
|
onCompany: (id: string) => void;
|
|
onPerson: (id: string) => void;
|
|
}) {
|
|
const { t } = useTranslation("companies");
|
|
return (
|
|
<FormDialog
|
|
cancelLabel={t("cancel")}
|
|
formActions
|
|
onOpenChange={(open) => {
|
|
if (!open) {
|
|
onClose();
|
|
}
|
|
}}
|
|
open={Boolean(kind)}
|
|
title={t(kind === "company" ? "newCompany" : "newPerson")}
|
|
>
|
|
{kind === "company" && (
|
|
<CompanyForm csrfToken={csrfToken} onCreated={onCompany} showTitle={false} />
|
|
)}
|
|
{kind === "person" && (
|
|
<PersonForm companyId={companyId} csrfToken={csrfToken} onSaved={onPerson} requireActive />
|
|
)}
|
|
</FormDialog>
|
|
);
|
|
}
|