Translating Edit and New base page
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user