feat: offer_type (una tantum/retainer), dedup tiers, redesigned Offerte tab

- offer_macros.offer_type ('una_tantum'|'retainer') + editor "Modalità" toggle
  (migration 0012, applied to prod)
- migration 0012 also adds UNIQUE(macro_id, tier_letter) — prevents duplicate
  tiers; ran after a one-time dedup of Web Domination's duplicate A/B/C tiers
- OffersTab redesigned: two-step assign (Offer → Tier cards with price), type
  badge "Una tantum/Ricorrente" instead of misleading "X mesi", no redundant
  "· A" when public_name == tier letter, cleaner active-offers cards
- getProjectFullDetail: availableMicros grouped by macro + defensive dedup;
  projectOffers/availableMicros carry offer_type/category/price
- proposal deck PricingSection shows offer type (fallback to duration for
  pre-existing proposals)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 14:32:59 +02:00
parent 1824cb643f
commit f98828f75e
9 changed files with 333 additions and 132 deletions
+2
View File
@@ -156,6 +156,7 @@ const saveOfferEditorSchema = z.object({
description: z.string().optional(),
category: z.string().optional(),
ticket: z.string().optional(),
offer_type: z.enum(["una_tantum", "retainer"]).optional(),
cliente_ideale: z.string().optional(),
risultato: z.string().optional(),
tempo: z.string().optional(),
@@ -189,6 +190,7 @@ export async function saveOfferEditor(macroId: string, payload: SaveOfferEditorP
description: data.description || null,
category: data.category || null,
ticket: data.ticket || null,
offer_type: data.offer_type ?? "una_tantum",
cliente_ideale: data.cliente_ideale || null,
risultato: data.risultato || null,
tempo: data.tempo || null,