diff --git a/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx b/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx index 4e8ac16..39436ae 100644 --- a/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx +++ b/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx @@ -73,9 +73,9 @@ const AnnuncioEditForm = ({ data }: { data: Annunci }) => { titolo_en: z.string().nonempty("Inserisci un titolo valido"), desc_en: z.string().nonempty("Inserisci una descrizione valida"), status: z.string().nonempty("Seleziona uno stato"), - locatore: z.string().nonempty("Inserisci il locatore"), - email: z.email(), - numero: z.string().nonempty("Inserisci un numero di telefono"), + locatore: z.string().nullable(), + email: z.email().nullable(), + numero: z.string().nullable(), }); type EditAnnuncioFormValues = z.infer; @@ -98,9 +98,9 @@ const AnnuncioEditForm = ({ data }: { data: Annunci }) => { titolo_en: data.titolo_en || "", desc_en: data.desc_en || "", status: data.stato || "", - locatore: data.locatore || "", - email: data.email || "", - numero: data.numero || "", + locatore: data.locatore || null, + email: data.email || null, + numero: data.numero || null, }; z.config(z.locales[locale]()); @@ -356,7 +356,15 @@ const AnnuncioEditForm = ({ data }: { data: Annunci }) => { - + + field.onChange(e.target.value || null) + } + /> )} @@ -378,6 +386,10 @@ const AnnuncioEditForm = ({ data }: { data: Annunci }) => { placeholder="esempio@email.com" {...field} id="email" + value={field.value || undefined} + onChange={(e) => + field.onChange(e.target.value || null) + } /> @@ -396,7 +408,12 @@ const AnnuncioEditForm = ({ data }: { data: Annunci }) => { - + field.onChange(n || null)} + /> )}