feat: update PostUnlock component to display contact information based on annuncio status

This commit is contained in:
Marco Pedone 2026-03-19 14:07:36 +01:00
parent c6b462a54d
commit 79354f3833

View file

@ -276,7 +276,7 @@ function getNavigationUrl(lat: string, lon: string): string {
const PostUnlock = () => { const PostUnlock = () => {
const { servizioId } = useServizio(); const { servizioId } = useServizio();
const { annuncioId } = useServizioAnnuncio(); const { annuncioId, data: annuncio } = useServizioAnnuncio();
const { data, isLoading } = api.annunci.getProprietarioData.useQuery({ const { data, isLoading } = api.annunci.getProprietarioData.useQuery({
annuncioId, annuncioId,
servizioId, servizioId,
@ -311,28 +311,50 @@ const PostUnlock = () => {
<CredenzaBody className="max-h-[80vh] overflow-auto pb-5 sm:max-w-xl"> <CredenzaBody className="max-h-[80vh] overflow-auto pb-5 sm:max-w-xl">
<div className="space-y-10"> <div className="space-y-10">
{/* Proprietario Section */} {/* Proprietario Section */}
<section> {annuncio.stato === "Sospeso" ? (
<h3 className="mb-2 font-semibold">{t.contatto.propietario}:</h3> <section>
<p className="mb-2"> <h3 className="mb-2 font-semibold">{t.contatto.propietario}:</h3>
{t.contatto.nome}: {propData.locatore} <p className="mb-2">{t.contatto.nome}: INFOALLOGGI (delegato)</p>
{propData.tipo_locatore ? ` (${propData.tipo_locatore})` : ""} <div className="flex flex-wrap items-center gap-5">
</p> <a
<div className="flex flex-wrap items-center gap-5"> className="flex items-center gap-2 text-blue-600 hover:underline"
<a href={`tel:3453944827`}
className="flex items-center gap-2 text-blue-600 hover:underline" >
href={`tel:${propData.numero}`} <Phone className="size-4" />
> <span>+39 3453944827</span>
<Phone className="size-4" /> </a>
<span>{propData.numero}</span> <Link href={`https://wa.me/3453944827`} target="_blank">
</a> <Button size="sm" variant="success">
<Link href={`https://wa.me/${propData.numero}`} target="_blank"> <WhatsAppIcon2 className="size-4 fill-white" />
<Button size="sm" variant="success"> WhatsApp
<WhatsAppIcon2 className="size-4 fill-white" /> </Button>
WhatsApp </Link>
</Button> </div>
</Link> </section>
</div> ) : (
</section> <section>
<h3 className="mb-2 font-semibold">{t.contatto.propietario}:</h3>
<p className="mb-2">
{t.contatto.nome}: {propData.locatore}
{propData.tipo_locatore ? ` (${propData.tipo_locatore})` : ""}
</p>
<div className="flex flex-wrap items-center gap-5">
<a
className="flex items-center gap-2 text-blue-600 hover:underline"
href={`tel:${propData.numero}`}
>
<Phone className="size-4" />
<span>{propData.numero}</span>
</a>
<Link href={`https://wa.me/${propData.numero}`} target="_blank">
<Button size="sm" variant="success">
<WhatsAppIcon2 className="size-4 fill-white" />
WhatsApp
</Button>
</Link>
</div>
</section>
)}
{/* Immobile Section */} {/* Immobile Section */}
<section> <section>