@@ -19,70 +20,70 @@ import type { ReactNode } from "react";
*/
type ChildrenBubbleProps = {
- children: ReactNode;
- href?: undefined;
- txt?: undefined;
- target?: undefined;
+ children: ReactNode;
+ href?: undefined;
+ txt?: undefined;
+ target?: undefined;
};
type LinkBubbleProps = {
- children?: undefined;
- href: string;
- txt: string;
- target?: "_self" | "_blank" | "_parent" | "_top";
+ children?: undefined;
+ href: string;
+ txt: string;
+ target?: "_self" | "_blank" | "_parent" | "_top";
};
type InformationBubbleProps = {
- className?: string;
- iconClassName?: string;
- icon?: IconType;
- side?: "top" | "bottom" | "left" | "right";
+ className?: string;
+ iconClassName?: string;
+ icon?: IconType;
+ side?: "top" | "bottom" | "left" | "right";
} & (ChildrenBubbleProps | LinkBubbleProps);
const InformationBubble = ({
- className,
- icon = "circle-help",
- iconClassName,
- side,
- children,
- href,
- txt,
- target,
+ className,
+ icon = "circle-help",
+ iconClassName,
+ side,
+ children,
+ href,
+ txt,
+ target,
}: InformationBubbleProps) => {
- return (
-
-
-
-
-
+ return (
+
+
+
+
+
-
- {href ? (
-
-
- {txt}
-
- ) : (
- <>{children}>
- )}
-
-
-
- );
+
+ {href ? (
+
+
+ {txt}
+
+ ) : (
+ <>{children}>
+ )}
+
+
+
+ );
};
export default InformationBubble;
diff --git a/apps/infoalloggi/src/components/Layout.tsx b/apps/infoalloggi/src/components/Layout.tsx
index b1a8ef9..382e878 100644
--- a/apps/infoalloggi/src/components/Layout.tsx
+++ b/apps/infoalloggi/src/components/Layout.tsx
@@ -1,297 +1,297 @@
-import { useContext, type ReactNode } from "react";
-import { BannerFactory } from "~/components/banners";
-import { Footer, MiniFooter } from "~/components/footer";
-import { SiteHeader } from "~/components/navbar/site-header";
-import { useTranslation } from "~/providers/I18nProvider";
-import { UserViewContext, UserViewProvider } from "~/lib/userViewContext";
+import {
+ ExternalLink,
+ Mail,
+ MessagesSquare,
+ Paperclip,
+ Search,
+ ShoppingBag,
+ Tickets,
+ UserCog,
+} from "lucide-react";
import Head from "next/head";
import Link from "next/link";
-import {
- ExternalLink,
- Mail,
- MessagesSquare,
- Paperclip,
- Search,
- ShoppingBag,
- Tickets,
- UserCog,
-} from "lucide-react";
+import { usePathname } from "next/navigation";
+import { useRouter } from "next/router";
+import { type ReactNode, useContext } from "react";
+import toast from "react-hot-toast";
+import { Sidebar } from "~/components/area-riservata/sidebar";
+import { BannerFactory } from "~/components/banners";
+import { Footer, MiniFooter } from "~/components/footer";
+import { LoadingPage } from "~/components/loading";
+import { SiteHeader } from "~/components/navbar/site-header";
+import { WhatsAppIcon } from "~/components/svgs";
import { Button } from "~/components/ui/button";
import { Separator } from "~/components/ui/separator";
-import { usePathname } from "next/navigation";
-import { api } from "~/utils/api";
-import { Sidebar } from "~/components/area-riservata/sidebar";
-import type { UsersId } from "~/schemas/public/Users";
-import toast from "react-hot-toast";
-import { useRouter } from "next/router";
+import { UserViewContext, UserViewProvider } from "~/lib/userViewContext";
+import { useTranslation } from "~/providers/I18nProvider";
import {
- useSession,
- EnforcedSessionContext,
+ EnforcedSessionContext,
+ useSession,
} from "~/providers/SessionProvider";
-import { WhatsAppIcon } from "~/components/svgs";
-import { LoadingPage } from "~/components/loading";
+import type { UsersId } from "~/schemas/public/Users";
import type { ValidSession } from "~/server/api/trpc";
+import { api } from "~/utils/api";
interface Props {
- children: ReactNode;
- noFooter?: boolean;
+ children: ReactNode;
+ noFooter?: boolean;
}
export const Layout = ({ children, noFooter }: Props) => {
- const { data: bannerData } = api.settings.getBannerData.useQuery({
- area_riservata: false,
- });
+ const { data: bannerData } = api.settings.getBannerData.useQuery({
+ area_riservata: false,
+ });
- return (
-
-
- {bannerData?.map((banner) => (
-
- {BannerFactory(banner)}
-
- ))}
-
{children}
+ return (
+
+
+ {bannerData?.map((banner) => (
+
+ {BannerFactory(banner)}
+
+ ))}
+
{children}
- {!noFooter &&
}
- {/*
*/}
-
- );
+ {!noFooter &&
}
+ {/*
*/}
+
+ );
};
export const AreaRiservataLayout = ({
- children,
- noSidebar,
- noFooter,
- ignoreSessionCheck,
+ children,
+ noSidebar,
+ noFooter,
+ ignoreSessionCheck,
}: {
- children: ReactNode;
- noSidebar?: boolean;
- noFooter?: boolean;
- ignoreSessionCheck?: boolean;
+ children: ReactNode;
+ noSidebar?: boolean;
+ noFooter?: boolean;
+ ignoreSessionCheck?: boolean;
}) => {
- const { data: bannerData } = api.settings.getBannerData.useQuery({
- area_riservata: true,
- });
- const session = useSession();
- if (!ignoreSessionCheck) {
- if (session.status === "pending")
- return (
-
-
+ const { data: bannerData } = api.settings.getBannerData.useQuery({
+ area_riservata: true,
+ });
+ const session = useSession();
+ if (!ignoreSessionCheck) {
+ if (session.status === "pending")
+ return (
+
+
-
-
- ;
-
-
- {!noFooter &&
}
-
- );
- if (session.status !== "success" || !session.user) {
- window.location.reload();
- return (
-
-
+
+
+
+
+
+ {!noFooter &&
}
+
+ );
+ if (session.status !== "success" || !session.user) {
+ window.location.reload();
+ return (
+
+
-
-
- ;
-
-
- {!noFooter &&
}
-
- );
- }
- }
+
+
+
+
+
+ {!noFooter &&
}
+
+ );
+ }
+ }
- return (
-
-
- {bannerData?.map((banner) => (
-
- {BannerFactory(banner)}
-
- ))}
-
-
- {noSidebar ? null : (
-
- )}
-
- {children}
-
-
-
- {!noFooter &&
}
+ return (
+
+
+ {bannerData?.map((banner) => (
+
+ {BannerFactory(banner)}
+
+ ))}
+
+
+ {noSidebar ? null : (
+
+ )}
+
+ {children}
+
+
+
+ {!noFooter &&
}
- {/*
*/}
-
- );
+ {/*
*/}
+
+ );
};
export const AreaRiservataLayoutUserView = ({
- children,
+ children,
}: {
- children: ReactNode & { props: { userId: UsersId } };
+ children: ReactNode & { props: { userId: UsersId } };
}) => {
- const { t } = useTranslation();
+ const { t } = useTranslation();
- const props = children.props as { userId: UsersId };
+ const props = children.props as { userId: UsersId };
- return (
-
-
-
-
-
- {t.heads.area_riservata_titolo}
-
-
-
-
+ return (
+
+
+
+
+
+ {t.heads.area_riservata_titolo}
+
+
+
+
+
+
-
+
- {/*
*/}
-
- );
+ {/* */}
+
+ );
};
const UserViewHeader = () => {
- const data = useContext(UserViewContext);
- const pathname = usePathname();
- const router = useRouter();
- const { mutate: swap } = api.auth.swapUser.useMutation({
- onSuccess: async () => {
- toast.success("Utente cambiato con successo");
- await router.push("/area-riservata/dashboard");
- router.reload();
- },
- });
- if (!data) return
Errore
;
- return (
-
-
-
{data.username}
-
- {data.email} | {data.telefono}
-
+ const data = useContext(UserViewContext);
+ const pathname = usePathname();
+ const router = useRouter();
+ const { mutate: swap } = api.auth.swapUser.useMutation({
+ onSuccess: async () => {
+ toast.success("Utente cambiato con successo");
+ await router.push("/area-riservata/dashboard");
+ router.reload();
+ },
+ });
+ if (!data) return
Errore
;
+ return (
+
+
+
{data.username}
+
+ {data.email} | {data.telefono}
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
- );
+
+
+
+
+ );
};
diff --git a/apps/infoalloggi/src/components/MapDialog.tsx b/apps/infoalloggi/src/components/MapDialog.tsx
index ee7b850..ec0e118 100644
--- a/apps/infoalloggi/src/components/MapDialog.tsx
+++ b/apps/infoalloggi/src/components/MapDialog.tsx
@@ -1,65 +1,65 @@
"use client";
-import dynamic from "next/dynamic";
-import { Button } from "~/components/ui/button";
import { MapIcon } from "lucide-react";
-import { useTranslation } from "~/providers/I18nProvider";
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
-} from "~/components/ui/dialog";
+import dynamic from "next/dynamic";
import { useState } from "react";
+import { Button } from "~/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "~/components/ui/dialog";
+import { useTranslation } from "~/providers/I18nProvider";
-const Map = dynamic(() => import("~/components/map/Map"), {
- ssr: false,
+const MapComp = dynamic(() => import("~/components/map/Map"), {
+ ssr: false,
});
export const MappaDialogFullscreen = ({
- lat,
- long,
+ lat,
+ long,
}: {
- lat: string | null;
- long: string | null;
+ lat: string | null;
+ long: string | null;
}) => {
- const { t } = useTranslation();
- const [open, setOpen] = useState(false);
- return (
-
- );
+ const { t } = useTranslation();
+ const [open, setOpen] = useState(false);
+ return (
+
+ );
};
diff --git a/apps/infoalloggi/src/components/accordionComp.tsx b/apps/infoalloggi/src/components/accordionComp.tsx
index c68e2aa..4b5743a 100644
--- a/apps/infoalloggi/src/components/accordionComp.tsx
+++ b/apps/infoalloggi/src/components/accordionComp.tsx
@@ -1,15 +1,15 @@
import { forwardRef, type InputHTMLAttributes } from "react";
import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
} from "~/components/ui/accordion";
import type { Faq } from "~/i18n/locales";
import { cn } from "~/lib/utils";
interface AccordionCompProps extends InputHTMLAttributes
{
- texts: Faq[];
+ texts: Faq[];
}
/**
@@ -29,30 +29,30 @@ interface AccordionCompProps extends InputHTMLAttributes {
* ```
*/
export const AccordionComp = forwardRef(
- ({ texts, className }, ref) => {
- if (!texts || texts.length === 0) {
- return null; // Return null if no texts are provided
- }
- return (
-
-
- {texts.map((text, index) => (
-
-
- {text.title}
-
-
- {text.description}
-
-
- ))}
-
-
- );
- },
+ ({ texts, className }, ref) => {
+ if (!texts || texts.length === 0) {
+ return null; // Return null if no texts are provided
+ }
+ return (
+
+
+ {texts.map((text, index) => (
+
+
+ {text.title}
+
+
+ {text.description}
+
+
+ ))}
+
+
+ );
+ },
);
AccordionComp.displayName = "AccordionComp";
diff --git a/apps/infoalloggi/src/components/acquisto_processing.tsx b/apps/infoalloggi/src/components/acquisto_processing.tsx
index 3626eb1..f5c9d95 100644
--- a/apps/infoalloggi/src/components/acquisto_processing.tsx
+++ b/apps/infoalloggi/src/components/acquisto_processing.tsx
@@ -1,242 +1,241 @@
"use client";
-import { api } from "~/utils/api";
-import { useState, type FormEvent } from "react";
import {
- Elements,
- PaymentElement,
- useElements,
- useStripe,
+ Elements,
+ PaymentElement,
+ useElements,
+ useStripe,
} from "@stripe/react-stripe-js";
+import type { Stripe } from "@stripe/stripe-js";
+import { ArrowRight, ExternalLink } from "lucide-react";
+import Link from "next/link";
+import { type FormEvent, useState } from "react";
+import LoadingButton from "~/components/custom_ui/loading-button";
import { LoadingPage } from "~/components/loading";
import { Status500 } from "~/components/status-page";
-import LoadingButton from "~/components/custom_ui/loading-button";
-import { useTranslation } from "~/providers/I18nProvider";
-import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
-import type { Stripe } from "@stripe/stripe-js";
-import { formatCurrency } from "~/lib/utils";
import { Button } from "~/components/ui/button";
+import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
+import { env } from "~/env.mjs";
+import { formatCurrency } from "~/lib/utils";
+import { useTranslation } from "~/providers/I18nProvider";
import type { PaymentsId } from "~/schemas/public/Payments";
import type { PrezziarioIdprezziario } from "~/schemas/public/Prezziario";
-import { ArrowRight, ExternalLink } from "lucide-react";
-import { env } from "~/env.mjs";
-import Link from "next/link";
+import { api } from "~/utils/api";
type AcquistoProcessingProps = {
- paymentId: PaymentsId;
- packId: PrezziarioIdprezziario;
- stripePromise: Promise;
+ paymentId: PaymentsId;
+ packId: PrezziarioIdprezziario;
+ stripePromise: Promise;
};
export const AcquistoProcessing = ({
- paymentId,
- packId,
- stripePromise,
+ paymentId,
+ packId,
+ stripePromise,
}: AcquistoProcessingProps) => {
- const [stripeIntent, setStripeIntent] = useState<{
- clientSecret: string | null;
- titolo: string;
- prezzo: number;
- descrizione: string;
- } | null>(null);
- const { t } = useTranslation();
- const [generatedIntent, setGeneratedIntent] = useState(false);
+ const [stripeIntent, setStripeIntent] = useState<{
+ clientSecret: string | null;
+ titolo: string;
+ prezzo: number;
+ descrizione: string;
+ } | null>(null);
+ const { t } = useTranslation();
+ const [generatedIntent, setGeneratedIntent] = useState(false);
- const { mutate, isPending } = api.stripe.createIntent.useMutation({
- onSuccess: (data) => {
- setStripeIntent(data);
- },
- });
+ const { mutate, isPending } = api.stripe.createIntent.useMutation({
+ onSuccess: (data) => {
+ setStripeIntent(data);
+ },
+ });
- if (generatedIntent && !isPending && !stripeIntent) {
- return ;
- }
+ if (generatedIntent && !isPending && !stripeIntent) {
+ return ;
+ }
- return (
-
-
- {t.acquisto.titolo}
-
- {!generatedIntent ? (
-
{
- setGeneratedIntent(true);
- mutate({
- paymentId,
- });
- }}
- />
- ) : isPending ? (
-
- ) : (
- stripeIntent &&
- stripeIntent.clientSecret && (
- <>
-
-
-
- >
- )
- )}
-
- );
+ return (
+
+
+ {t.acquisto.titolo}
+
+ {!generatedIntent ? (
+
{
+ setGeneratedIntent(true);
+ mutate({
+ paymentId,
+ });
+ }}
+ />
+ ) : isPending ? (
+
+ ) : (
+ stripeIntent?.clientSecret && (
+ <>
+
+
+
+ >
+ )
+ )}
+
+ );
};
export const PricePreparation = ({
- packId,
- onProcedi,
+ packId,
+ onProcedi,
}: {
- packId: PrezziarioIdprezziario;
- onProcedi: () => void;
+ packId: PrezziarioIdprezziario;
+ onProcedi: () => void;
}) => {
- const { data: prezziario, isLoading } =
- api.prezziario.getPrezzoPerServizio.useQuery({
- idprezziario: packId,
- });
- const { t } = useTranslation();
- return (
-
- {isLoading || !prezziario ? (
- <>
-
{t.acquisto.preparazione}
-
- >
- ) : (
-
-
- {t.acquisto.servizi_acquisto}
-
+ const { data: prezziario, isLoading } =
+ api.prezziario.getPrezzoPerServizio.useQuery({
+ idprezziario: packId,
+ });
+ const { t } = useTranslation();
+ return (
+
+ {isLoading || !prezziario ? (
+ <>
+
{t.acquisto.preparazione}
+
+ >
+ ) : (
+
+
+ {t.acquisto.servizi_acquisto}
+
-
-
{prezziario.nome_it}
-
- Cod: “{prezziario.idprezziario}”
-
-
- {formatCurrency(prezziario.prezzo_cent / 100)}
-
-
{prezziario.desc_it}
-
+
+
{prezziario.nome_it}
+
+ Cod: “{prezziario.idprezziario}”
+
+
+ {formatCurrency(prezziario.prezzo_cent / 100)}
+
+
{prezziario.desc_it}
+
- {prezziario.testo_condizioni && (
-
-
-
- )}
+ {prezziario.testo_condizioni && (
+
+
+
+ )}
-
-
- )}
-
- );
+
+
+ )}
+
+ );
};
const CheckoutForm = ({
- titolo,
- prezzo,
- descrizione,
+ titolo,
+ prezzo,
+ descrizione,
}: {
- titolo: string;
- prezzo: number;
- descrizione: string;
+ titolo: string;
+ prezzo: number;
+ descrizione: string;
}) => {
- const stripe = useStripe();
- const elements = useElements();
+ const stripe = useStripe();
+ const elements = useElements();
- const [message, setMessage] = useState(null);
- const [isLoading, setIsLoading] = useState(false);
+ const [message, setMessage] = useState(null);
+ const [isLoading, setIsLoading] = useState(false);
- const { t } = useTranslation();
+ const { t } = useTranslation();
- const handleSubmit = async (e: FormEvent) => {
- e.preventDefault();
- console.log("submitting payment");
- if (!stripe || !elements) {
- return;
- }
+ const handleSubmit = async (e: FormEvent) => {
+ e.preventDefault();
+ console.log("submitting payment");
+ if (!stripe || !elements) {
+ return;
+ }
- setIsLoading(true);
- const { error } = await stripe.confirmPayment({
- elements,
- confirmParams: {
- return_url: `${env.NEXT_PUBLIC_BASE_URL}/servizio/acquisto-processing`,
- },
- });
- if (error.type === "card_error" || error.type === "validation_error") {
- setMessage(error.message || "An unexpected error occurred.");
- } else {
- setMessage("An unexpected error occurred.");
- }
- setIsLoading(false);
- };
+ setIsLoading(true);
+ const { error } = await stripe.confirmPayment({
+ elements,
+ confirmParams: {
+ return_url: `${env.NEXT_PUBLIC_BASE_URL}/servizio/acquisto-processing`,
+ },
+ });
+ if (error.type === "card_error" || error.type === "validation_error") {
+ setMessage(error.message || "An unexpected error occurred.");
+ } else {
+ setMessage("An unexpected error occurred.");
+ }
+ setIsLoading(false);
+ };
- return (
-
-
-
- {titolo}
-
- {descrizione}
-
-
- {formatCurrency(prezzo / 100)}
- {" "}
-
- {t.pricing_cmp.risultati_iva}
-
-
-
-
-
+
+
+ );
};
diff --git a/apps/infoalloggi/src/components/acquisto_receipt.tsx b/apps/infoalloggi/src/components/acquisto_receipt.tsx
index a781b10..f483d81 100644
--- a/apps/infoalloggi/src/components/acquisto_receipt.tsx
+++ b/apps/infoalloggi/src/components/acquisto_receipt.tsx
@@ -1,187 +1,187 @@
"use client";
+import { format } from "date-fns";
+import { it } from "date-fns/locale";
+import Image from "next/image";
+import { useRef } from "react";
+import { useReactToPrint } from "react-to-print";
import { Button } from "~/components/ui/button";
import { Card } from "~/components/ui/card";
-import Image from "next/image";
-import { format } from "date-fns";
-import { useReactToPrint } from "react-to-print";
-import { it } from "date-fns/locale";
-import { formatCurrency } from "~/lib/utils";
-import { useRef } from "react";
import { PaymentMethodToString, type PaymentType } from "~/i18n/stripe";
+import { formatCurrency } from "~/lib/utils";
export function ReceiptGenerator({ data }: { data: PurchaseData }) {
- const contentRef = useRef(null);
- const reactToPrintFn = useReactToPrint({
- contentRef,
- //print: async (target) => {console.log("Printing...", target.contentDocument);},
- });
- return (
-
-
-
-
Ricevuta di cortesia
+ const contentRef = useRef
(null);
+ const reactToPrintFn = useReactToPrint({
+ contentRef,
+ //print: async (target) => {console.log("Printing...", target.contentDocument);},
+ });
+ return (
+
+
+
+
Ricevuta di cortesia
-
-
-
-
-
-
-
- );
+
+
+
+
+
+
+
+ );
}
interface Item {
- description: string;
- price: number;
- discount: number;
+ description: string;
+ price: number;
+ discount: number;
}
export interface PurchaseData {
- paymentId: string;
- date: Date;
+ paymentId: string;
+ date: Date;
- clienteNome: string;
- clienteIndirizzo: string;
- paymentMethod: string;
- items: Item[];
+ clienteNome: string;
+ clienteIndirizzo: string;
+ paymentMethod: string;
+ items: Item[];
}
interface ReceiptProps {
- data: PurchaseData;
+ data: PurchaseData;
}
function Receipt({ data }: ReceiptProps) {
- const companyName = "Arcenia S.r.l.";
+ const companyName = "Arcenia S.r.l.";
- const companyAddress =
- "Via Beata Giovanna 1\nBassano del Grappa (VI) 36061\nItalia";
+ const companyAddress =
+ "Via Beata Giovanna 1\nBassano del Grappa (VI) 36061\nItalia";
- const total = data.items.reduce(
- (acc, item) => acc + item.price * (1 - item.discount),
- 0,
- );
- const note =
- "La presente è non costituisce ricevuta o fattura fiscale.\nRiceverai la fattura elettronica direttamente al tuo indirizzo di posta.";
- const footer =
- "Arcenia Srl. | Tel. +39 0424529869 | Email: arca@infoalloggi.it";
- return (
-
-
-
-
-
{companyName}
-
{companyAddress}
-
+ const total = data.items.reduce(
+ (acc, item) => acc + item.price * (1 - item.discount),
+ 0,
+ );
+ const note =
+ "La presente è non costituisce ricevuta o fattura fiscale.\nRiceverai la fattura elettronica direttamente al tuo indirizzo di posta.";
+ const footer =
+ "Arcenia Srl. | Tel. +39 0424529869 | Email: arca@infoalloggi.it";
+ return (
+
+
+
+
+
{companyName}
+
{companyAddress}
+
-
-
-
-
-
-
- Ricevuta di cortesia
-
-
-
-
ID Pagamento
-
{data.paymentId}
-
-
-
Data
-
- {format(data.date, "PPP", {
- locale: it,
- })}
-
-
- {format(data.date, "p", {
- locale: it,
- })}
-
-
-
-
-
-
-
Intestatario:
-
{data.clienteNome}
-
- {data.clienteIndirizzo}
-
-
-
-
-
-
-
- | Descrizione |
- Prezzo |
- Sconto |
- Importo |
-
-
-
- {data.items.map((item, idx) => (
-
- | {item.description} |
-
- {formatCurrency(item.price)}
- |
-
- {item.discount > 0
- ? `-${(item.discount * 100).toFixed(0)}%`
- : ""}
- |
-
- {formatCurrency(item.price * (1 - item.discount))}
- |
-
- ))}
-
-
-
-
-
-
- Totale:
- {formatCurrency(total)}
-
-
- di cui IVA (22%):
- {formatCurrency(total * 0.22)}
-
-
-
-
-
-
-
Metodo di pagamento
-
{PaymentMethodToString(data.paymentMethod as PaymentType)}
-
-
-
Status pagamento
-
Pagato
-
-
-
-
+
+
+
+
+
+
+ Ricevuta di cortesia
+
+
+
+
ID Pagamento
+
{data.paymentId}
+
+
+
Data
+
+ {format(data.date, "PPP", {
+ locale: it,
+ })}
+
+
+ {format(data.date, "p", {
+ locale: it,
+ })}
+
+
+
+
+
+
+
Intestatario:
+
{data.clienteNome}
+
+ {data.clienteIndirizzo}
+
+
+
+
+
+
+
+ | Descrizione |
+ Prezzo |
+ Sconto |
+ Importo |
+
+
+
+ {data.items.map((item, idx) => (
+
+ | {item.description} |
+
+ {formatCurrency(item.price)}
+ |
+
+ {item.discount > 0
+ ? `-${(item.discount * 100).toFixed(0)}%`
+ : ""}
+ |
+
+ {formatCurrency(item.price * (1 - item.discount))}
+ |
+
+ ))}
+
+
+
+
+
+
+ Totale:
+ {formatCurrency(total)}
+
+
+ di cui IVA (22%):
+ {formatCurrency(total * 0.22)}
+
+
+
+
+
+
+
Metodo di pagamento
+
{PaymentMethodToString(data.paymentMethod as PaymentType)}
+
+
+
Status pagamento
+
Pagato
+
+
+
+
-
-
-
- );
+
+
+
+ );
}
diff --git a/apps/infoalloggi/src/components/allegato-iframe.tsx b/apps/infoalloggi/src/components/allegato-iframe.tsx
index f4a41a8..f514db3 100644
--- a/apps/infoalloggi/src/components/allegato-iframe.tsx
+++ b/apps/infoalloggi/src/components/allegato-iframe.tsx
@@ -1,56 +1,57 @@
+import { useEffect, useRef, useState } from "react";
+import { LoadingPage } from "~/components/loading";
import { cn } from "~/lib/utils";
import type { TempTokensToken } from "~/schemas/public/TempTokens";
import { api } from "~/utils/api";
-import { LoadingPage } from "~/components/loading";
-import { useEffect, useRef, useState } from "react";
export const AllegatoIframe = ({
- className,
- allegato,
+ className,
+ allegato,
}: {
- className?: string;
- allegato: string;
+ className?: string;
+ allegato: string;
}) => {
- const if_ref = useRef(null);
- const { mutateAsync: getToken } = api.storage.getStorageToken.useMutation();
- const [token, setToken] = useState(null);
- const handleIframeLoad = () => {
- if (if_ref.current && if_ref.current.contentWindow) {
- const img = if_ref.current.contentWindow.document.querySelector("img");
- if (img) {
- img.style.width = "100%";
- img.style.height = "100%";
- img.style.objectFit = "contain";
- }
- }
- };
- useEffect(() => {
- async function set() {
- const token = await getToken();
- setToken(token);
- }
- set().catch((e) => console.error(e));
- }, []);
+ const if_ref = useRef(null);
+ const { mutateAsync: getToken } = api.storage.getStorageToken.useMutation();
+ const [token, setToken] = useState(null);
+ const handleIframeLoad = () => {
+ if (if_ref.current?.contentWindow) {
+ const img = if_ref.current.contentWindow.document.querySelector("img");
+ if (img) {
+ img.style.width = "100%";
+ img.style.height = "100%";
+ img.style.objectFit = "contain";
+ }
+ }
+ };
+ useEffect(() => {
+ async function set() {
+ const token = await getToken();
+ setToken(token);
+ }
+ set().catch((e) => console.error(e));
+ }, []);
- if (!token) return ;
+ if (!token) return ;
- const requestUrl = `/go-api/storage/get/${allegato}?token=${String(token)}`;
+ const requestUrl = `/go-api/storage/get/${allegato}?token=${String(token)}`;
- return (
-
-
-
- );
+ return (
+
+ {/** biome-ignore lint/a11y/noNoninteractiveElementInteractions: */}
+
+
+ );
};
diff --git a/apps/infoalloggi/src/components/annunci_grid.tsx b/apps/infoalloggi/src/components/annunci_grid.tsx
index 0592d0c..83fd533 100644
--- a/apps/infoalloggi/src/components/annunci_grid.tsx
+++ b/apps/infoalloggi/src/components/annunci_grid.tsx
@@ -1,34 +1,34 @@
-import { getTitoloTranslation } from "~/lib/annuncio_details";
import { CardAnnuncio } from "~/components/annuncio_card";
+import { getTitoloTranslation } from "~/lib/annuncio_details";
import { useTranslation } from "~/providers/I18nProvider";
import type { AnnuncioRicerca } from "~/server/controllers/annunci.controller";
export const AnnunciGrid = ({ pagedata }: { pagedata: AnnuncioRicerca[] }) => {
- const { locale } = useTranslation();
+ const { locale } = useTranslation();
- return (
-
- {pagedata.map((annuncio) => (
-
- ))}
-
- );
+ return (
+
+ {pagedata.map((annuncio) => (
+
+ ))}
+
+ );
};
diff --git a/apps/infoalloggi/src/components/annunci_map.tsx b/apps/infoalloggi/src/components/annunci_map.tsx
index c48a006..691303e 100644
--- a/apps/infoalloggi/src/components/annunci_map.tsx
+++ b/apps/infoalloggi/src/components/annunci_map.tsx
@@ -1,161 +1,161 @@
+import { AnimatePresence, motion } from "framer-motion";
import dynamic from "next/dynamic";
-import type { AnnuncioRicercaWPosition } from "~/server/controllers/annunci.controller";
-import { api } from "~/utils/api";
+import Image from "next/image";
+import {
+ type Dispatch,
+ Fragment,
+ memo,
+ type SetStateAction,
+ useState,
+} from "react";
import { LoadingPage } from "~/components/loading";
import { Status500 } from "~/components/status-page";
-import { useTranslation } from "~/providers/I18nProvider";
-import { AnimatePresence, motion } from "framer-motion";
-import Image from "next/image";
-import { formatCurrency } from "~/lib/utils";
import { handleConsegna } from "~/lib/annuncio_details";
-import {
- Fragment,
- memo,
- useState,
- type Dispatch,
- type SetStateAction,
-} from "react";
+import { formatCurrency } from "~/lib/utils";
+import { useTranslation } from "~/providers/I18nProvider";
import { useRicerca } from "~/providers/RicercaProvider";
+import type { AnnuncioRicercaWPosition } from "~/server/controllers/annunci.controller";
+import { api } from "~/utils/api";
-const Map = dynamic(() => import("~/components/map/Map"), {
- ssr: false,
+const MapComp = dynamic(() => import("~/components/map/Map"), {
+ ssr: false,
});
export const MapSection = () => {
- const { comune, consegna, tipo } = useRicerca();
- const [selected, setSelected] = useState(
- null,
- );
+ const { comune, consegna, tipo } = useRicerca();
+ const [selected, setSelected] = useState(
+ null,
+ );
- return (
-
-
-
-
- );
+ return (
+
+
+
+
+ );
};
const MapDisplay = memo(
- ({
- selectTipo,
- selectComune,
- selectConsegna,
- setSelected,
- }: {
- selectTipo: string;
- selectComune: string;
- selectConsegna: number | null;
- setSelected: Dispatch>;
- }) => {
- const { data, isLoading } = api.annunci.getMapping.useQuery({
- tipologia: selectTipo,
- comune: selectComune,
- consegna: selectConsegna || undefined,
- });
+ ({
+ selectTipo,
+ selectComune,
+ selectConsegna,
+ setSelected,
+ }: {
+ selectTipo: string;
+ selectComune: string;
+ selectConsegna: number | null;
+ setSelected: Dispatch>;
+ }) => {
+ const { data, isLoading } = api.annunci.getMapping.useQuery({
+ tipologia: selectTipo,
+ comune: selectComune,
+ consegna: selectConsegna || undefined,
+ });
- if (isLoading) return ;
- if (!data) return ;
+ if (isLoading) return ;
+ if (!data) return ;
- const posizioni = data
- .map((a) => {
- if (a.lat_secondario && a.lon_secondario) {
- return {
- pos: {
- lat: parseFloat(a.lat_secondario),
- lng: parseFloat(a.lon_secondario),
- },
- onClick: () => setSelected(a),
- markerTxt: `€ ${a.prezzo / 1e2}`,
- };
- }
- return undefined;
- })
- .filter((a) => a !== undefined);
+ const posizioni = data
+ .map((a) => {
+ if (a.lat_secondario && a.lon_secondario) {
+ return {
+ pos: {
+ lat: parseFloat(a.lat_secondario),
+ lng: parseFloat(a.lon_secondario),
+ },
+ onClick: () => setSelected(a),
+ markerTxt: `€ ${a.prezzo / 1e2}`,
+ };
+ }
+ return undefined;
+ })
+ .filter((a) => a !== undefined);
- return (
-