From 7763aac01c3e1ed606bae20d524445b071d83f89 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Wed, 7 Jan 2026 16:18:21 +0100 Subject: [PATCH] feat: add ServizioPacksInfos component for displaying pricing information --- .../components/servizio/admin_conferma.tsx | 136 +++++++++--------- .../components/servizio/servizio_actions.tsx | 8 +- 2 files changed, 71 insertions(+), 73 deletions(-) diff --git a/apps/infoalloggi/src/components/servizio/admin_conferma.tsx b/apps/infoalloggi/src/components/servizio/admin_conferma.tsx index 20c76de..50171f4 100644 --- a/apps/infoalloggi/src/components/servizio/admin_conferma.tsx +++ b/apps/infoalloggi/src/components/servizio/admin_conferma.tsx @@ -53,6 +53,7 @@ import { Label } from "../ui/label"; import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; import { Switch } from "../ui/switch"; import { UploadModal } from "../upload_modal"; +import { ServizioPacksInfos } from "./servizio_actions"; import { DocCombo, DocInfo } from "./shared"; export const AdminLavoraConferma = () => { @@ -489,14 +490,16 @@ const MotivazioneSection = () => { Non inserita )}

-

- Documento caricato: - {servizio.doc_motivazione_ref ? ( - - ) : ( - Non caricato - )} -

+ {!servizio.skipDocMotivazione && ( +

+ Documento caricato: + {servizio.doc_motivazione_ref ? ( + + ) : ( + Non caricato + )} +

+ )} @@ -559,8 +562,8 @@ const TransitorioSection = () => { "errore: testo non trovato in descrizione"); return ( -
-
+
+
@@ -584,10 +587,10 @@ const TransitorioSection = () => { placeholder="Seleziona..." />
-

- Permanenza in annuncio: - {permanenzaAnnuncio} -

+
+

Permanenza in annuncio:

+

{permanenzaAnnuncio}

+
); }; @@ -624,8 +627,8 @@ const StabileSection = () => { ); return ( -
-
+
+
Budget (da preferenze servizio): { suffix=" €" />
-

- Prezzo in descrizione: - {formatCurrency(data.prezzo / 100)} -

+
+

Prezzo in descrizione:

+

{formatCurrency(data.prezzo / 100)}

+
); }; @@ -711,38 +714,41 @@ const GeneralSection = () => { return ( <> -
- Persone: -
-
- - handleAdultiChange(Number(v))} - value={servizio.n_adulti || 0} - /> -
+
+
+ Persone: +
+
+ + handleAdultiChange(Number(v))} + value={servizio.n_adulti || 0} + /> +
-
- - handleMinoriChange(Number(v))} - value={servizio.n_minori || 0} - /> +
+ + handleMinoriChange(Number(v))} + value={servizio.n_minori || 0} + /> +
-

- Persone in annuncio: - {personeAnnuncio} -

+
+

Persone in annuncio:

+

{personeAnnuncio}

+
-
- Entro mese: -
- +
+
+ { placeholder="Seleziona..." />
- -

- Disponibilità in annuncio: - {dispAnnuncio} -

+
+

Disponibilità in annuncio:

+

{dispAnnuncio}

+
); @@ -776,7 +781,6 @@ const GeneralSection = () => { const SendConferma = () => { const { servizio } = useServizio(); const { data } = useServizioAnnuncio(); - const [check, setCheck] = useState(data.hasConfermaAdmin); const utils = api.useUtils(); const { mutate: handleUpdate } = api.servizio.adminUpdateConfermaStatus.useMutation({ @@ -812,14 +816,19 @@ const SendConferma = () => { )} +
{ - setCheck(c); + handleUpdate({ + servizioId: servizio.servizio_id, + annuncioId: data.id, + status: c, + }); }} />
- - - ); }; diff --git a/apps/infoalloggi/src/components/servizio/servizio_actions.tsx b/apps/infoalloggi/src/components/servizio/servizio_actions.tsx index b3d2c7e..6408207 100644 --- a/apps/infoalloggi/src/components/servizio/servizio_actions.tsx +++ b/apps/infoalloggi/src/components/servizio/servizio_actions.tsx @@ -182,7 +182,11 @@ const ServizioBasicActions = ({ className }: { className?: string }) => { return null; }; -const ServizioPacksInfos = () => { +export const ServizioPacksInfos = ({ + title = "Prezzi:", +}: { + title?: string; +}) => { const { servizio } = useServizio(); const { data: packs } = api.servizio.getPacksSolution.useQuery({ servizioId: servizio.servizio_id, @@ -190,7 +194,7 @@ const ServizioPacksInfos = () => { if (!packs) return null; return (
-

Prezzi:

+

{title}

{packs.acconto.success ? (