28 lines
764 B
TypeScript
28 lines
764 B
TypeScript
import { FormDialog } from "@repo/shadcn-ui/components/form-dialog";
|
|
import type { ComponentProps } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { DepartmentForm } from "./department-form";
|
|
|
|
export function DepartmentEditorDialog({
|
|
open,
|
|
onOpenChange,
|
|
...formProps
|
|
}: ComponentProps<typeof DepartmentForm> & {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
}) {
|
|
const { t } = useTranslation("companies");
|
|
return (
|
|
<FormDialog
|
|
cancelLabel={t("cancel")}
|
|
formActions
|
|
onOpenChange={onOpenChange}
|
|
open={open}
|
|
title={t(formProps.department ? "editDepartment" : "newDepartment")}
|
|
>
|
|
<DepartmentForm {...formProps} key={formProps.department?.id ?? "new"} />
|
|
</FormDialog>
|
|
);
|
|
}
|