feat(berths): website auto-promote toggle + manual-override soft-pin priority
- website_berth_autopromote_enabled (default OFF): a website registration for a specific, currently-available berth auto-creates a prospect (client + optional yacht + interest) and links the berth is_specific_interest=true, flipping the public map to Under Offer; general/residence/contact submissions stay capture-only. Marks the submission converted so a rep never double-creates it. - derivePublicStatus now honours a manual pin (soft pin): a manually-set status wins over the interest-derived Under Offer, but a real permanent tenancy or an explicit sold still override it. - berth rules engine respects a manual pin EXCEPT for sale triggers (-> sold), so a confirmed sale still wins but soft auto-changes never stomp a pin. - Reset-to-automatic action (service + API POST /berths/[id]/status/reset + UI) to drop a manual pin; lock badge on every manual override (list + detail); divergence banner prompting reset when a pinned-Available berth has a deal. - migration stage map updated to the §4b signed-off mapping: GQI -> enquiry unless it named a berth/size marker (-> qualified); SQI -> qualified. Tests: +public-berths soft-pin cases, +website-intake-promote helpers, +migration GQI marker rule. 1582 unit/integration green; tsc clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState } from 'react';
|
||||
import { type ColumnDef } from '@tanstack/react-table';
|
||||
import { MoreHorizontal, Pencil, Activity, RefreshCw } from 'lucide-react';
|
||||
import { MoreHorizontal, Pencil, Activity, RefreshCw, Lock } from 'lucide-react';
|
||||
import { useRouter, useParams } from 'next/navigation';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
@@ -150,17 +150,29 @@ function StatusBadge({ status }: { status: string }) {
|
||||
}
|
||||
|
||||
/**
|
||||
* #67 Phase 2: small amber chip beside the status pill flagging rows
|
||||
* whose status was set manually and has no backing interest. These are
|
||||
* the candidates for the catch-up wizard - the rep flipped a berth to
|
||||
* "Under Offer" or "Sold" without ever creating the matching deal.
|
||||
* Chip beside the status pill flagging a manually-pinned status (wins over
|
||||
* automatic derivation). Two variants:
|
||||
* - 'catchup' (amber): manual AND no backing interest - a candidate for the
|
||||
* catch-up wizard (rep flipped to Under Offer/Sold without a matching deal).
|
||||
* - 'pinned' (slate + lock): manual WITH a backing deal - a deliberate pin.
|
||||
*/
|
||||
function ManualBadge() {
|
||||
function ManualBadge({ variant }: { variant: 'catchup' | 'pinned' }) {
|
||||
if (variant === 'catchup') {
|
||||
return (
|
||||
<span
|
||||
className="inline-flex items-center rounded-full border border-amber-300 bg-amber-50 px-1.5 py-0.5 text-xs font-medium uppercase tracking-wide text-amber-800"
|
||||
title="Status set manually with no backing interest - needs catch-up"
|
||||
>
|
||||
Manual
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span
|
||||
className="inline-flex items-center rounded-full border border-amber-300 bg-amber-50 px-1.5 py-0.5 text-xs font-medium uppercase tracking-wide text-amber-800"
|
||||
title="Status set manually with no backing interest - needs catch-up"
|
||||
className="inline-flex items-center gap-1 rounded-full border border-slate-300 bg-slate-100 px-1.5 py-0.5 text-xs font-medium text-slate-700"
|
||||
title="Status pinned manually - wins over automatic derivation"
|
||||
>
|
||||
<Lock className="h-3 w-3" aria-hidden />
|
||||
Manual
|
||||
</span>
|
||||
);
|
||||
@@ -326,11 +338,12 @@ export const berthColumns: ColumnDef<BerthRow, unknown>[] = [
|
||||
header: 'Status',
|
||||
cell: ({ row }) => {
|
||||
const r = row.original;
|
||||
const isManualUnreconciled = r.statusOverrideMode === 'manual' && !r.latestInterestStage;
|
||||
const isManual = r.statusOverrideMode === 'manual';
|
||||
const isManualUnreconciled = isManual && !r.latestInterestStage;
|
||||
return (
|
||||
<div className="inline-flex items-center gap-1.5">
|
||||
<StatusBadge status={r.status} />
|
||||
{isManualUnreconciled ? <ManualBadge /> : null}
|
||||
{isManual ? <ManualBadge variant={isManualUnreconciled ? 'catchup' : 'pinned'} /> : null}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user