Files
pn-new-crm/src/components/residential/residential-interest-card.tsx

52 lines
1.9 KiB
TypeScript
Raw Normal View History

feat(uat-batch): Group I — Residential parity (4 ships) I34–I37 from the 2026-05-21 plan. Shipped: I34 Residential client header layout parity. Email / Call / WhatsApp action buttons mirror the main ClientDetailHeader. WhatsApp number resolves from phoneE164 (preferred) or strips the free-text phone to digits. Header surfaces "Linked to main client" chip when the auto-link matcher (I37) finds a counterpart in the main CRM. I35 Residential interests list rebuilt for parity with the main InterestList. New ResidentialInterestCard + getResidentialInterestColumns + residentialInterestFilter- Definitions; the list page drives DataTable + FilterBar + ColumnPicker + SavedViewsDropdown + bulkActions. List endpoint validator widened to accept pipelineStage as a string OR string[] and added a source filter. Service post- fetches client names via a single IN-list lookup so the table renders fullName in column 1 without N+1. New /api/v1/residential/interests/bulk supports change_stage + archive (100-id cap). Kanban view deferred. I36 Residential inquiries auto-forward to partner email(s). New registry entry residential_partner_recipients (comma- separated) under section residential.partner. createResidentialInterest fires forwardResidentialInquiryToPartner after the row lands. Helper uses the same branded shell other transactional emails use. Failures log + never block create. The /admin/residential-stages page picks up a registry-driven card so admins manage recipients alongside stages. I37 Auto-link residential ↔ main client. Migration 0080 adds residential_clients.linked_client_id (nullable FK, SET NULL on cascade) + partial index. New findAndLinkMatchingMainClient service matches by email first (case-insensitive client_contacts lookup) then by E.164 phone. First exact match wins. Fires fire-and-forget from createResidentialClient. Header surfaces the link via a "Linked to main client" chip. Backfill script + reverse-direction link from main ClientDetailHeader stay as follow-ups. Verified: tsc clean, vitest 1454/1454, migration applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:57:19 +02:00
'use client';
import Link from 'next/link';
import { Badge } from '@/components/ui/badge';
import type { ResidentialInterestRow } from './residential-interest-columns';
import { RESIDENTIAL_STAGE_LABELS } from './residential-interest-filters';
/**
* Mobile / grid card for the residential interests list. Mirrors the
* footprint of <InterestCard> on the main list - same touch target
feat(uat-batch): Group I — Residential parity (4 ships) I34–I37 from the 2026-05-21 plan. Shipped: I34 Residential client header layout parity. Email / Call / WhatsApp action buttons mirror the main ClientDetailHeader. WhatsApp number resolves from phoneE164 (preferred) or strips the free-text phone to digits. Header surfaces "Linked to main client" chip when the auto-link matcher (I37) finds a counterpart in the main CRM. I35 Residential interests list rebuilt for parity with the main InterestList. New ResidentialInterestCard + getResidentialInterestColumns + residentialInterestFilter- Definitions; the list page drives DataTable + FilterBar + ColumnPicker + SavedViewsDropdown + bulkActions. List endpoint validator widened to accept pipelineStage as a string OR string[] and added a source filter. Service post- fetches client names via a single IN-list lookup so the table renders fullName in column 1 without N+1. New /api/v1/residential/interests/bulk supports change_stage + archive (100-id cap). Kanban view deferred. I36 Residential inquiries auto-forward to partner email(s). New registry entry residential_partner_recipients (comma- separated) under section residential.partner. createResidentialInterest fires forwardResidentialInquiryToPartner after the row lands. Helper uses the same branded shell other transactional emails use. Failures log + never block create. The /admin/residential-stages page picks up a registry-driven card so admins manage recipients alongside stages. I37 Auto-link residential ↔ main client. Migration 0080 adds residential_clients.linked_client_id (nullable FK, SET NULL on cascade) + partial index. New findAndLinkMatchingMainClient service matches by email first (case-insensitive client_contacts lookup) then by E.164 phone. First exact match wins. Fires fire-and-forget from createResidentialClient. Header surfaces the link via a "Linked to main client" chip. Backfill script + reverse-direction link from main ClientDetailHeader stay as follow-ups. Verified: tsc clean, vitest 1454/1454, migration applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:57:19 +02:00
* conventions (entire card is clickable, generous padding, truncated
* meta below the title).
*/
export function ResidentialInterestCard({
interest,
portSlug,
}: {
interest: ResidentialInterestRow;
portSlug: string;
}) {
return (
<Link
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
href={`/${portSlug}/residential/interests/${interest.id}` as any}
className="block rounded-lg border bg-card p-3 transition-colors hover:bg-muted/30"
>
<div className="flex items-start justify-between gap-2">
<div className="min-w-0">
<p className="truncate text-sm font-medium">{interest.clientName ?? '-'}</p>
feat(uat-batch): Group I — Residential parity (4 ships) I34–I37 from the 2026-05-21 plan. Shipped: I34 Residential client header layout parity. Email / Call / WhatsApp action buttons mirror the main ClientDetailHeader. WhatsApp number resolves from phoneE164 (preferred) or strips the free-text phone to digits. Header surfaces "Linked to main client" chip when the auto-link matcher (I37) finds a counterpart in the main CRM. I35 Residential interests list rebuilt for parity with the main InterestList. New ResidentialInterestCard + getResidentialInterestColumns + residentialInterestFilter- Definitions; the list page drives DataTable + FilterBar + ColumnPicker + SavedViewsDropdown + bulkActions. List endpoint validator widened to accept pipelineStage as a string OR string[] and added a source filter. Service post- fetches client names via a single IN-list lookup so the table renders fullName in column 1 without N+1. New /api/v1/residential/interests/bulk supports change_stage + archive (100-id cap). Kanban view deferred. I36 Residential inquiries auto-forward to partner email(s). New registry entry residential_partner_recipients (comma- separated) under section residential.partner. createResidentialInterest fires forwardResidentialInquiryToPartner after the row lands. Helper uses the same branded shell other transactional emails use. Failures log + never block create. The /admin/residential-stages page picks up a registry-driven card so admins manage recipients alongside stages. I37 Auto-link residential ↔ main client. Migration 0080 adds residential_clients.linked_client_id (nullable FK, SET NULL on cascade) + partial index. New findAndLinkMatchingMainClient service matches by email first (case-insensitive client_contacts lookup) then by E.164 phone. First exact match wins. Fires fire-and-forget from createResidentialClient. Header surfaces the link via a "Linked to main client" chip. Backfill script + reverse-direction link from main ClientDetailHeader stay as follow-ups. Verified: tsc clean, vitest 1454/1454, migration applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:57:19 +02:00
<div className="mt-1 flex flex-wrap items-center gap-1.5">
chore(audit-drain): rip out next-intl, RTL lint, sweeps, polish Drain the long-tail audit queue captured in alpha-uat-master.md. - next-intl ripped out (zero useTranslations callers ever existed): package.json, next.config.ts plugin wrap, src/i18n/, messages/, and the layout NextIntlClientProvider all gone; <html lang="en"> hardcoded. - RTL lint nudge added: warn-only no-restricted-syntax on physical Tailwind utilities (ml-/mr-/pl-/pr-/text-left/text-right/border-l/ border-r/rounded-l-/rounded-r-) inside JSX className literals. Existing ~1,000 sites grandfathered; new code trends toward logical. - Icon-only button accessibility lint: jsx-a11y/control-has-associated- label enabled at warn; 4 empty <th>/<td> action placeholders gain sr-only labels. - Currency: SUPPORTED_CURRENCIES drops the hardcoded English labels; new currencyLabel(code, locale?) helper resolves via Intl.DisplayNames. CurrencySelect + settings-manager migrated. - Date locale sweep: 7 surfaces flip from toLocaleString('en-GB'|'en-US') to toLocaleString(undefined, ...) so dates honour runtime locale. - Dialog/Sheet width: 10 document/EOI/entity-form dialogs gain a lg:max-w-4xl or lg:max-w-5xl step so wide desktops get breathing room. - PaymentsSection collapsed-bar: slim one-line bar showing "Payments - Not received yet" or "Payments - \$X received - N payments - Expand"; per-interest collapse state persists in localStorage; the RecordPayment flow auto-expands. - muted-foreground opacity sweep: 10 text-bearing text-muted-foreground/{60,70,80} hits dropped to plain text-muted-foreground for AA contrast on muted bg. Icon-only (aria-hidden) opacity hits left as-is. - Micro-type bump: text-[10px] and text-[11px] -> text-xs (12px) across 87 files in src/components + src/app. Pure mechanical sweep. - Audit-doc cleanup: alpha-uat-master.md stale 2026-05-25 summary rewritten with cumulative state through today. Items genuinely still open are now a short long-tail list. - New docs/marketing-site-followups.md: Umami Phase 4a/3/5, email pixel E2E verification, and website-cutover work parked here so they don't get lost in the CRM audit doc. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:48:46 +02:00
<Badge variant="secondary" className="text-xs">
feat(uat-batch): Group I — Residential parity (4 ships) I34–I37 from the 2026-05-21 plan. Shipped: I34 Residential client header layout parity. Email / Call / WhatsApp action buttons mirror the main ClientDetailHeader. WhatsApp number resolves from phoneE164 (preferred) or strips the free-text phone to digits. Header surfaces "Linked to main client" chip when the auto-link matcher (I37) finds a counterpart in the main CRM. I35 Residential interests list rebuilt for parity with the main InterestList. New ResidentialInterestCard + getResidentialInterestColumns + residentialInterestFilter- Definitions; the list page drives DataTable + FilterBar + ColumnPicker + SavedViewsDropdown + bulkActions. List endpoint validator widened to accept pipelineStage as a string OR string[] and added a source filter. Service post- fetches client names via a single IN-list lookup so the table renders fullName in column 1 without N+1. New /api/v1/residential/interests/bulk supports change_stage + archive (100-id cap). Kanban view deferred. I36 Residential inquiries auto-forward to partner email(s). New registry entry residential_partner_recipients (comma- separated) under section residential.partner. createResidentialInterest fires forwardResidentialInquiryToPartner after the row lands. Helper uses the same branded shell other transactional emails use. Failures log + never block create. The /admin/residential-stages page picks up a registry-driven card so admins manage recipients alongside stages. I37 Auto-link residential ↔ main client. Migration 0080 adds residential_clients.linked_client_id (nullable FK, SET NULL on cascade) + partial index. New findAndLinkMatchingMainClient service matches by email first (case-insensitive client_contacts lookup) then by E.164 phone. First exact match wins. Fires fire-and-forget from createResidentialClient. Header surfaces the link via a "Linked to main client" chip. Backfill script + reverse-direction link from main ClientDetailHeader stay as follow-ups. Verified: tsc clean, vitest 1454/1454, migration applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:57:19 +02:00
{RESIDENTIAL_STAGE_LABELS[interest.pipelineStage] ?? interest.pipelineStage}
</Badge>
{interest.source ? (
chore(audit-drain): rip out next-intl, RTL lint, sweeps, polish Drain the long-tail audit queue captured in alpha-uat-master.md. - next-intl ripped out (zero useTranslations callers ever existed): package.json, next.config.ts plugin wrap, src/i18n/, messages/, and the layout NextIntlClientProvider all gone; <html lang="en"> hardcoded. - RTL lint nudge added: warn-only no-restricted-syntax on physical Tailwind utilities (ml-/mr-/pl-/pr-/text-left/text-right/border-l/ border-r/rounded-l-/rounded-r-) inside JSX className literals. Existing ~1,000 sites grandfathered; new code trends toward logical. - Icon-only button accessibility lint: jsx-a11y/control-has-associated- label enabled at warn; 4 empty <th>/<td> action placeholders gain sr-only labels. - Currency: SUPPORTED_CURRENCIES drops the hardcoded English labels; new currencyLabel(code, locale?) helper resolves via Intl.DisplayNames. CurrencySelect + settings-manager migrated. - Date locale sweep: 7 surfaces flip from toLocaleString('en-GB'|'en-US') to toLocaleString(undefined, ...) so dates honour runtime locale. - Dialog/Sheet width: 10 document/EOI/entity-form dialogs gain a lg:max-w-4xl or lg:max-w-5xl step so wide desktops get breathing room. - PaymentsSection collapsed-bar: slim one-line bar showing "Payments - Not received yet" or "Payments - \$X received - N payments - Expand"; per-interest collapse state persists in localStorage; the RecordPayment flow auto-expands. - muted-foreground opacity sweep: 10 text-bearing text-muted-foreground/{60,70,80} hits dropped to plain text-muted-foreground for AA contrast on muted bg. Icon-only (aria-hidden) opacity hits left as-is. - Micro-type bump: text-[10px] and text-[11px] -> text-xs (12px) across 87 files in src/components + src/app. Pure mechanical sweep. - Audit-doc cleanup: alpha-uat-master.md stale 2026-05-25 summary rewritten with cumulative state through today. Items genuinely still open are now a short long-tail list. - New docs/marketing-site-followups.md: Umami Phase 4a/3/5, email pixel E2E verification, and website-cutover work parked here so they don't get lost in the CRM audit doc. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:48:46 +02:00
<span className="text-xs capitalize text-muted-foreground">{interest.source}</span>
feat(uat-batch): Group I — Residential parity (4 ships) I34–I37 from the 2026-05-21 plan. Shipped: I34 Residential client header layout parity. Email / Call / WhatsApp action buttons mirror the main ClientDetailHeader. WhatsApp number resolves from phoneE164 (preferred) or strips the free-text phone to digits. Header surfaces "Linked to main client" chip when the auto-link matcher (I37) finds a counterpart in the main CRM. I35 Residential interests list rebuilt for parity with the main InterestList. New ResidentialInterestCard + getResidentialInterestColumns + residentialInterestFilter- Definitions; the list page drives DataTable + FilterBar + ColumnPicker + SavedViewsDropdown + bulkActions. List endpoint validator widened to accept pipelineStage as a string OR string[] and added a source filter. Service post- fetches client names via a single IN-list lookup so the table renders fullName in column 1 without N+1. New /api/v1/residential/interests/bulk supports change_stage + archive (100-id cap). Kanban view deferred. I36 Residential inquiries auto-forward to partner email(s). New registry entry residential_partner_recipients (comma- separated) under section residential.partner. createResidentialInterest fires forwardResidentialInquiryToPartner after the row lands. Helper uses the same branded shell other transactional emails use. Failures log + never block create. The /admin/residential-stages page picks up a registry-driven card so admins manage recipients alongside stages. I37 Auto-link residential ↔ main client. Migration 0080 adds residential_clients.linked_client_id (nullable FK, SET NULL on cascade) + partial index. New findAndLinkMatchingMainClient service matches by email first (case-insensitive client_contacts lookup) then by E.164 phone. First exact match wins. Fires fire-and-forget from createResidentialClient. Header surfaces the link via a "Linked to main client" chip. Backfill script + reverse-direction link from main ClientDetailHeader stay as follow-ups. Verified: tsc clean, vitest 1454/1454, migration applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:57:19 +02:00
) : null}
</div>
</div>
chore(audit-drain): rip out next-intl, RTL lint, sweeps, polish Drain the long-tail audit queue captured in alpha-uat-master.md. - next-intl ripped out (zero useTranslations callers ever existed): package.json, next.config.ts plugin wrap, src/i18n/, messages/, and the layout NextIntlClientProvider all gone; <html lang="en"> hardcoded. - RTL lint nudge added: warn-only no-restricted-syntax on physical Tailwind utilities (ml-/mr-/pl-/pr-/text-left/text-right/border-l/ border-r/rounded-l-/rounded-r-) inside JSX className literals. Existing ~1,000 sites grandfathered; new code trends toward logical. - Icon-only button accessibility lint: jsx-a11y/control-has-associated- label enabled at warn; 4 empty <th>/<td> action placeholders gain sr-only labels. - Currency: SUPPORTED_CURRENCIES drops the hardcoded English labels; new currencyLabel(code, locale?) helper resolves via Intl.DisplayNames. CurrencySelect + settings-manager migrated. - Date locale sweep: 7 surfaces flip from toLocaleString('en-GB'|'en-US') to toLocaleString(undefined, ...) so dates honour runtime locale. - Dialog/Sheet width: 10 document/EOI/entity-form dialogs gain a lg:max-w-4xl or lg:max-w-5xl step so wide desktops get breathing room. - PaymentsSection collapsed-bar: slim one-line bar showing "Payments - Not received yet" or "Payments - \$X received - N payments - Expand"; per-interest collapse state persists in localStorage; the RecordPayment flow auto-expands. - muted-foreground opacity sweep: 10 text-bearing text-muted-foreground/{60,70,80} hits dropped to plain text-muted-foreground for AA contrast on muted bg. Icon-only (aria-hidden) opacity hits left as-is. - Micro-type bump: text-[10px] and text-[11px] -> text-xs (12px) across 87 files in src/components + src/app. Pure mechanical sweep. - Audit-doc cleanup: alpha-uat-master.md stale 2026-05-25 summary rewritten with cumulative state through today. Items genuinely still open are now a short long-tail list. - New docs/marketing-site-followups.md: Umami Phase 4a/3/5, email pixel E2E verification, and website-cutover work parked here so they don't get lost in the CRM audit doc. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:48:46 +02:00
<span className="shrink-0 text-xs text-muted-foreground">
feat(uat-batch): Group I — Residential parity (4 ships) I34–I37 from the 2026-05-21 plan. Shipped: I34 Residential client header layout parity. Email / Call / WhatsApp action buttons mirror the main ClientDetailHeader. WhatsApp number resolves from phoneE164 (preferred) or strips the free-text phone to digits. Header surfaces "Linked to main client" chip when the auto-link matcher (I37) finds a counterpart in the main CRM. I35 Residential interests list rebuilt for parity with the main InterestList. New ResidentialInterestCard + getResidentialInterestColumns + residentialInterestFilter- Definitions; the list page drives DataTable + FilterBar + ColumnPicker + SavedViewsDropdown + bulkActions. List endpoint validator widened to accept pipelineStage as a string OR string[] and added a source filter. Service post- fetches client names via a single IN-list lookup so the table renders fullName in column 1 without N+1. New /api/v1/residential/interests/bulk supports change_stage + archive (100-id cap). Kanban view deferred. I36 Residential inquiries auto-forward to partner email(s). New registry entry residential_partner_recipients (comma- separated) under section residential.partner. createResidentialInterest fires forwardResidentialInquiryToPartner after the row lands. Helper uses the same branded shell other transactional emails use. Failures log + never block create. The /admin/residential-stages page picks up a registry-driven card so admins manage recipients alongside stages. I37 Auto-link residential ↔ main client. Migration 0080 adds residential_clients.linked_client_id (nullable FK, SET NULL on cascade) + partial index. New findAndLinkMatchingMainClient service matches by email first (case-insensitive client_contacts lookup) then by E.164 phone. First exact match wins. Fires fire-and-forget from createResidentialClient. Header surfaces the link via a "Linked to main client" chip. Backfill script + reverse-direction link from main ClientDetailHeader stay as follow-ups. Verified: tsc clean, vitest 1454/1454, migration applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:57:19 +02:00
{new Date(interest.updatedAt).toLocaleDateString()}
</span>
</div>
{interest.preferences ? (
<p className="mt-1 line-clamp-2 text-xs text-muted-foreground">{interest.preferences}</p>
) : null}
{interest.notes ? (
chore(audit-drain): rip out next-intl, RTL lint, sweeps, polish Drain the long-tail audit queue captured in alpha-uat-master.md. - next-intl ripped out (zero useTranslations callers ever existed): package.json, next.config.ts plugin wrap, src/i18n/, messages/, and the layout NextIntlClientProvider all gone; <html lang="en"> hardcoded. - RTL lint nudge added: warn-only no-restricted-syntax on physical Tailwind utilities (ml-/mr-/pl-/pr-/text-left/text-right/border-l/ border-r/rounded-l-/rounded-r-) inside JSX className literals. Existing ~1,000 sites grandfathered; new code trends toward logical. - Icon-only button accessibility lint: jsx-a11y/control-has-associated- label enabled at warn; 4 empty <th>/<td> action placeholders gain sr-only labels. - Currency: SUPPORTED_CURRENCIES drops the hardcoded English labels; new currencyLabel(code, locale?) helper resolves via Intl.DisplayNames. CurrencySelect + settings-manager migrated. - Date locale sweep: 7 surfaces flip from toLocaleString('en-GB'|'en-US') to toLocaleString(undefined, ...) so dates honour runtime locale. - Dialog/Sheet width: 10 document/EOI/entity-form dialogs gain a lg:max-w-4xl or lg:max-w-5xl step so wide desktops get breathing room. - PaymentsSection collapsed-bar: slim one-line bar showing "Payments - Not received yet" or "Payments - \$X received - N payments - Expand"; per-interest collapse state persists in localStorage; the RecordPayment flow auto-expands. - muted-foreground opacity sweep: 10 text-bearing text-muted-foreground/{60,70,80} hits dropped to plain text-muted-foreground for AA contrast on muted bg. Icon-only (aria-hidden) opacity hits left as-is. - Micro-type bump: text-[10px] and text-[11px] -> text-xs (12px) across 87 files in src/components + src/app. Pure mechanical sweep. - Audit-doc cleanup: alpha-uat-master.md stale 2026-05-25 summary rewritten with cumulative state through today. Items genuinely still open are now a short long-tail list. - New docs/marketing-site-followups.md: Umami Phase 4a/3/5, email pixel E2E verification, and website-cutover work parked here so they don't get lost in the CRM audit doc. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:48:46 +02:00
<p className="mt-1 line-clamp-1 text-xs text-muted-foreground">{interest.notes}</p>
feat(uat-batch): Group I — Residential parity (4 ships) I34–I37 from the 2026-05-21 plan. Shipped: I34 Residential client header layout parity. Email / Call / WhatsApp action buttons mirror the main ClientDetailHeader. WhatsApp number resolves from phoneE164 (preferred) or strips the free-text phone to digits. Header surfaces "Linked to main client" chip when the auto-link matcher (I37) finds a counterpart in the main CRM. I35 Residential interests list rebuilt for parity with the main InterestList. New ResidentialInterestCard + getResidentialInterestColumns + residentialInterestFilter- Definitions; the list page drives DataTable + FilterBar + ColumnPicker + SavedViewsDropdown + bulkActions. List endpoint validator widened to accept pipelineStage as a string OR string[] and added a source filter. Service post- fetches client names via a single IN-list lookup so the table renders fullName in column 1 without N+1. New /api/v1/residential/interests/bulk supports change_stage + archive (100-id cap). Kanban view deferred. I36 Residential inquiries auto-forward to partner email(s). New registry entry residential_partner_recipients (comma- separated) under section residential.partner. createResidentialInterest fires forwardResidentialInquiryToPartner after the row lands. Helper uses the same branded shell other transactional emails use. Failures log + never block create. The /admin/residential-stages page picks up a registry-driven card so admins manage recipients alongside stages. I37 Auto-link residential ↔ main client. Migration 0080 adds residential_clients.linked_client_id (nullable FK, SET NULL on cascade) + partial index. New findAndLinkMatchingMainClient service matches by email first (case-insensitive client_contacts lookup) then by E.164 phone. First exact match wins. Fires fire-and-forget from createResidentialClient. Header surfaces the link via a "Linked to main client" chip. Backfill script + reverse-direction link from main ClientDetailHeader stay as follow-ups. Verified: tsc clean, vitest 1454/1454, migration applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 22:57:19 +02:00
) : null}
</Link>
);
}