feat(crm): frontend code — pages + services + components

Brings in the full frontend CRM stack: admin authoring pages,
customer-portal surfaces, public response flows, typed services,
and the supporting component library. i18n locale JSON is the next
commit (kept separate so reviewers can read it as data).

Pages
  - Quotes: list / editor / detail / public accept-decline
  - Invoices: list / editor / detail / public payment-check
  - Contracts: list / editor / detail / block library / public sign
  - Calendar (FullCalendar — admin-only v1)
  - Tax report (period picker + CSV/PDF export)
  - Hours (logged time entries, per-customer)
  - Deals lineage (DocumentLineageCard surfaces)
  - CRM Development (admin dev tools, gated by crmDevelopment flag)
  - Customer-portal pages for quotes / invoices / contracts
  - Settings reorg: CRM-Settings group + dedicated tabs for Business
    Profile, CRM behaviour, Contracts block library, Reminder emails
  - BrandingPage typography (PDF font picker)
  - EventDetailsPage / CustomerDetailPage / CreateEventPage extensions
    (event-time fields, hours toggle, per-event reminder override)

Services (typed)
  - quotes.service, bills.service, contracts.service
  - customerAdmin.service, deals.service, calendar.service,
    taxReport.service, contracts-blocks.service
  - businessProfile.service (timezone, font picker, bank accounts)
  - useInstallmentDefaults hook, useLocalizedDate dateInputLang extension

Components (admin)
  - CustomerPicker (shared across quote/invoice/contract editors)
  - LineItemsTable (hierarchy + details_text, memoised pricing)
  - InstallmentsPanel (simple + advanced toggle, fixed-date vs trigger)
  - DocumentLineageCard (deal_uuid grouped view)
  - EditInstallmentPlanModal (atomic post-spawn plan reshape)
  - EventReminderOverrideCard, EmailTemplateEditor (tiptap),
    PdfFontPicker, IntegrityCheckCard
  - Feature-flag context + RequireFeature wrapper + AdminSidebar
    featureFlagsAny derivation + UI-hiding sweep

Build infra
  - vite.config: fullcalendar chunk carved off (~200 KB lazy-loaded)
  - frontend/package.json: tiptap, fullcalendar, signature_pad,
    react-international-phone, et al.
  - tailwind + prose styles updated for editor surfaces

3-way merge note: 1 conflict (CustomerDetailPage.tsx) hand-resolved
to keep upstream's SUPPORTED_LANGUAGES.map() data-driven pattern
over feat/crm's hardcoded option list; feat/crm's DecimalInput
import preserved alongside.
This commit is contained in:
Luca
2026-05-26 18:19:32 +02:00
parent d543949188
commit a7e16e7bf6
96 changed files with 18370 additions and 572 deletions
+46
View File
@@ -0,0 +1,46 @@
/**
* Admin → Dev tools API client. Gated server-side by the
* `crmDevelopment` feature flag; the frontend additionally hides
* the page when the flag is off, but the API check is what
* actually enforces the gate.
*/
import { api } from '../config/api';
export type CrmEmailTemplateKey =
| 'quote_sent'
| 'quote_accepted_customer'
| 'quote_accepted_admin'
| 'quote_declined_admin'
| 'invoice_sent'
| 'invoice_reminder_first'
| 'invoice_reminder_second'
| 'invoice_payment_check_admin'
// Contracts (migration 130). Backend exposes all three flows via the
// dev tester (admin → customer send, customer-signed ping, dual-party
// fully-signed). Without these in the union, useQuery returns rows
// whose `key` doesn't resolve to a label and they render as raw
// template_key strings.
| 'contract_sent'
| 'contract_signed_admin_notification'
| 'contract_fully_signed';
export interface DevEmailTemplateStatus {
key: CrmEmailTemplateKey;
present: boolean;
}
export const devToolsService = {
async listEmailTemplates(): Promise<DevEmailTemplateStatus[]> {
const { data } = await api.get('/admin/dev/email-templates');
return (data.data || data).templates;
},
async sendTestEmail(templateKey: CrmEmailTemplateKey): Promise<{
sent: true;
to: string;
template: CrmEmailTemplateKey;
}> {
const { data } = await api.post('/admin/dev/send-test-email', { templateKey });
return data.data || data;
},
};