task-j1
This commit is contained in:
@@ -1,23 +1,40 @@
|
||||
import { auth } from '@/auth';
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { CrmProductionPlaceholder } from '@/features/foundation/components/crm-production-placeholder';
|
||||
import { DocumentSequenceSettings } from '@/features/foundation/document-sequence/components/document-sequence-settings';
|
||||
import { documentSequencesQueryOptions } from '@/features/foundation/document-sequence/queries';
|
||||
import { PERMISSIONS } from '@/lib/auth/rbac';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
|
||||
export default async function DocumentSequencesRoute() {
|
||||
const session = await auth();
|
||||
const canRead =
|
||||
session?.user?.systemRole === 'super_admin' ||
|
||||
(!!session?.user?.activeOrganizationId &&
|
||||
(session.user.activeMembershipRole === 'admin' ||
|
||||
session.user.activePermissions.includes(PERMISSIONS.crmDocumentSequenceRead)));
|
||||
const queryClient = getQueryClient();
|
||||
|
||||
if (canRead) {
|
||||
void queryClient.prefetchQuery(documentSequencesQueryOptions());
|
||||
}
|
||||
|
||||
export default function DocumentSequencesRoute() {
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Document Sequences'
|
||||
pageDescription='The sequence foundation is ready, but a production management UI has not been introduced yet.'
|
||||
pageDescription='Manage organization-scoped running numbers, prefixes, and branch-aware sequence resets.'
|
||||
access={canRead}
|
||||
accessFallback={
|
||||
<div className='text-muted-foreground rounded-lg border border-dashed p-8 text-center'>
|
||||
You do not have access to CRM document sequences.
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<CrmProductionPlaceholder
|
||||
title='Document sequence UI pending'
|
||||
summary='Sequence generation now exists in the foundation layer, but the old mock settings page has been isolated to the demo route.'
|
||||
foundationItems={[
|
||||
'Preview and generate sequence helpers',
|
||||
'Organization-scoped sequence table',
|
||||
'Branch-aware sequence support'
|
||||
]}
|
||||
nextStep='Add a production management page only when the product requires editable sequence settings.'
|
||||
demoHref='/dashboard/crm-demo/settings/document-sequences'
|
||||
/>
|
||||
{canRead ? (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<DocumentSequenceSettings />
|
||||
</HydrationBoundary>
|
||||
) : null}
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user