|
|
|
|
@@ -58,7 +58,7 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
}, [config.singularLabel, entity, recordId, token]);
|
|
|
|
|
|
|
|
|
|
if (!record) {
|
|
|
|
|
return <div className="rounded-[28px] border border-line/70 bg-surface/90 p-4 text-sm text-muted shadow-panel">{status}</div>;
|
|
|
|
|
return <div className="rounded-[20px] border border-line/70 bg-surface/90 p-4 text-sm text-muted shadow-panel">{status}</div>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateContactEntryField<Key extends keyof CrmContactEntryInput>(key: Key, value: CrmContactEntryInput[Key]) {
|
|
|
|
|
@@ -112,7 +112,7 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<section className="space-y-4">
|
|
|
|
|
<div className="rounded-[28px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<div className="rounded-[20px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<div className="flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between">
|
|
|
|
|
<div>
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-muted">CRM Detail</p>
|
|
|
|
|
@@ -146,7 +146,7 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="grid gap-3 2xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]">
|
|
|
|
|
<article className="min-w-0 rounded-[28px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<article className="min-w-0 rounded-[20px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-muted">Contact</p>
|
|
|
|
|
<dl className="mt-5 grid gap-3 xl:grid-cols-2">
|
|
|
|
|
<div>
|
|
|
|
|
@@ -176,7 +176,7 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
</div>
|
|
|
|
|
</dl>
|
|
|
|
|
</article>
|
|
|
|
|
<article className="min-w-0 rounded-[28px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<article className="min-w-0 rounded-[20px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-muted">Internal Notes</p>
|
|
|
|
|
<p className="mt-3 whitespace-pre-line text-sm leading-6 text-text">
|
|
|
|
|
{record.notes || "No internal notes recorded for this account yet."}
|
|
|
|
|
@@ -219,27 +219,27 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
<section className="grid gap-3 xl:grid-cols-4">
|
|
|
|
|
<article className="rounded-[24px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<article className="rounded-[18px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.18em] text-muted">Last Contact</p>
|
|
|
|
|
<div className="mt-2 text-base font-bold text-text">
|
|
|
|
|
{record.rollups?.lastContactAt ? new Date(record.rollups.lastContactAt).toLocaleDateString() : "None"}
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
<article className="rounded-[24px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<article className="rounded-[18px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.18em] text-muted">Timeline Entries</p>
|
|
|
|
|
<div className="mt-2 text-base font-bold text-text">{record.rollups?.contactHistoryCount ?? record.contactHistory.length}</div>
|
|
|
|
|
</article>
|
|
|
|
|
<article className="rounded-[24px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<article className="rounded-[18px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.18em] text-muted">Account Contacts</p>
|
|
|
|
|
<div className="mt-2 text-base font-bold text-text">{record.rollups?.contactCount ?? record.contacts?.length ?? 0}</div>
|
|
|
|
|
</article>
|
|
|
|
|
<article className="rounded-[24px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<article className="rounded-[18px] border border-line/70 bg-surface/90 px-3 py-3 shadow-panel">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.18em] text-muted">Attachments</p>
|
|
|
|
|
<div className="mt-2 text-base font-bold text-text">{record.rollups?.attachmentCount ?? 0}</div>
|
|
|
|
|
</article>
|
|
|
|
|
</section>
|
|
|
|
|
{entity === "customer" && (record.childCustomers?.length ?? 0) > 0 ? (
|
|
|
|
|
<section className="rounded-[28px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<section className="rounded-[20px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-muted">Hierarchy</p>
|
|
|
|
|
<h4 className="mt-2 text-lg font-bold text-text">End customers under this reseller</h4>
|
|
|
|
|
<div className="mt-5 grid gap-3 xl:grid-cols-2 2xl:grid-cols-3">
|
|
|
|
|
@@ -247,7 +247,7 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
<Link
|
|
|
|
|
key={child.id}
|
|
|
|
|
to={`/crm/customers/${child.id}`}
|
|
|
|
|
className="rounded-3xl border border-line/70 bg-page/60 px-2 py-2 transition hover:border-brand/50 hover:bg-page/80"
|
|
|
|
|
className="rounded-[18px] border border-line/70 bg-page/60 px-2 py-2 transition hover:border-brand/50 hover:bg-page/80"
|
|
|
|
|
>
|
|
|
|
|
<div className="text-sm font-semibold text-text">{child.name}</div>
|
|
|
|
|
<div className="mt-2">
|
|
|
|
|
@@ -259,7 +259,7 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
</section>
|
|
|
|
|
) : null}
|
|
|
|
|
{entity === "vendor" ? (
|
|
|
|
|
<section className="rounded-[28px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<section className="rounded-[20px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<div className="flex items-center justify-between gap-3">
|
|
|
|
|
<div>
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-muted">Purchasing Activity</p>
|
|
|
|
|
@@ -277,11 +277,11 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{relatedPurchaseOrders.length === 0 ? (
|
|
|
|
|
<div className="mt-6 rounded-3xl border border-dashed border-line/70 bg-page/60 px-4 py-8 text-center text-sm text-muted">No purchase orders exist for this vendor yet.</div>
|
|
|
|
|
<div className="mt-6 rounded-[18px] border border-dashed border-line/70 bg-page/60 px-4 py-8 text-center text-sm text-muted">No purchase orders exist for this vendor yet.</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="mt-6 space-y-3">
|
|
|
|
|
{relatedPurchaseOrders.slice(0, 8).map((order) => (
|
|
|
|
|
<Link key={order.id} to={`/purchasing/orders/${order.id}`} className="block rounded-3xl border border-line/70 bg-page/60 p-3 transition hover:bg-page/80">
|
|
|
|
|
<Link key={order.id} to={`/purchasing/orders/${order.id}`} className="block rounded-[18px] border border-line/70 bg-page/60 p-3 transition hover:bg-page/80">
|
|
|
|
|
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
|
|
|
<div>
|
|
|
|
|
<div className="font-semibold text-text">{order.documentNumber}</div>
|
|
|
|
|
@@ -319,7 +319,7 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
/>
|
|
|
|
|
<section className="grid gap-3 2xl:grid-cols-[minmax(360px,0.88fr)_minmax(0,1.12fr)]">
|
|
|
|
|
{canManage ? (
|
|
|
|
|
<article className="min-w-0 rounded-[28px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<article className="min-w-0 rounded-[20px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-muted">Contact History</p>
|
|
|
|
|
<h4 className="mt-2 text-lg font-bold text-text">Add timeline entry</h4>
|
|
|
|
|
<p className="mt-2 text-sm text-muted">
|
|
|
|
|
@@ -336,17 +336,17 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
) : null}
|
|
|
|
|
<article className="min-w-0 rounded-[28px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<article className="min-w-0 rounded-[20px] border border-line/70 bg-surface/90 p-4 shadow-panel 2xl:p-5">
|
|
|
|
|
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-muted">Timeline</p>
|
|
|
|
|
<h4 className="mt-2 text-lg font-bold text-text">Recent interactions</h4>
|
|
|
|
|
{record.contactHistory.length === 0 ? (
|
|
|
|
|
<div className="mt-6 rounded-3xl border border-dashed border-line/70 bg-page/60 px-4 py-8 text-center text-sm text-muted">
|
|
|
|
|
<div className="mt-6 rounded-[18px] border border-dashed border-line/70 bg-page/60 px-4 py-8 text-center text-sm text-muted">
|
|
|
|
|
No contact history has been recorded for this account yet.
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="mt-6 space-y-3">
|
|
|
|
|
{record.contactHistory.map((entry) => (
|
|
|
|
|
<article key={entry.id} className="rounded-3xl border border-line/70 bg-page/60 p-3">
|
|
|
|
|
<article key={entry.id} className="rounded-[18px] border border-line/70 bg-page/60 p-3">
|
|
|
|
|
<div className="flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between">
|
|
|
|
|
<div>
|
|
|
|
|
<div className="flex flex-wrap items-center gap-3">
|
|
|
|
|
@@ -389,3 +389,4 @@ export function CrmDetailPage({ entity }: CrmDetailPageProps) {
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|