From 4dff005c35f396971dd0b4db97cc6f2f5aa08c3f Mon Sep 17 00:00:00 2001 From: Riyadh Date: Mon, 4 May 2026 15:57:11 +0000 Subject: [PATCH] Update PDF export to use localized filenames and remove extra text Modify the API server and frontend to generate dynamic, localized PDF filenames for executive meetings, and remove descriptive text from the PDF export page. --- artifacts/api-server/src/routes/executive-meetings.ts | 4 +++- artifacts/tx-os/src/locales/ar.json | 4 ++-- artifacts/tx-os/src/locales/en.json | 4 ++-- artifacts/tx-os/src/pages/executive-meetings.tsx | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/artifacts/api-server/src/routes/executive-meetings.ts b/artifacts/api-server/src/routes/executive-meetings.ts index fc70b8ec..fa944d79 100644 --- a/artifacts/api-server/src/routes/executive-meetings.ts +++ b/artifacts/api-server/src/routes/executive-meetings.ts @@ -2749,10 +2749,12 @@ router.get( console.error("[executive-meetings] PDF archive insert failed", err); } + const dayName = new Intl.DateTimeFormat(langRaw === "ar" ? "ar-SA" : "en-US", { weekday: "long" }).format(new Date(dateRaw + "T00:00:00")); + const pdfFileName = langRaw === "ar" ? `قائمة الاجتماعات يوم ${dayName}.pdf` : `meetings-${dayName}.pdf`; res.setHeader("Content-Type", "application/pdf"); res.setHeader( "Content-Disposition", - `attachment; filename="executive-meetings-${dateRaw}.pdf"`, + `attachment; filename="${encodeURIComponent(pdfFileName)}"; filename*=UTF-8''${encodeURIComponent(pdfFileName)}`, ); res.setHeader("Content-Length", String(pdf.byteLength)); res.setHeader("Cache-Control", "no-store"); diff --git a/artifacts/tx-os/src/locales/ar.json b/artifacts/tx-os/src/locales/ar.json index 08b83e6a..bb7c8067 100644 --- a/artifacts/tx-os/src/locales/ar.json +++ b/artifacts/tx-os/src/locales/ar.json @@ -1400,9 +1400,9 @@ }, "pdf": { "heading": "تصدير PDF", - "intro": "يتم توليد ملف PDF حقيقي لجدول اليوم على الخادم باستخدام إعدادات الخط المحفوظة. كل عملية تنزيل تتم أرشفتها.", + "intro": "", "downloadPdf": "تنزيل PDF", - "downloadHint": "يُولَّد ملف PDF حسب تفضيلات الخط (النوع، الحجم، الوزن، المحاذاة) مع تشكيل عربي صحيح من اليمين لليسار.", + "downloadHint": "", "downloaded": "بدأ تنزيل ملف PDF", "selectDate": "تاريخ الجدول", "archivesHeading": "ملفات PDF المؤرشفة", diff --git a/artifacts/tx-os/src/locales/en.json b/artifacts/tx-os/src/locales/en.json index 269464fb..468ed3a9 100644 --- a/artifacts/tx-os/src/locales/en.json +++ b/artifacts/tx-os/src/locales/en.json @@ -1266,9 +1266,9 @@ }, "pdf": { "heading": "PDF Export", - "intro": "Generates a real PDF of the day's schedule on the server using your saved font settings. Each download is archived.", + "intro": "", "downloadPdf": "Download PDF", - "downloadHint": "The PDF is generated using your font preferences (family, size, weight, alignment) with proper Arabic shaping.", + "downloadHint": "", "downloaded": "PDF download started", "selectDate": "Schedule date", "archivesHeading": "Archived PDFs", diff --git a/artifacts/tx-os/src/pages/executive-meetings.tsx b/artifacts/tx-os/src/pages/executive-meetings.tsx index afe0811f..c8f731ac 100644 --- a/artifacts/tx-os/src/pages/executive-meetings.tsx +++ b/artifacts/tx-os/src/pages/executive-meetings.tsx @@ -7095,7 +7095,9 @@ function PdfSection({ const url = `/api/executive-meetings/pdf?date=${encodeURIComponent( date, )}&lang=${encodeURIComponent(lang)}`; - await downloadBinary(url, `executive-meetings-${date}.pdf`); + const dayName = new Intl.DateTimeFormat(lang === "ar" ? "ar-SA" : "en-US", { weekday: "long" }).format(new Date(date + "T00:00:00")); + const fileName = lang === "ar" ? `قائمة الاجتماعات يوم ${dayName}.pdf` : `meetings-${dayName}.pdf`; + await downloadBinary(url, fileName); // Refresh archives so the row created by the GET appears. await qc.invalidateQueries({ queryKey: ["/api/executive-meetings/pdf-archives", date],