diff --git a/apps/infoalloggi/src/components/schedaAnnuncioStampabile.tsx b/apps/infoalloggi/src/components/schedaAnnuncioStampabile.tsx index b1aefb2..ea0462c 100644 --- a/apps/infoalloggi/src/components/schedaAnnuncioStampabile.tsx +++ b/apps/infoalloggi/src/components/schedaAnnuncioStampabile.tsx @@ -51,7 +51,7 @@ export function SchedaAnnuncioStampabile({ data }: { data: Annunci }) { to: inputEmail, codice: data.codice, numero: data.numero, - nominativo: data.locatore, + nominativo: `${data.locatore}${data.tipo_locatore ? ` (${data.tipo_locatore})` : ""}`, indirizzo: `${data.indirizzo}, ${data.civico} ${data.comune} ${data.cap} (${data.provincia})`, }); setInputEmail(""); @@ -229,7 +229,10 @@ export function SchedaAnnuncio({
-

{data.locatore}

+

+ {data.locatore}{" "} + {data.tipo_locatore ? `(${data.tipo_locatore})` : ""} +

{data.numero &&

Tel. {data.numero}

}
diff --git a/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx b/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx index 4bc28ea..c9801f5 100644 --- a/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx +++ b/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx @@ -292,7 +292,8 @@ const AdminAnnuncioContatti = () => { <>
Locatore/Incaricato: - {annuncio?.locatore || "N/A"} + {annuncio?.locatore || "N/A"}{" "} + {annuncio?.tipo_locatore ? `(${annuncio.tipo_locatore})` : ""}
Email: diff --git a/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx b/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx index 152cad3..cb44035 100644 --- a/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx +++ b/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx @@ -40,9 +40,18 @@ import { PopoverContent, PopoverTrigger, } from "~/components/ui/popover"; +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectTrigger, + SelectValue, +} from "~/components/ui/select"; import { Switch } from "~/components/ui/switch"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs"; import { VideoPlayer } from "~/components/videoPlayer"; +import { FieldResetButton } from "~/forms/comps"; import { filteredCaratteristiche } from "~/hooks/schedaAnnuncioUtils"; import { NullableStringOnChange } from "~/lib/form_utils"; import { getStorageUrl } from "~/lib/storage_utils"; @@ -86,6 +95,7 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => { // DATI LOCATORE locatore: z.string().nullable(), + tipo_locatore: z.string().nullable(), lon: z.string().nullable(), lon_secondario: z.string().nullable(), mq: z.number().nullable(), @@ -547,31 +557,89 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => { Dati di contatto - ( - -
- - Locatore o incaricato - - -
+ ( + +
+ + Locatore o incaricato + + +
- - - NullableStringOnChange(e, field.onChange) - } - value={field.value || ""} - /> - -
- )} + + + NullableStringOnChange(e, field.onChange) + } + value={field.value || ""} + /> + +
+ )} + /> + } + children2={ + { + const { value, onChange, ...rest } = field; + return ( + +
+ + Tipo locatore + + {value !== null && ( + + form.setValue("tipo_locatore", null) + } + /> + )} + +
+ + + + +
+ ); + }} + /> + } />