This commit is contained in:
phaichayon
2026-06-15 16:34:41 +07:00
parent 1d2406483e
commit eae0dee1f2
40 changed files with 9982 additions and 132 deletions

View File

@@ -15,6 +15,7 @@ import { CustomerFormSheet } from './customer-form-sheet';
import { CustomerContactsTab } from './customer-contacts-tab';
import { CustomerStatusBadge } from './customer-status-badge';
import type { CustomerRelatedEnquiryItem } from '../api/types';
import type { QuotationRelationItem } from '@/features/crm/quotations/api/types';
function FieldItem({ label, value }: { label: string; value: string | null | undefined }) {
return (
@@ -30,7 +31,8 @@ export function CustomerDetail({
referenceData,
canUpdate,
canManageContacts,
relatedEnquiries
relatedEnquiries,
relatedQuotations
}: {
customerId: string;
referenceData: CustomerReferenceData;
@@ -41,6 +43,7 @@ export function CustomerDetail({
delete: boolean;
};
relatedEnquiries: CustomerRelatedEnquiryItem[];
relatedQuotations: QuotationRelationItem[];
}) {
const { data } = useSuspenseQuery(customerByIdOptions(customerId));
const [editOpen, setEditOpen] = useState(false);
@@ -215,14 +218,13 @@ export function CustomerDetail({
<CardHeader>
<CardTitle>Related Documents</CardTitle>
<CardDescription>
Production enquiry links are now visible here, while quotation and approval
modules stay deferred.
Production enquiry and quotation links for this customer.
</CardDescription>
</CardHeader>
<CardContent>
{!relatedEnquiries.length ? (
{!relatedEnquiries.length && !relatedQuotations.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.
No enquiries or quotations have been linked to this customer yet.
</div>
) : (
<div className='space-y-3'>
@@ -243,6 +245,23 @@ export function CustomerDetail({
</div>
</Link>
))}
{relatedQuotations.map((quotation) => (
<Link
key={quotation.id}
href={`/dashboard/crm/quotations/${quotation.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'>{quotation.code}</div>
<div className='text-muted-foreground text-xs'>
{quotation.totalAmount.toLocaleString()}
</div>
</div>
<Icons.arrowRight className='text-muted-foreground h-4 w-4' />
</div>
</Link>
))}
</div>
)}
</CardContent>