fix: update PDF filename format in ReceiptGenerator and whIntentSucceededHandler to include customer name and date

This commit is contained in:
Marco Pedone 2026-03-10 11:28:52 +01:00
parent 464e5285a1
commit 09479eb9f2
2 changed files with 3 additions and 2 deletions

View file

@ -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();

View file

@ -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",