48 lines
2.1 KiB
TypeScript
48 lines
2.1 KiB
TypeScript
import { createElement, lazy } from "react";
|
|
import { hasScope, type AdminSectionsUiCapability, type PlatformWebModule } from "@govoplan/core-webui";
|
|
import { generatedTranslations } from "./i18n/generatedTranslations";
|
|
import "./styles/approvals.css";
|
|
|
|
const ApprovalsPage = lazy(() => import("./features/approvals/ApprovalsPage"));
|
|
const ApprovalTemplatesPanel = lazy(() => import("./features/approvals/ApprovalTemplatesPanel"));
|
|
|
|
const approvalsAdminSections: AdminSectionsUiCapability = {
|
|
sections: [
|
|
{
|
|
id: "tenant-approval-templates",
|
|
moduleId: "approvals",
|
|
kind: "management",
|
|
surfaceId: "approvals.admin.templates",
|
|
label: "Approval templates",
|
|
group: "TENANT",
|
|
order: 55,
|
|
anyOf: ["approvals:workspace:read", "approvals:workspace:admin"],
|
|
render: ({ settings, auth }) => createElement(ApprovalTemplatesPanel, {
|
|
settings,
|
|
canAdmin: hasScope(auth, "approvals:workspace:admin")
|
|
})
|
|
}
|
|
]
|
|
};
|
|
|
|
export const approvalsModule: PlatformWebModule = {
|
|
id: "approvals",
|
|
label: "i18n:govoplan-approvals.approvals",
|
|
version: "0.1.18",
|
|
dependencies: ["access"],
|
|
optionalDependencies: ["workflow_engine", "audit", "files", "notifications", "policy", "tasks"],
|
|
translations: generatedTranslations,
|
|
routes: [{ path: "/approvals", anyOf: ["approvals:workspace:read"], order: 37, surfaceId: "approvals.workspace", render: (context) => createElement(ApprovalsPage, context) }],
|
|
navItems: [{ to: "/approvals", label: "i18n:govoplan-approvals.approvals", iconName: "list-checks", anyOf: ["approvals:workspace:read"], order: 37, surfaceId: "approvals.navigation" }],
|
|
viewSurfaces: [
|
|
{ id: "approvals.navigation", moduleId: "approvals", kind: "navigation", label: "Approvals navigation", order: 10 },
|
|
{ id: "approvals.workspace", moduleId: "approvals", kind: "route", label: "Approval request workspace", order: 20 },
|
|
{ id: "approvals.admin.templates", moduleId: "approvals", kind: "section", label: "Approval templates", order: 30 }
|
|
],
|
|
uiCapabilities: {
|
|
"admin.sections": approvalsAdminSections
|
|
}
|
|
};
|
|
|
|
export default approvalsModule;
|