# Milestones ## v2.0 Business Operations Suite (Phases 7–10, completato 2026-06-13) **Phases completed:** 4 phases (7–10) **Key accomplishments:** - Catalogo servizi unificato (tabella `services`) usato dal quote builder admin — legacy `service_catalog`/`offer_services` ancora presenti, consolidamento finale rinviato a v2.1 (Phase 7) - Offerte con fasi ordinate (`offer_phases`/`offer_phase_services`) e builder preventivo admin (Phase 8) - Preventivo pubblico `/quote/[token]`: stati draft→sent→viewed→accepted/rejected, `accepted_at` immutabile, raccolta email/note cliente (Phase 9) - CRM pipeline lead: CRUD, activity log, reminder follow-up in dashboard (Phase 10, redeployed 2026-06-11 dopo fix migrazioni prod mancanti 0001-0005) - Ex-Phase 11 (auto-provisioning al "Vinto") ed ex-Phase 12 (email Resend) non eseguite come pianificate — assorbite nel piano v2.1 "Proposal AI" --- ## v1.0 Client Portal & Offer System (Shipped: 2026-06-10) **Phases completed:** 6 phases, 24 plans, 29 tasks **Key accomplishments:** - Next.js 16.2.6 App Router con TypeScript strict, Tailwind v4, Drizzle ORM + postgres-js per Coolify Postgres, e 10 componenti shadcn/ui installati e pronti. - Schema Drizzle ORM completo con 10 tabelle, migration SQL generata e schema live sul database Postgres 16 (Hetzner/Coolify). TypeScript strict compila senza errori. - Edge proxy con validazione token, ClientView type system che esclude quote_items, e Server Component che fetcha tutti i dati cliente senza esporre segreti admin. Build Next.js 16 senza errori TypeScript. - Tutti i componenti UI della dashboard cliente renderizzati come Server Components con design light & clean in Tailwind v4: header con logo iamcavalli + brand name cliente, progress bar globale, timeline laterale delle fasi con barre per fase e task list, sezione pagamenti con badge stato (zero importi singoli), link documenti esterni e log note read-only. - Task 1: scripts/seed.ts - 1. [Rule 1 - Bug] Next.js 16 proxy export name is 'proxy', not 'middleware' - Admin home shows all clients with Acconto/Saldo payment badges; new client form inserts client row + two payment stubs via Zod-validated Server Action with nanoid token auto-generation - Full-featured admin client workspace with Radix Tabs covering phases/tasks, payments, documents, and comments — all mutations via inline Server Actions with server-side validation. - Client-facing approval and comment API routes with token validation, ownership verification, approved_at immutability enforcement, and inline ApproveButton/CommentForm/CommentList wired into the Phase 1 dashboard via PhaseTimeline. - Added `custom_label text` column and made `service_id` nullable in `quote_items` via Drizzle schema edit + Neon DDL push — unblocking Wave 2 free-form quote items - Vertical slice completo `/admin/catalog`: NavBar link + pagina catalogo + tabella con edit inline + form aggiunta servizio + soft-delete toggle, con Server Actions protetti da Zod e requireAdmin() - Admin quote builder tab with catalog dropdown, freeform toggle, items table with calculated total, and accepted_total editor — all backed by Zod-validated Server Actions with requireAdmin guard. - Verifica umana completa: catalogo servizi → preventivo → accepted_total → dashboard cliente, con conferma security constraint quote_items mai esposti - NavBar - `/admin/projects/[id]` - `/api/internal/validate-slug/route.ts` - Five Offer System tables added to schema.ts and production DB via direct SQL migration, with Phase 4 projects table bootstrapped from existing client data. - Full admin CRUD for macro-offers, micro-offers, and offer services at /admin/offers with a client-side checkbox list for service-to-micro assignments and NavBar updated with Forecast and Offerte links. - OffersTab client component for assigning micro-offers to projects with inline accepted_total editing, plus active-offers summary section on the client detail page showing public_name per project. - Client dashboard now shows active offers per project (public_name + cumulative service price + accepted_total), and /admin/forecast displays a 12-month server-side revenue projection spread from project_offers.accepted_total across duration_months. - AdminSidebar.tsx - dashboard-queries.ts ---