task-b.1
complere
This commit is contained in:
phaichayon
2026-06-15 11:19:31 +07:00
parent 89b39cad38
commit b8cd39eaa4
55 changed files with 4295 additions and 1848 deletions

View File

@@ -1,24 +1,30 @@
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
import PageContainer from '@/components/layout/page-container';
import { customerByIdOptions } from '@/features/crm/api/queries';
import { CustomerDetailPage } from '@/features/crm/components/customer-detail';
import { getQueryClient } from '@/lib/query-client';
import { CrmProductionPlaceholder } from '@/features/foundation/components/crm-production-placeholder';
type PageProps = { params: Promise<{ id: string }> };
type PageProps = {
params: Promise<{ id: string }>;
};
export default async function CustomerDetailRoute({ params }: PageProps) {
const { id } = await params;
const queryClient = getQueryClient();
void queryClient.prefetchQuery(customerByIdOptions(id));
return (
<PageContainer
pageTitle='Customer Detail'
pageDescription='Overview, contacts, shared contacts, enquiries, quotations, and activity log'
pageDescription={`Production detail route placeholder for customer ${id}.`}
>
<HydrationBoundary state={dehydrate(queryClient)}>
<CustomerDetailPage id={id} />
</HydrationBoundary>
<CrmProductionPlaceholder
title='Customer detail pending'
summary='This detail route is intentionally isolated from legacy demo state until the production Customer module is implemented.'
foundationItems={[
'Current organization context',
'Permission checks',
'Branch validation abstraction',
'Audit log helper'
]}
nextStep='Implement customer detail using real customer, contact, enquiry, and audit data from production APIs.'
demoHref={`/dashboard/crm-demo/customers/${id}`}
/>
</PageContainer>
);
}

View File

@@ -1,49 +1,29 @@
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
import type { SearchParams } from 'nuqs/server';
import PageContainer from '@/components/layout/page-container';
import { crmReferenceQueryOptions, customersQueryOptions } from '@/features/crm/api/queries';
import { CustomersTablePage } from '@/features/crm/components/customers-table';
import { getQueryClient } from '@/lib/query-client';
import { searchParamsCache } from '@/lib/searchparams';
import { CrmProductionPlaceholder } from '@/features/foundation/components/crm-production-placeholder';
export const metadata = {
title: 'Dashboard: CRM Customers'
};
export default async function CustomersRoute({
searchParams
}: {
searchParams: Promise<SearchParams>;
}) {
searchParamsCache.parse(await searchParams);
const page = searchParamsCache.get('page');
const perPage = searchParamsCache.get('perPage');
const search = searchParamsCache.get('name');
const status = searchParamsCache.get('customerStatus');
const branch = searchParamsCache.get('branch');
const sort = searchParamsCache.get('sort');
const queryClient = getQueryClient();
void queryClient.prefetchQuery(crmReferenceQueryOptions());
void queryClient.prefetchQuery(
customersQueryOptions({
page,
limit: perPage,
...(search && { search }),
...(status && { status }),
...(branch && { branch }),
...(sort && { sort })
})
);
export default function CustomersRoute() {
return (
<PageContainer
pageTitle='Customers'
pageDescription='Customer master พร้อม status, branch, contacts และ drawer สำหรับ create/edit'
pageDescription='Production customer CRUD has not started yet. This route is reserved for the Task C implementation path.'
>
<HydrationBoundary state={dehydrate(queryClient)}>
<CustomersTablePage />
</HydrationBoundary>
<CrmProductionPlaceholder
title='Customer module pending'
summary='The old customer list and form flow has been moved to the demo path so this route no longer depends on mock services.'
foundationItems={[
'Organization-first access boundary',
'Customer status options from master options',
'Branch scope abstraction for customer ownership',
'Document code generation for customer records',
'Audit hooks for future mutations'
]}
nextStep='Implement Customer list, detail, and create/edit flows with real route handlers and persistence.'
demoHref='/dashboard/crm-demo/customers'
/>
</PageContainer>
);
}