47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { FormDialog } from "@repo/shadcn-ui/components/form-dialog";
|
|
import type { ComponentProps } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import type { CompanyDTO } from "../../common";
|
|
|
|
import { PrinterConfigurationForm } from "./printer-configuration-form";
|
|
|
|
export function PrinterConfigurationEditorDialog({
|
|
configuration,
|
|
company,
|
|
csrfToken,
|
|
initialProfileId,
|
|
onClose,
|
|
}: {
|
|
configuration: ComponentProps<typeof PrinterConfigurationForm>["configuration"];
|
|
company: CompanyDTO;
|
|
csrfToken: string;
|
|
initialProfileId: ComponentProps<typeof PrinterConfigurationForm>["initialProfileId"];
|
|
onClose: () => void;
|
|
}) {
|
|
const { t } = useTranslation("companies");
|
|
|
|
return (
|
|
<FormDialog
|
|
cancelLabel={t("cancel")}
|
|
formActions
|
|
onOpenChange={(open) => {
|
|
if (!open) {
|
|
onClose();
|
|
}
|
|
}}
|
|
open
|
|
title={t(configuration ? "printers.edit" : "printers.new")}
|
|
wide
|
|
>
|
|
<PrinterConfigurationForm
|
|
company={company}
|
|
configuration={configuration}
|
|
csrfToken={csrfToken}
|
|
initialProfileId={initialProfileId ?? ""}
|
|
onSaved={() => onClose()}
|
|
/>
|
|
</FormDialog>
|
|
);
|
|
}
|