task-d complate

This commit is contained in:
phaichayon
2026-06-15 13:46:33 +07:00
parent 8148850fda
commit 1d2406483e
32 changed files with 4812 additions and 39 deletions

View File

@@ -77,6 +77,15 @@ export interface CustomerActivityRecord {
actorName: string | null;
}
export interface CustomerRelatedEnquiryItem {
id: string;
code: string;
title: string;
status: string;
productType: string;
updatedAt: string;
}
export interface CustomerReferenceData {
branches: BranchOption[];
customerTypes: CustomerOption[];

View File

@@ -14,6 +14,7 @@ import type { CustomerReferenceData } from '../api/types';
import { CustomerFormSheet } from './customer-form-sheet';
import { CustomerContactsTab } from './customer-contacts-tab';
import { CustomerStatusBadge } from './customer-status-badge';
import type { CustomerRelatedEnquiryItem } from '../api/types';
function FieldItem({ label, value }: { label: string; value: string | null | undefined }) {
return (
@@ -28,7 +29,8 @@ export function CustomerDetail({
customerId,
referenceData,
canUpdate,
canManageContacts
canManageContacts,
relatedEnquiries
}: {
customerId: string;
referenceData: CustomerReferenceData;
@@ -38,6 +40,7 @@ export function CustomerDetail({
update: boolean;
delete: boolean;
};
relatedEnquiries: CustomerRelatedEnquiryItem[];
}) {
const { data } = useSuspenseQuery(customerByIdOptions(customerId));
const [editOpen, setEditOpen] = useState(false);
@@ -212,14 +215,36 @@ export function CustomerDetail({
<CardHeader>
<CardTitle>Related Documents</CardTitle>
<CardDescription>
Task C stops at customer and contact scope, so downstream CRM documents stay
intentionally deferred.
Production enquiry links are now visible here, while quotation and approval
modules stay deferred.
</CardDescription>
</CardHeader>
<CardContent>
<div className='text-muted-foreground rounded-lg border border-dashed p-8 text-center text-sm'>
Enquiry, quotation, and approval links will land here in Task D and later.
</div>
{!relatedEnquiries.length ? (
<div className='text-muted-foreground rounded-lg border border-dashed p-8 text-center text-sm'>
No enquiries have been linked to this customer yet.
</div>
) : (
<div className='space-y-3'>
{relatedEnquiries.map((enquiry) => (
<Link
key={enquiry.id}
href={`/dashboard/crm/enquiries/${enquiry.id}`}
className='block rounded-lg border p-4 transition-colors hover:bg-muted/40'
>
<div className='flex items-center justify-between gap-3'>
<div className='space-y-1'>
<div className='font-medium'>{enquiry.title}</div>
<div className='text-muted-foreground font-mono text-xs'>
{enquiry.code}
</div>
</div>
<Icons.arrowRight className='text-muted-foreground h-4 w-4' />
</div>
</Link>
))}
</div>
)}
</CardContent>
</Card>
</TabsContent>