Translating Edit and New base page

This commit is contained in:
2025-05-01 22:43:17 +02:00
parent 0a22bc1b8f
commit 3942c54ad9
2 changed files with 10 additions and 4 deletions

View File

@@ -1,8 +1,10 @@
import { UiSchema } from "@rjsf/utils";
import { useContext } from "react";
import { useForm } from "@refinedev/core";
import { useForm, useTranslation } from "@refinedev/core";
import { CrudForm } from "../../../lib/crud/components/crud-form";
import { FirmContext } from "../../../contexts/FirmContext";
import SaveIcon from "@mui/icons-material/Save";
import { Button } from "@mui/material";
type NewProps = {
resource: string,
@@ -14,6 +16,7 @@ type NewProps = {
const New = <T,>(props: NewProps) => {
const { schemaName, resource, uiSchema, defaultValue } = props;
const { currentFirm } = useContext(FirmContext);
const { translate: t } = useTranslation();
const resourceBasePath = `firm/${currentFirm.instance}/${currentFirm.firm}`
const { onFinish } = useForm({
@@ -29,7 +32,9 @@ const New = <T,>(props: NewProps) => {
resourceBasePath={resourceBasePath}
defaultValue={defaultValue}
onSubmit={(data: any) => onFinish(data)}
/>
>
<Button type='submit' variant="contained" size="large"><SaveIcon />{t("buttons.create")}</Button>
</CrudForm>
)
}