From cf7f819685c19adfe6443a6bdd10f3afe10b247d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 19 Dec 2022 16:25:09 -0300 Subject: templates --- .../merchant-backoffice-ui/src/InstanceRoutes.tsx | 57 +++++++++++++++++----- 1 file changed, 46 insertions(+), 11 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/InstanceRoutes.tsx') diff --git a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx index adfc73e20..817de5f7b 100644 --- a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx +++ b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx @@ -43,6 +43,9 @@ import ProductListPage from "./paths/instance/products/list/index.js"; import ProductUpdatePage from "./paths/instance/products/update/index.js"; import TransferListPage from "./paths/instance/transfers/list/index.js"; import TransferCreatePage from "./paths/instance/transfers/create/index.js"; +import TemplateListPage from "./paths/instance/templates/list/index.js"; +import TemplateUpdatePage from "./paths/instance/templates/update/index.js"; +import TemplateCreatePage from "./paths/instance/templates/create/index.js"; import ReservesCreatePage from "./paths/instance/reserves/create/index.js"; import ReservesDetailsPage from "./paths/instance/reserves/details/index.js"; import ReservesListPage from "./paths/instance/reserves/list/index.js"; @@ -78,6 +81,10 @@ export enum InstancePaths { transfers_list = "/transfers", transfers_new = "/transfer/new", + + templates_list = "/templates", + templates_update = "/templates/:tid/update", + templates_new = "/templates/new", } // eslint-disable-next-line @typescript-eslint/no-empty-function @@ -217,7 +224,6 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { }} > - {/** * Admin pages */} @@ -236,7 +242,6 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { onLoadError={ServerErrorRedirectTo(InstancePaths.error)} /> )} - {admin && ( )} - {admin && ( )} - {/** * Update instance page */} @@ -279,7 +282,6 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { onUnauthorized={LoginPageAccessDenied} onLoadError={ServerErrorRedirectTo(InstancePaths.error)} /> - {/** * Product pages */} @@ -319,7 +321,6 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { route(InstancePaths.product_list); }} /> - {/** * Order pages */} @@ -356,7 +357,6 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { route(InstancePaths.order_list); }} /> - {/** * Transfer pages */} @@ -370,7 +370,6 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { route(InstancePaths.transfers_new); }} /> - + {/** + * Templates pages + */} + { + route(InstancePaths.templates_new); + }} + onSelect={(id: string) => { + route(InstancePaths.templates_update.replace(":tid", id)); + }} + /> + { + route(InstancePaths.templates_list); + }} + onUnauthorized={LoginPageAccessDenied} + onLoadError={ServerErrorRedirectTo(InstancePaths.templates_list)} + onNotFound={IfAdminCreateDefaultOr(NotFoundPage)} + onBack={() => { + route(InstancePaths.templates_list); + }} + /> + { + route(InstancePaths.templates_list); + }} + onBack={() => { + route(InstancePaths.templates_list); + }} + /> {/** * reserves pages @@ -398,7 +436,6 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { route(InstancePaths.reserves_new); }} /> - - - {/** * Example pages -- cgit v1.2.3