This commit is contained in:
phaichayon
2026-06-17 16:04:19 +07:00
parent 5be6c54272
commit 04a886ea26
57 changed files with 6477 additions and 105 deletions

View File

@@ -0,0 +1,40 @@
import { auth } from '@/auth';
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
import PageContainer from '@/components/layout/page-container';
import { ApprovalWorkflowSettings } from '@/features/foundation/approval/components/approval-workflow-settings';
import { approvalWorkflowsQueryOptions } from '@/features/foundation/approval/queries';
import { PERMISSIONS } from '@/lib/auth/rbac';
import { getQueryClient } from '@/lib/query-client';
export default async function ApprovalWorkflowsRoute() {
const session = await auth();
const canRead =
session?.user?.systemRole === 'super_admin' ||
(!!session?.user?.activeOrganizationId &&
(session.user.activeMembershipRole === 'admin' ||
session.user.activePermissions.includes(PERMISSIONS.crmApprovalWorkflowRead)));
const queryClient = getQueryClient();
if (canRead) {
void queryClient.prefetchQuery(approvalWorkflowsQueryOptions());
}
return (
<PageContainer
pageTitle='Approval Workflows'
pageDescription='Configure sequential CRM approval workflows and business-role steps without touching the runtime approval engine.'
access={canRead}
accessFallback={
<div className='text-muted-foreground rounded-lg border border-dashed p-8 text-center'>
You do not have access to CRM approval workflow settings.
</div>
}
>
{canRead ? (
<HydrationBoundary state={dehydrate(queryClient)}>
<ApprovalWorkflowSettings />
</HydrationBoundary>
) : null}
</PageContainer>
);
}