From 09479eb9f26704a202b3c22050340267269cd88c Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Tue, 10 Mar 2026 11:28:52 +0100 Subject: [PATCH] fix: update PDF filename format in ReceiptGenerator and whIntentSucceededHandler to include customer name and date --- apps/infoalloggi/src/components/acquisto_receipt.tsx | 2 +- apps/infoalloggi/src/server/controllers/stripe.controller.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/infoalloggi/src/components/acquisto_receipt.tsx b/apps/infoalloggi/src/components/acquisto_receipt.tsx index 4f8556b..34e6564 100644 --- a/apps/infoalloggi/src/components/acquisto_receipt.tsx +++ b/apps/infoalloggi/src/components/acquisto_receipt.tsx @@ -36,7 +36,7 @@ export function ReceiptGenerator({ const url = window.URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; - link.download = `ricevuta-cortesia-${format(data.date, "yyyy-MM-dd")}.pdf`; + link.download = `ricevuta-cortesia-${data.clienteNome}-${format(data.date, "dd-MM-yyyy")}.pdf`; document.body.appendChild(link); link.click(); link.remove(); diff --git a/apps/infoalloggi/src/server/controllers/stripe.controller.ts b/apps/infoalloggi/src/server/controllers/stripe.controller.ts index d9033e1..421025e 100644 --- a/apps/infoalloggi/src/server/controllers/stripe.controller.ts +++ b/apps/infoalloggi/src/server/controllers/stripe.controller.ts @@ -1,4 +1,5 @@ import { TRPCError } from "@trpc/server"; +import { format } from "date-fns"; import { env } from "~/env"; import stripe from "~/lib/stripe"; import OrderTypeEnum from "~/schemas/public/OrderTypeEnum"; @@ -282,7 +283,7 @@ export const whIntentSucceededHandler = async ({ to: "web@infoalloggi.it", attachments: [ { - filename: `ricevuta_cortesia_${ordine.ordine_id}.pdf`, + filename: `ricevuta_cortesia_${utente.username}-${format(ordine.created_at, "dd-MM-yyyy")}.pdf`, generate: { type: "ricevuta_cortesia",