feat(admin): inquiry inbox, send log, email-template overrides, reports dashboard, recommender keys, role-editor coverage; replace placeholder pages

Closes the bulk of audit-pass-#1 admin gaps in one batch.

New admin pages:
- /admin/inquiries reads website_submissions with filter chips for
  berth/residence/contact + payload viewer per row.
- /admin/sends reads document_sends with sent/failed filter chips and
  expandable body markdown; failures surface errorReason and any
  fallback-to-link reason from the SMTP retry.
- /admin/email-templates lets per-port admins override the subject of
  each transactional template (8 templates catalogued in
  template-catalog.ts). Body editing is a follow-on; portal_activation
  + portal_reset are wired to honor the override via loadSubjectOverride.
- /admin/reports replaces the "Coming in Layer 3" placeholder with a
  KPI dashboard: 4 KPI tiles, pipeline funnel bars, berth occupancy
  donut-bars, conversion %, refresh every 60s.
- backup/import/onboarding admin pages replace placeholders with
  actionable guidance: backup posture + planned features, available CLI
  imports + planned UI, ordered onboarding checklist linking to admin
  pages.

Existing pages widened:
- settings-manager exposes the 9 berth-recommender tunables that were
  previously code-only (recommender_*, heat_weight_*, fallthrough_*,
  tier_ladder_hide_late_stage).
- role-form covers all 19 RolePermissions schema groups; previously
  missing yachts/companies/memberships/reservations + missing
  documents.edit + files.edit checkboxes. snake_case residential
  labels replaced with friendly text.

portal-auth.service.ts now also writes audit_log rows for portal
invite, resend, activate, password-reset request, and reset (closes one
more audit-pass-#2 gap while we were touching the file).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-05-06 14:58:17 +02:00
parent 8cdee99310
commit c90876abad
22 changed files with 1703 additions and 54 deletions

View File

@@ -1,15 +1,114 @@
import Link from 'next/link';
import { PageHeader } from '@/components/shared/page-header';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
interface ChecklistItem {
href: string;
label: string;
description: string;
}
const CHECKLIST: ChecklistItem[] = [
{
href: 'branding',
label: 'Set port name, logo, primary colour',
description: 'Branding flows into the navbar, emails, and EOI PDFs.',
},
{
href: 'email',
label: 'Configure outgoing email',
description:
'From-address, signature, footer, plus per-port SMTP overrides if you don&rsquo;t use the global account.',
},
{
href: 'documenso',
label: 'Connect Documenso for EOIs',
description:
'API credentials and the EOI template id, plus the in-app vs Documenso pathway choice.',
},
{
href: 'settings',
label: 'Tune business rules + recommender weights',
description:
'Pipeline weights, net-10 discount, berth recommender knobs (heat weights, fall-through policy).',
},
{
href: 'roles',
label: 'Create roles &amp; assign users',
description: 'Per-port roles inherit from the global system roles; override permissions here.',
},
{
href: 'invitations',
label: 'Invite the rest of the team',
description:
'Invitations track pending, expired, and accepted state and can be resent or revoked.',
},
{
href: 'tags',
label: 'Define starter tags',
description: 'Color-coded labels used across clients, yachts, companies, and interests.',
},
{
href: 'forms',
label: 'Wire the website intake forms',
description:
'Inquiry forms on the marketing site dual-write into the CRM via /api/public/website-inquiries.',
},
];
export default function OnboardingPage() {
return (
<div className="space-y-6">
<PageHeader title="Onboarding" description="Guided setup for new port configurations" />
<div className="flex flex-col items-center justify-center rounded-lg border border-dashed p-12">
<p className="text-lg font-medium text-muted-foreground">Coming in Layer 4</p>
<p className="text-sm text-muted-foreground">
This feature will be implemented in the next phase.
</p>
</div>
<div>
<PageHeader
title="Port onboarding"
description="Recommended order to bring a new port live. Each step links to the right admin page."
/>
<Card className="mt-6">
<CardHeader>
<CardTitle>Setup checklist</CardTitle>
<CardDescription>
Work through these in order. The future onboarding wizard will track progress per port;
for now this is a guided index.
</CardDescription>
</CardHeader>
<CardContent>
<ol className="space-y-4">
{CHECKLIST.map((item, idx) => (
<li key={item.href} className="flex gap-4">
<span className="flex-none w-7 h-7 rounded-full bg-primary/10 text-primary font-medium text-sm flex items-center justify-center mt-0.5">
{idx + 1}
</span>
<div className="flex-1">
<Link
href={`./${item.href}` as never}
className="text-sm font-medium hover:underline"
>
{item.label}
</Link>
<p className="text-sm text-muted-foreground mt-0.5">{item.description}</p>
</div>
</li>
))}
</ol>
</CardContent>
</Card>
<Card className="mt-4">
<CardHeader>
<CardTitle>What this page will become</CardTitle>
<CardDescription>
A guided wizard that walks per-port admins through the same steps with progress
tracking.
</CardDescription>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">
The wizard will record completion per port in <code>system_settings</code>, gate the
public marketing-site cutover until required steps are done, and surface a banner on the
dashboard when onboarding is incomplete.
</CardContent>
</Card>
</div>
);
}