init
This commit is contained in:
26
src/app/dashboard/crm/approvals/page.tsx
Normal file
26
src/app/dashboard/crm/approvals/page.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { approvalsQueryOptions, crmReferenceQueryOptions } from '@/features/crm/api/queries';
|
||||
import { ApprovalsPage } from '@/features/crm/components/approvals-page';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Dashboard: CRM Approvals'
|
||||
};
|
||||
|
||||
export default function ApprovalsRoute() {
|
||||
const queryClient = getQueryClient();
|
||||
void queryClient.prefetchQuery(crmReferenceQueryOptions());
|
||||
void queryClient.prefetchQuery(approvalsQueryOptions({ page: 1, limit: 10 }));
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Approvals'
|
||||
pageDescription='Pending approval list, approver level, branch, amount และ approve/reject dialog'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<ApprovalsPage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
24
src/app/dashboard/crm/customers/[id]/page.tsx
Normal file
24
src/app/dashboard/crm/customers/[id]/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
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';
|
||||
|
||||
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'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<CustomerDetailPage id={id} />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
49
src/app/dashboard/crm/customers/page.tsx
Normal file
49
src/app/dashboard/crm/customers/page.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
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';
|
||||
|
||||
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 })
|
||||
})
|
||||
);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Customers'
|
||||
pageDescription='Customer master พร้อม status, branch, contacts และ drawer สำหรับ create/edit'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<CustomersTablePage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
24
src/app/dashboard/crm/enquiries/[id]/page.tsx
Normal file
24
src/app/dashboard/crm/enquiries/[id]/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { enquiryByIdOptions } from '@/features/crm/api/queries';
|
||||
import { EnquiryDetailPage } from '@/features/crm/components/enquiry-detail';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
|
||||
type PageProps = { params: Promise<{ id: string }> };
|
||||
|
||||
export default async function EnquiryDetailRoute({ params }: PageProps) {
|
||||
const { id } = await params;
|
||||
const queryClient = getQueryClient();
|
||||
void queryClient.prefetchQuery(enquiryByIdOptions(id));
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Enquiry Detail'
|
||||
pageDescription='Header summary, customer/contact, requirement summary, timeline, and related quotations'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<EnquiryDetailPage id={id} />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
55
src/app/dashboard/crm/enquiries/page.tsx
Normal file
55
src/app/dashboard/crm/enquiries/page.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import type { SearchParams } from 'nuqs/server';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { crmReferenceQueryOptions, enquiriesQueryOptions } from '@/features/crm/api/queries';
|
||||
import { EnquiriesTablePage } from '@/features/crm/components/enquiries-table';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
import { searchParamsCache } from '@/lib/searchparams';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Dashboard: CRM Enquiries'
|
||||
};
|
||||
|
||||
export default async function EnquiriesRoute({
|
||||
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('status');
|
||||
const productType = searchParamsCache.get('productType');
|
||||
const salesman = searchParamsCache.get('salesman');
|
||||
const dateFrom = searchParamsCache.get('dateFrom');
|
||||
const dateTo = searchParamsCache.get('dateTo');
|
||||
const sort = searchParamsCache.get('sort');
|
||||
const queryClient = getQueryClient();
|
||||
|
||||
void queryClient.prefetchQuery(crmReferenceQueryOptions());
|
||||
void queryClient.prefetchQuery(
|
||||
enquiriesQueryOptions({
|
||||
page,
|
||||
limit: perPage,
|
||||
...(search && { search }),
|
||||
...(status && { status }),
|
||||
...(productType && { productType }),
|
||||
...(salesman && { salesman }),
|
||||
...(dateFrom && { dateFrom }),
|
||||
...(dateTo && { dateTo }),
|
||||
...(sort && { sort })
|
||||
})
|
||||
);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Enquiries'
|
||||
pageDescription='List ของ sales opportunity พร้อม filter, date range และ convert to quotation'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<EnquiriesTablePage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
25
src/app/dashboard/crm/page.tsx
Normal file
25
src/app/dashboard/crm/page.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
import { crmDashboardQueryOptions } from '@/features/crm/api/queries';
|
||||
import { CrmDashboardPage } from '@/features/crm/components/crm-dashboard';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Dashboard: CRM'
|
||||
};
|
||||
|
||||
export default function CrmDashboardRoute() {
|
||||
const queryClient = getQueryClient();
|
||||
void queryClient.prefetchQuery(crmDashboardQueryOptions());
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='CRM Dashboard'
|
||||
pageDescription='ภาพรวม workflow ของ Customer → Enquiry → Quotation → Approval → Won/Lost'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<CrmDashboardPage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
24
src/app/dashboard/crm/quotations/[id]/page.tsx
Normal file
24
src/app/dashboard/crm/quotations/[id]/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { quotationByIdOptions } from '@/features/crm/api/queries';
|
||||
import { QuotationDetailPage } from '@/features/crm/components/quotation-detail';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
|
||||
type PageProps = { params: Promise<{ id: string }> };
|
||||
|
||||
export default async function QuotationDetailRoute({ params }: PageProps) {
|
||||
const { id } = await params;
|
||||
const queryClient = getQueryClient();
|
||||
void queryClient.prefetchQuery(quotationByIdOptions(id));
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Quotation Detail'
|
||||
pageDescription='Header, status, revision, customer roles, item table, approval timeline, and preview panel'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<QuotationDetailPage id={id} />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
57
src/app/dashboard/crm/quotations/page.tsx
Normal file
57
src/app/dashboard/crm/quotations/page.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import type { SearchParams } from 'nuqs/server';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { crmReferenceQueryOptions, quotationsQueryOptions } from '@/features/crm/api/queries';
|
||||
import { QuotationsTablePage } from '@/features/crm/components/quotations-table';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
import { searchParamsCache } from '@/lib/searchparams';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Dashboard: CRM Quotations'
|
||||
};
|
||||
|
||||
export default async function QuotationsRoute({
|
||||
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('status');
|
||||
const quotationType = searchParamsCache.get('quotationType');
|
||||
const salesman = searchParamsCache.get('salesman');
|
||||
const hot = searchParamsCache.get('hot');
|
||||
const dateFrom = searchParamsCache.get('dateFrom');
|
||||
const dateTo = searchParamsCache.get('dateTo');
|
||||
const sort = searchParamsCache.get('sort');
|
||||
const queryClient = getQueryClient();
|
||||
|
||||
void queryClient.prefetchQuery(crmReferenceQueryOptions());
|
||||
void queryClient.prefetchQuery(
|
||||
quotationsQueryOptions({
|
||||
page,
|
||||
limit: perPage,
|
||||
...(search && { search }),
|
||||
...(status && { status }),
|
||||
...(quotationType && { quotationType }),
|
||||
...(salesman && { salesman }),
|
||||
...(hot && { hot }),
|
||||
...(dateFrom && { dateFrom }),
|
||||
...(dateTo && { dateTo }),
|
||||
...(sort && { sort })
|
||||
})
|
||||
);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Quotations'
|
||||
pageDescription='Quotation table with filters, hot project indicator, and kanban toggle'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<QuotationsTablePage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
21
src/app/dashboard/crm/settings/document-sequences/page.tsx
Normal file
21
src/app/dashboard/crm/settings/document-sequences/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { crmReferenceQueryOptions } from '@/features/crm/api/queries';
|
||||
import { DocumentSequencesPage } from '@/features/crm/components/settings-page';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
|
||||
export default function DocumentSequencesRoute() {
|
||||
const queryClient = getQueryClient();
|
||||
void queryClient.prefetchQuery(crmReferenceQueryOptions());
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Document Sequences'
|
||||
pageDescription='Mock document sequence แยกตาม branch และ document type'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<DocumentSequencesPage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
21
src/app/dashboard/crm/settings/master-options/page.tsx
Normal file
21
src/app/dashboard/crm/settings/master-options/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { crmReferenceQueryOptions } from '@/features/crm/api/queries';
|
||||
import { MasterOptionsPage } from '@/features/crm/components/settings-page';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
|
||||
export default function MasterOptionsRoute() {
|
||||
const queryClient = getQueryClient();
|
||||
void queryClient.prefetchQuery(crmReferenceQueryOptions());
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Master Options'
|
||||
pageDescription='Mock UI สำหรับ status options, product types, payment term, currency และ tax rate'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<MasterOptionsPage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
21
src/app/dashboard/crm/settings/templates/page.tsx
Normal file
21
src/app/dashboard/crm/settings/templates/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { crmReferenceQueryOptions } from '@/features/crm/api/queries';
|
||||
import { TemplatesPage } from '@/features/crm/components/settings-page';
|
||||
import { getQueryClient } from '@/lib/query-client';
|
||||
|
||||
export default function TemplatesRoute() {
|
||||
const queryClient = getQueryClient();
|
||||
void queryClient.prefetchQuery(crmReferenceQueryOptions());
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
pageTitle='Quotation Templates'
|
||||
pageDescription='Mock quotation template, version และ placeholder mappings สำหรับต่อยอด PDF preview'
|
||||
>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<TemplatesPage />
|
||||
</HydrationBoundary>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user