43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
// * Packages
|
|
import { usePage } from "@inertiajs/react";
|
|
import { route } from "ziggy-js";
|
|
// * Other
|
|
import AuthenticatedLayout from "@/back/Layouts/AuthenticatedLayout";
|
|
import Form from "@/back/Pages/DynamicPages/Form";
|
|
import useTrans from "@/hooks/use-translations";
|
|
import { Actions, Methods } from "@/lib/enums";
|
|
import {
|
|
AuthProp,
|
|
DynamicPageModel,
|
|
SingleResource,
|
|
} from "@/back/types/global";
|
|
|
|
export default function Create({ data }: { data: SingleResource }) {
|
|
const { viewAny } = (usePage().props.auth as AuthProp).policies.dynamicPages;
|
|
const dynamicPageModel = data.data as DynamicPageModel;
|
|
return (
|
|
<AuthenticatedLayout
|
|
title={useTrans(
|
|
route().current(`back.dynamic-pages.duplicate`)
|
|
? "crud.helpers.duplication_model"
|
|
: "crud.helpers.creation_model",
|
|
{
|
|
params: {
|
|
model: useTrans("models.classes.dynamic-page", {
|
|
choice: 1,
|
|
}),
|
|
},
|
|
},
|
|
)}
|
|
linkBefore={viewAny ? route("back.dynamic-pages.index") : undefined}
|
|
>
|
|
<Form
|
|
model={dynamicPageModel}
|
|
modelName="dynamic-page"
|
|
modelRoute="dynamic-pages"
|
|
action={Actions.STORE}
|
|
method={Methods.POST}
|
|
/>
|
|
</AuthenticatedLayout>
|
|
);
|
|
}
|