feat: service offer tags, catalog cleanup, offer editor filter

- Import 58 offer membership tags for all 55 services (entity_type="services")
  via scripts/import-service-offer-tags.ts (already run on prod)
- ServiceTable: remove Categoria column, rename Tag → Offerta; QuickAddRow
  no longer has a category field (offer tags set post-creation)
- offer-queries: getOfferEditorData fetches offerTags per service (join on
  tags WHERE entity_type="services") and exposes them in OfferEditorData
- OfferEditorClient: filter chips above "Servizi Inclusi" — Tutti / Entry
  Offer / Signature Offer / Retainer Offer, derived from actual tag data

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 21:58:34 +02:00
parent 696a95950c
commit 43238341c1
4 changed files with 187 additions and 33 deletions
+2 -29
View File
@@ -23,9 +23,8 @@ function formatPrice(raw: string): string {
const COLUMN_HEADERS = [
"Nome",
"Descrizione",
"Categoria",
"Fase",
"Tag",
"Offerta",
"Pacchetto",
"Prezzo",
"Stato",
@@ -78,14 +77,6 @@ function ServiceRow({
onSave={(v) => run(() => updateServiceField(service.id, "description", v))}
/>
</td>
<td className="py-2 px-3 min-w-[140px]">
<OptionSelect
value={service.category}
options={options.categoria}
onChange={(v) => run(() => updateServiceField(service.id, "category", v ?? ""))}
onRename={(o, n) => run(() => renameServiceOption("categoria", o, n))}
/>
</td>
<td className="py-2 px-3 min-w-[140px]">
<OptionSelect
value={service.fase}
@@ -142,7 +133,6 @@ function ServiceRow({
function QuickAddRow({ options }: { options: CatalogFieldOptions }) {
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const [category, setCategory] = useState("");
const [fase, setFase] = useState("");
const [price, setPrice] = useState("");
const [, startTransition] = useTransition();
@@ -158,13 +148,11 @@ function QuickAddRow({ options }: { options: CatalogFieldOptions }) {
await quickAddService({
name: trimmed,
description: description || undefined,
category: category || undefined,
fase: fase || undefined,
unit_price: price || undefined,
});
setName("");
setDescription("");
setCategory("");
setFase("");
setPrice("");
router.refresh();
@@ -205,16 +193,6 @@ function QuickAddRow({ options }: { options: CatalogFieldOptions }) {
className={cellInput}
/>
</td>
<td className="py-2 px-3">
<Input
value={category}
onChange={(e) => setCategory(e.target.value)}
onKeyDown={onKeyDown}
placeholder="Categoria..."
list="catalog-categoria-pool"
className={cellInput}
/>
</td>
<td className="py-2 px-3">
<Input
value={fase}
@@ -226,7 +204,7 @@ function QuickAddRow({ options }: { options: CatalogFieldOptions }) {
/>
</td>
<td className="py-2 px-3 text-xs text-[#a1a1aa]" colSpan={2}>
Tag e pacchetto dopo la creazione
Offerta e pacchetto dopo la creazione
</td>
<td className="py-2 px-3">
<Input
@@ -239,11 +217,6 @@ function QuickAddRow({ options }: { options: CatalogFieldOptions }) {
/>
</td>
<td className="py-2 px-3 text-xs text-[#a1a1aa]">Invio </td>
<datalist id="catalog-categoria-pool">
{options.categoria.map((c) => (
<option key={c} value={c} />
))}
</datalist>
<datalist id="catalog-fase-pool">
{options.fase.map((f) => (
<option key={f} value={f} />