2026-01-16 15:47:38 +01:00
|
|
|
import {
|
2026-04-09 16:17:24 +02:00
|
|
|
Circle,
|
|
|
|
|
CircleCheck,
|
2026-01-16 15:47:38 +01:00
|
|
|
FileBadge,
|
|
|
|
|
FileText,
|
|
|
|
|
FolderKanban,
|
2026-03-12 17:02:35 +01:00
|
|
|
Info,
|
2026-01-16 15:47:38 +01:00
|
|
|
PackageCheck,
|
|
|
|
|
Printer,
|
|
|
|
|
Trash2,
|
2026-04-09 16:17:24 +02:00
|
|
|
Workflow,
|
2026-03-12 17:02:35 +01:00
|
|
|
Wrench,
|
2026-01-16 15:47:38 +01:00
|
|
|
} from "lucide-react";
|
2025-08-28 18:27:07 +02:00
|
|
|
import Link from "next/link";
|
|
|
|
|
import toast from "react-hot-toast";
|
2026-03-12 17:02:35 +01:00
|
|
|
import {
|
|
|
|
|
AlertDialog,
|
|
|
|
|
AlertDialogCancel,
|
|
|
|
|
AlertDialogContent,
|
|
|
|
|
AlertDialogDescription,
|
|
|
|
|
AlertDialogFooter,
|
|
|
|
|
AlertDialogHeader,
|
|
|
|
|
AlertDialogTitle,
|
|
|
|
|
AlertDialogTrigger,
|
|
|
|
|
} from "~/components/ui/alert-dialog";
|
2026-01-16 15:47:38 +01:00
|
|
|
import { Button, type ButtonConfigs } from "~/components/ui/button";
|
2026-04-09 16:17:24 +02:00
|
|
|
import {
|
|
|
|
|
Popover,
|
|
|
|
|
PopoverContent,
|
|
|
|
|
PopoverDescription,
|
|
|
|
|
PopoverHeader,
|
|
|
|
|
PopoverTitle,
|
|
|
|
|
PopoverTrigger,
|
|
|
|
|
} from "~/components/ui/popover";
|
2025-08-28 18:27:07 +02:00
|
|
|
import {
|
2026-01-16 15:47:38 +01:00
|
|
|
Tooltip,
|
|
|
|
|
TooltipContent,
|
|
|
|
|
TooltipProvider,
|
|
|
|
|
TooltipTrigger,
|
|
|
|
|
} from "~/components/ui/tooltip";
|
|
|
|
|
import { cn } from "~/lib/utils";
|
2026-02-25 15:30:53 +01:00
|
|
|
import { useTranslation } from "~/providers/I18nProvider";
|
2025-08-04 17:45:44 +02:00
|
|
|
import { useServizio, useServizioAnnuncio } from "~/providers/ServizioProvider";
|
2026-01-16 15:47:38 +01:00
|
|
|
import type { AnnunciId } from "~/schemas/public/Annunci";
|
2026-03-08 01:02:57 +01:00
|
|
|
import OrderTypeEnum from "~/schemas/public/OrderTypeEnum";
|
2026-04-09 16:27:33 +02:00
|
|
|
import type { ServizioServizioId } from "~/schemas/public/Servizio";
|
2026-04-09 16:17:24 +02:00
|
|
|
import StatusConfermaEnum from "~/schemas/public/StatusConfermaEnum";
|
2026-04-09 16:27:33 +02:00
|
|
|
import type { ServizioAnnuncioData } from "~/server/controllers/servizio.controller";
|
2025-08-28 18:27:07 +02:00
|
|
|
import { api } from "~/utils/api";
|
2026-01-16 15:47:38 +01:00
|
|
|
import { Confirm } from "../confirm";
|
2025-11-06 17:03:42 +01:00
|
|
|
import { AdminContratto } from "./admin_contratto";
|
2026-01-16 15:47:38 +01:00
|
|
|
import { ContattiProprietarioModal } from "./modale_contatti";
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2026-01-16 15:47:38 +01:00
|
|
|
export const AdminActions = () => {
|
2026-03-08 01:02:57 +01:00
|
|
|
const { servizioId, isAdmin } = useServizio();
|
2025-08-28 18:27:07 +02:00
|
|
|
const { data, annuncioId } = useServizioAnnuncio();
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
const utils = api.useUtils();
|
|
|
|
|
const { mutate } = api.servizio.removeAnnuncioServizio.useMutation({
|
2025-08-29 16:18:32 +02:00
|
|
|
onError: (error) => {
|
|
|
|
|
console.error(error);
|
|
|
|
|
toast.error("Errore durante la rimozione dell'annuncio");
|
|
|
|
|
},
|
2025-08-28 18:27:07 +02:00
|
|
|
onSuccess: async () => {
|
2026-03-08 01:02:57 +01:00
|
|
|
await utils.servizio.invalidate();
|
2025-08-28 18:27:07 +02:00
|
|
|
toast.success("Annuncio rimosso");
|
|
|
|
|
},
|
|
|
|
|
});
|
2026-01-16 15:47:38 +01:00
|
|
|
if (!isAdmin) return null;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2026-01-16 15:47:38 +01:00
|
|
|
return (
|
2026-03-12 17:02:35 +01:00
|
|
|
<>
|
|
|
|
|
<h3 className="ml-1 font-semibold">Azioni Admin:</h3>
|
|
|
|
|
<div className="flex w-full max-w-fit flex-wrap justify-start gap-3">
|
2026-04-09 16:27:33 +02:00
|
|
|
<AnnuncioContatti data={data} />
|
|
|
|
|
<AnnuncioConfermaPopover
|
|
|
|
|
annuncioId={annuncioId}
|
|
|
|
|
servizioId={servizioId}
|
|
|
|
|
status_conferma={data.status_conferma}
|
|
|
|
|
/>
|
2026-04-09 16:17:24 +02:00
|
|
|
|
|
|
|
|
{data.status_conferma != null && (
|
2026-03-12 17:02:35 +01:00
|
|
|
<>
|
|
|
|
|
<AdminContratto />
|
|
|
|
|
{data.gestionale_id && (
|
|
|
|
|
<Link
|
|
|
|
|
aria-label="Open Gestionale"
|
|
|
|
|
href={`https://win-jk822fggr6b:480/id/${data.gestionale_id}`}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
|
|
|
|
<Button size="sm">
|
|
|
|
|
<FolderKanban /> Gestionale
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
{/* <Link href={`/annuncio/${data.codice}`} target="_blank">
|
2026-01-16 15:47:38 +01:00
|
|
|
<Button size="sm" type="button" variant="outline">
|
|
|
|
|
<Eye /> pubblica
|
|
|
|
|
</Button>
|
2026-03-12 17:02:35 +01:00
|
|
|
</Link> */}
|
|
|
|
|
<Link
|
|
|
|
|
href={`/area-riservata/admin/edit-annuncio/${annuncioId}`}
|
|
|
|
|
target="_blank"
|
2026-01-16 15:47:38 +01:00
|
|
|
>
|
2026-03-12 17:02:35 +01:00
|
|
|
<Button
|
|
|
|
|
aria-label="Edit Annuncio"
|
|
|
|
|
className="w-fit"
|
|
|
|
|
size="sm"
|
|
|
|
|
variant="secondary"
|
|
|
|
|
>
|
|
|
|
|
<Wrench />
|
|
|
|
|
<span>Modifica Annuncio</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2026-01-16 15:47:38 +01:00
|
|
|
|
2026-03-12 17:02:35 +01:00
|
|
|
<Link
|
|
|
|
|
href={`/area-riservata/scheda-annuncio-stampa/${data.id}`}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
|
|
|
|
<Button size="sm" type="button" variant="outline">
|
|
|
|
|
<Printer /> Scheda
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2026-01-16 15:47:38 +01:00
|
|
|
|
2026-03-12 17:02:35 +01:00
|
|
|
<Confirm
|
|
|
|
|
description="Sei sicuro di voler eliminare l'annuncio?"
|
|
|
|
|
onConfirm={() => {
|
|
|
|
|
mutate({
|
|
|
|
|
annuncioId,
|
|
|
|
|
servizioId,
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
title="Elimina annuncio"
|
2026-01-16 15:47:38 +01:00
|
|
|
>
|
2026-03-12 17:02:35 +01:00
|
|
|
<Button
|
|
|
|
|
aria-label="Delete Annuncio"
|
|
|
|
|
className="w-fit"
|
|
|
|
|
size="sm"
|
|
|
|
|
variant="destructive"
|
|
|
|
|
>
|
|
|
|
|
<Trash2 />
|
|
|
|
|
<span>Elimina</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</Confirm>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
2026-01-16 15:47:38 +01:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const UserActions = () => {
|
2026-04-09 16:17:24 +02:00
|
|
|
const { data } = useServizioAnnuncio();
|
2026-01-16 15:47:38 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className="flex w-full flex-col flex-wrap gap-2 sm:flex-row">
|
|
|
|
|
<ContattiProprietarioModal />
|
2026-04-09 16:17:24 +02:00
|
|
|
</div>
|
|
|
|
|
{data.status_conferma != null && <PostConfermaSection />}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
2026-01-16 15:47:38 +01:00
|
|
|
|
2026-04-09 16:27:33 +02:00
|
|
|
export const AnnuncioConfermaPopover = ({
|
|
|
|
|
servizioId,
|
|
|
|
|
annuncioId,
|
|
|
|
|
status_conferma,
|
|
|
|
|
}: {
|
|
|
|
|
servizioId: ServizioServizioId;
|
|
|
|
|
annuncioId: AnnunciId;
|
|
|
|
|
status_conferma: StatusConfermaEnum | null;
|
|
|
|
|
}) => {
|
2026-04-09 16:17:24 +02:00
|
|
|
const utils = api.useUtils();
|
|
|
|
|
const { mutate } = api.servizio.updateServizioAnnunci.useMutation({
|
|
|
|
|
onSuccess: async () => {
|
|
|
|
|
await utils.servizio.invalidate();
|
|
|
|
|
},
|
|
|
|
|
onError: (error) => {
|
|
|
|
|
console.error(error);
|
|
|
|
|
toast.error("Errore durante l'aggiornamento dell'annuncio");
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
const handleStatusChange = (status: StatusConfermaEnum | null) => {
|
|
|
|
|
mutate({
|
2026-04-09 16:27:33 +02:00
|
|
|
annuncioId,
|
2026-04-09 16:17:24 +02:00
|
|
|
servizioId,
|
|
|
|
|
data: { status_conferma: status },
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
return (
|
|
|
|
|
<Popover>
|
|
|
|
|
<PopoverTrigger asChild>
|
|
|
|
|
<Button size="sm" variant="orange">
|
2026-04-09 16:27:33 +02:00
|
|
|
<Workflow /> {status_conferma || "Non in conferma"}
|
2026-04-09 16:17:24 +02:00
|
|
|
</Button>
|
|
|
|
|
</PopoverTrigger>
|
|
|
|
|
<PopoverContent>
|
|
|
|
|
<PopoverHeader>
|
|
|
|
|
<PopoverTitle>Status Conferma:</PopoverTitle>
|
|
|
|
|
<PopoverDescription className="sr-only">
|
|
|
|
|
Description
|
|
|
|
|
</PopoverDescription>
|
|
|
|
|
</PopoverHeader>
|
|
|
|
|
|
|
|
|
|
<div className="flex flex-col divide-y rounded-md border border-border">
|
|
|
|
|
<Button
|
|
|
|
|
className="justify-start rounded-b-none"
|
|
|
|
|
onClick={() => handleStatusChange(null)}
|
2026-04-09 16:27:33 +02:00
|
|
|
variant={status_conferma === null ? "default" : "outline"}
|
2026-01-16 15:47:38 +01:00
|
|
|
>
|
2026-04-09 16:27:33 +02:00
|
|
|
{status_conferma === null ? <CircleCheck /> : <Circle />}
|
2026-04-09 16:17:24 +02:00
|
|
|
Non in conferma
|
|
|
|
|
</Button>
|
|
|
|
|
{Object.values(StatusConfermaEnum).map((status) => (
|
|
|
|
|
<Button
|
|
|
|
|
className="justify-start rounded-none last:rounded-b-md"
|
|
|
|
|
key={status}
|
|
|
|
|
onClick={() => handleStatusChange(status)}
|
2026-04-09 16:27:33 +02:00
|
|
|
variant={status_conferma === status ? "default" : "outline"}
|
2026-01-16 15:47:38 +01:00
|
|
|
>
|
2026-04-09 16:27:33 +02:00
|
|
|
{status_conferma === status ? <CircleCheck /> : <Circle />}
|
2026-04-09 16:17:24 +02:00
|
|
|
{status}
|
|
|
|
|
</Button>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</PopoverContent>
|
|
|
|
|
</Popover>
|
2026-01-16 15:47:38 +01:00
|
|
|
);
|
|
|
|
|
};
|
2026-04-09 16:17:24 +02:00
|
|
|
|
2026-04-09 16:27:33 +02:00
|
|
|
export const AnnuncioContatti = ({ data }: { data: ServizioAnnuncioData }) => {
|
2026-03-12 17:02:35 +01:00
|
|
|
const { data: annuncio, isLoading } = api.annunci.getAnnuncioFull.useQuery({
|
|
|
|
|
id: data.id,
|
|
|
|
|
});
|
|
|
|
|
return (
|
|
|
|
|
<AlertDialog>
|
|
|
|
|
<AlertDialogTrigger asChild>
|
|
|
|
|
<Button size="sm" variant="outline">
|
|
|
|
|
<Info />
|
|
|
|
|
<span>Dati Contatto</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</AlertDialogTrigger>
|
|
|
|
|
<AlertDialogContent>
|
|
|
|
|
<AlertDialogHeader>
|
|
|
|
|
<AlertDialogTitle>Contatti Annuncio {data.codice}</AlertDialogTitle>
|
|
|
|
|
<AlertDialogDescription className="sr-only">
|
|
|
|
|
desc
|
|
|
|
|
</AlertDialogDescription>
|
|
|
|
|
</AlertDialogHeader>
|
|
|
|
|
<div className="flex w-full flex-col gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<span className="font-semibold">Contatti Aperti il: </span>
|
|
|
|
|
{data.open_contatti_at
|
|
|
|
|
? new Date(data.open_contatti_at).toLocaleString("it-IT")
|
|
|
|
|
: "Non ancora aperti"}
|
|
|
|
|
</div>
|
|
|
|
|
{isLoading ? (
|
|
|
|
|
<div className="flex h-24 w-full items-center justify-center">
|
|
|
|
|
Loading...
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<div>
|
|
|
|
|
<span className="font-semibold">Locatore/Incaricato: </span>
|
2026-03-17 19:08:14 +01:00
|
|
|
{annuncio?.locatore || "N/A"}{" "}
|
|
|
|
|
{annuncio?.tipo_locatore ? `(${annuncio.tipo_locatore})` : ""}
|
2026-03-12 17:02:35 +01:00
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<span className="font-semibold">Email: </span>
|
|
|
|
|
{annuncio?.email || "N/A"}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<span className="font-semibold">Telefono: </span>
|
|
|
|
|
{annuncio?.numero || "N/A"}
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<AlertDialogFooter>
|
|
|
|
|
<AlertDialogCancel>Chiudi</AlertDialogCancel>
|
|
|
|
|
</AlertDialogFooter>
|
|
|
|
|
</AlertDialogContent>
|
|
|
|
|
</AlertDialog>
|
|
|
|
|
);
|
|
|
|
|
};
|
2026-01-16 15:47:38 +01:00
|
|
|
|
|
|
|
|
const PostConfermaSection = () => {
|
|
|
|
|
const { servizio, servizioId } = useServizio();
|
|
|
|
|
const { data, annuncioId } = useServizioAnnuncio();
|
2026-02-25 15:30:53 +01:00
|
|
|
const { locale } = useTranslation();
|
2026-01-16 15:47:38 +01:00
|
|
|
const saldoPaid = servizio.isOkSaldo;
|
|
|
|
|
const consulenzaPaid = servizio.isOkConsulenza;
|
|
|
|
|
|
2026-02-25 15:30:53 +01:00
|
|
|
const doc_non_disponibile =
|
|
|
|
|
locale === "it"
|
|
|
|
|
? "Il documento non è più disponibile"
|
|
|
|
|
: "The document is no longer available";
|
|
|
|
|
const contatta_supporto =
|
|
|
|
|
locale === "it"
|
|
|
|
|
? "Se hai bisogno di una copia, contattaci via email o chat."
|
|
|
|
|
: "If you need a copy, contact us via email or chat.";
|
|
|
|
|
|
2026-01-16 15:47:38 +01:00
|
|
|
if (!saldoPaid) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex flex-col gap-1">
|
|
|
|
|
<h3 className="font-semibold">
|
2026-02-25 15:30:53 +01:00
|
|
|
{locale === "it"
|
|
|
|
|
? "Questo annuncio è stato confermato, procedi al saldo:"
|
|
|
|
|
: "This listing has been confirmed, proceed to payment:"}
|
2026-01-16 15:47:38 +01:00
|
|
|
</h3>
|
|
|
|
|
<SaldoButton annuncioId={annuncioId} />
|
2025-08-28 18:27:07 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2026-01-16 15:47:38 +01:00
|
|
|
if (!data.doc_contratto_added) {
|
|
|
|
|
return (
|
2026-03-08 01:02:57 +01:00
|
|
|
<div className="flex flex-col gap-1 rounded-md border border-card bg-card p-4">
|
2026-01-16 15:47:38 +01:00
|
|
|
<h3 className="font-semibold text-green-500">
|
2026-02-25 15:30:53 +01:00
|
|
|
{locale === "it"
|
|
|
|
|
? "Ci siamo quasi! Stiamo preparando il contratto per te."
|
|
|
|
|
: "Almost there! We are preparing the contract for you."}
|
2026-01-16 15:47:38 +01:00
|
|
|
</h3>
|
|
|
|
|
<h3 className="font-semibold">
|
2026-02-25 15:30:53 +01:00
|
|
|
{locale === "it"
|
|
|
|
|
? "Una volta pronto, riceverai una notifica via email."
|
|
|
|
|
: "Once ready, you will receive a notification via email."}
|
2026-01-16 15:47:38 +01:00
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
|
<h3 className="font-semibold">
|
|
|
|
|
{consulenzaPaid
|
2026-02-25 15:30:53 +01:00
|
|
|
? locale === "it"
|
|
|
|
|
? "Il contratto è pronto, puoi visualizzarlo:"
|
|
|
|
|
: "The contract is ready, you can view it:"
|
|
|
|
|
: locale === "it"
|
|
|
|
|
? "Il contratto è pronto, puoi visualizzarlo e procedere al saldo:"
|
|
|
|
|
: "The contract is ready, you can view it and proceed to payment:"}
|
2026-01-16 15:47:38 +01:00
|
|
|
</h3>
|
2026-03-08 01:02:57 +01:00
|
|
|
<div className="flex w-full flex-wrap gap-2">
|
2026-01-16 15:47:38 +01:00
|
|
|
{data.doc_contratto_ref ? (
|
|
|
|
|
<Link
|
2026-02-25 15:30:53 +01:00
|
|
|
aria-label={
|
|
|
|
|
locale === "it" ? "Visualizza contratto" : "View contract"
|
|
|
|
|
}
|
2026-03-08 01:02:57 +01:00
|
|
|
className="w-full sm:w-fit"
|
2026-01-16 15:47:38 +01:00
|
|
|
href={`/servizio/contratto/${servizioId}/${annuncioId}`}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
2026-03-08 01:02:57 +01:00
|
|
|
<Button className="w-full">
|
2026-01-16 15:47:38 +01:00
|
|
|
<FileText />
|
2026-02-25 15:30:53 +01:00
|
|
|
{locale === "it"
|
|
|
|
|
? "Visualizza il contratto"
|
|
|
|
|
: "View the contract"}
|
2026-01-16 15:47:38 +01:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
) : (
|
|
|
|
|
<TooltipProvider delayDuration={0}>
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger asChild>
|
|
|
|
|
<Button className="w-fit cursor-not-allowed opacity-50">
|
|
|
|
|
<FileText />
|
2026-02-25 15:30:53 +01:00
|
|
|
{locale === "it"
|
|
|
|
|
? "Visualizza il contratto"
|
|
|
|
|
: "View the contract"}
|
2026-01-16 15:47:38 +01:00
|
|
|
</Button>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>
|
2026-02-25 15:30:53 +01:00
|
|
|
<p>{doc_non_disponibile}</p>
|
|
|
|
|
<p>{contatta_supporto}</p>
|
2026-01-16 15:47:38 +01:00
|
|
|
</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</TooltipProvider>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-03-08 01:02:57 +01:00
|
|
|
{!consulenzaPaid &&
|
|
|
|
|
servizio.ordini.some(
|
|
|
|
|
(o) => o.type === OrderTypeEnum.Consulenza && !o.isActive,
|
|
|
|
|
) &&
|
|
|
|
|
data.contratto_tipo && <SaldoConsulenzaButton />}
|
2026-01-16 15:47:38 +01:00
|
|
|
|
|
|
|
|
{data.doc_registrazione_added &&
|
|
|
|
|
(data.doc_registrazione_ref ? (
|
|
|
|
|
<Link
|
2026-02-25 15:30:53 +01:00
|
|
|
aria-label={
|
|
|
|
|
locale === "it" ? "Visualizza registrazione" : "View recording"
|
|
|
|
|
}
|
2026-03-08 01:02:57 +01:00
|
|
|
className="w-full sm:w-fit"
|
2026-01-16 15:47:38 +01:00
|
|
|
href={`/servizio/contratto-registrazione/${servizioId}/${annuncioId}`}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
2026-03-08 01:02:57 +01:00
|
|
|
<Button className="w-full">
|
2026-01-16 15:47:38 +01:00
|
|
|
<FileBadge />
|
2026-02-25 15:30:53 +01:00
|
|
|
{locale === "it"
|
|
|
|
|
? "Visualizza la registrazione"
|
|
|
|
|
: "View the recording"}
|
2026-01-16 15:47:38 +01:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
) : (
|
|
|
|
|
<TooltipProvider delayDuration={0}>
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger asChild>
|
|
|
|
|
<Button className="w-fit cursor-not-allowed opacity-50">
|
|
|
|
|
<FileBadge />
|
2026-02-25 15:30:53 +01:00
|
|
|
{locale === "it"
|
|
|
|
|
? "Visualizza la registrazione"
|
|
|
|
|
: "View the recording"}
|
2026-01-16 15:47:38 +01:00
|
|
|
</Button>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>
|
2026-02-25 15:30:53 +01:00
|
|
|
<p>{doc_non_disponibile}</p>
|
|
|
|
|
<p>{contatta_supporto}</p>
|
2026-01-16 15:47:38 +01:00
|
|
|
</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</TooltipProvider>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const SaldoButton = ({
|
|
|
|
|
variant = "info",
|
|
|
|
|
className,
|
|
|
|
|
}: {
|
|
|
|
|
annuncioId: AnnunciId;
|
|
|
|
|
variant?: ButtonConfigs["variant"];
|
|
|
|
|
className?: string;
|
|
|
|
|
}) => {
|
2026-02-25 15:30:53 +01:00
|
|
|
const { locale } = useTranslation();
|
2026-01-16 15:47:38 +01:00
|
|
|
const { servizioId } = useServizio();
|
|
|
|
|
|
|
|
|
|
return (
|
2026-03-08 01:02:57 +01:00
|
|
|
<Link
|
|
|
|
|
className="w-full sm:w-fit"
|
2026-03-17 18:46:43 +01:00
|
|
|
href={`/servizio/pagamento?servizioId=${servizioId}&type=${OrderTypeEnum.Saldo}`}
|
2026-01-16 15:47:38 +01:00
|
|
|
>
|
2026-03-08 01:02:57 +01:00
|
|
|
<Button
|
|
|
|
|
aria-label={locale === "it" ? "Procedi al saldo" : "Proceed to payment"}
|
|
|
|
|
className={cn("w-full", className)}
|
|
|
|
|
variant={variant}
|
|
|
|
|
>
|
|
|
|
|
<PackageCheck />
|
|
|
|
|
{locale === "it" ? "Procedi al saldo" : "Proceed to payment"}
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2026-01-16 15:47:38 +01:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const SaldoConsulenzaButton = ({
|
|
|
|
|
variant = "info",
|
|
|
|
|
className,
|
|
|
|
|
}: {
|
|
|
|
|
variant?: ButtonConfigs["variant"];
|
|
|
|
|
className?: string;
|
|
|
|
|
}) => {
|
2026-02-25 15:30:53 +01:00
|
|
|
const { locale } = useTranslation();
|
2026-01-16 15:47:38 +01:00
|
|
|
const { servizioId } = useServizio();
|
|
|
|
|
|
|
|
|
|
return (
|
2026-03-08 01:02:57 +01:00
|
|
|
<Link
|
|
|
|
|
className="w-full sm:w-fit"
|
2026-03-17 18:46:43 +01:00
|
|
|
href={`/servizio/pagamento?servizioId=${servizioId}&type=${OrderTypeEnum.Consulenza}`}
|
2026-01-16 15:47:38 +01:00
|
|
|
>
|
2026-03-08 01:02:57 +01:00
|
|
|
<Button
|
|
|
|
|
aria-label={
|
|
|
|
|
locale === "it"
|
|
|
|
|
? "Procedi al saldo consulenza"
|
|
|
|
|
: "Proceed to payment for the consultation"
|
|
|
|
|
}
|
|
|
|
|
className={cn("w-full", className)}
|
|
|
|
|
variant={variant}
|
|
|
|
|
>
|
|
|
|
|
<PackageCheck />
|
|
|
|
|
{locale === "it"
|
|
|
|
|
? "Procedi al saldo della consulenza"
|
|
|
|
|
: "Proceed to payment for the consultation"}
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2026-01-16 15:47:38 +01:00
|
|
|
);
|
2025-08-04 17:45:44 +02:00
|
|
|
};
|