fix: PDF headers with filename, email download button via protected route
All checks were successful
Staging Build / build (push) Successful in 3m29s
All checks were successful
Staging Build / build (push) Successful in 3m29s
This commit is contained in:
@@ -115,12 +115,13 @@ export async function GET(
|
||||
const downloadFileName = `Anfragebestaetigung_${order.order_number || id.slice(0, 8)}.pdf`;
|
||||
|
||||
const headers = new Headers();
|
||||
headers.append("Content-Type", "application/pdf");
|
||||
headers.append("Cache-Control", "private, no-cache");
|
||||
if (inline) {
|
||||
headers.append("Content-Disposition", "inline");
|
||||
headers.append("Content-Disposition", `inline; filename="${downloadFileName}"`);
|
||||
} else {
|
||||
headers.append("Content-Disposition", `attachment; filename="${downloadFileName}"`);
|
||||
}
|
||||
headers.append("Content-Type", "application/pdf");
|
||||
|
||||
return new NextResponse(fileBuffer as any, {
|
||||
status: 200,
|
||||
|
||||
@@ -115,12 +115,13 @@ export async function GET(
|
||||
const downloadFileName = `Anfragebestaetigung_${order.order_number || id.slice(0, 8)}.pdf`;
|
||||
|
||||
const headers = new Headers();
|
||||
headers.append("Content-Type", "application/pdf");
|
||||
headers.append("Cache-Control", "private, no-cache");
|
||||
if (inline) {
|
||||
headers.append("Content-Disposition", "inline");
|
||||
headers.append("Content-Disposition", `inline; filename="${downloadFileName}"`);
|
||||
} else {
|
||||
headers.append("Content-Disposition", `attachment; filename="${downloadFileName}"`);
|
||||
}
|
||||
headers.append("Content-Type", "application/pdf");
|
||||
|
||||
return new NextResponse(fileBuffer as any, {
|
||||
status: 200,
|
||||
|
||||
@@ -327,7 +327,7 @@ export async function submitOrder(params: {
|
||||
await sendMail({
|
||||
to: user.email,
|
||||
subject: `Anfragebestätigung ${orderNumber}`,
|
||||
text: `Hallo,\n\nvielen Dank für Ihre Anfrage bei CASPOS Shop!\n\nAnfragedetails:\n- Anfrage-Nummer: ${orderNumber}\n- Datum: ${formattedDate}\n- Endkunde: ${customerSnapshot.company_name}\n${totalDetailsText}\n\nIm Anhang dieser E-Mail finden Sie Ihre Anfragebestätigung als PDF-Dokument.\n\nViele Grüße,\nIhr CASPOS Shop-Team`,
|
||||
text: `Hallo,\n\nvielen Dank für Ihre Anfrage bei CASPOS Shop!\n\nAnfragedetails:\n- Anfrage-Nummer: ${orderNumber}\n- Datum: ${formattedDate}\n- Endkunde: ${customerSnapshot.company_name}\n${totalDetailsText}\n\nIm Anhang dieser E-Mail finden Sie Ihre Anfragebestätigung als PDF-Dokument.\n\nPDF herunterladen: ${process.env.NEXT_PUBLIC_SITE_URL || 'https://staging.hephex.de'}/api/orders/${order.id}/download\n\nViele Grüße,\nIhr CASPOS Shop-Team`,
|
||||
html: `
|
||||
<div style="font-family: sans-serif; max-width: 600px; margin: 0 auto; padding: 20px; border: 1px solid #e2e8f0; border-radius: 8px;">
|
||||
<h2 style="color: #0f172a; margin-bottom: 16px;">Vielen Dank für Ihre Anfrage!</h2>
|
||||
@@ -352,6 +352,9 @@ export async function submitOrder(params: {
|
||||
</table>
|
||||
</div>
|
||||
<p style="color: #475569; font-size: 16px; line-height: 1.5;">Im Anhang dieser E-Mail finden Sie Ihre Anfragebestätigung als PDF-Dokument.</p>
|
||||
<div style="text-align: center; margin: 24px 0;">
|
||||
<a href="${process.env.NEXT_PUBLIC_SITE_URL || 'https://staging.hephex.de'}/api/orders/${order.id}/download" style="display: inline-block; background-color: #3b82f6; color: #ffffff; text-decoration: none; padding: 12px 24px; border-radius: 6px; font-weight: bold; font-size: 14px;">📄 PDF herunterladen</a>
|
||||
</div>
|
||||
<p style="color: #475569; font-size: 16px; line-height: 1.5; margin-top: 24px;">Mit freundlichen Grüßen,<br>Ihr CASPOS Shop-Team</p>
|
||||
<hr style="border: 0; border-top: 1px solid #e2e8f0; margin: 24px 0;">
|
||||
<p style="color: #94a3b8; font-size: 12px; text-align: center;">Diese E-Mail wurde automatisch generiert. Bitte antworten Sie nicht darauf.</p>
|
||||
@@ -755,7 +758,7 @@ export async function updateOrder(
|
||||
await sendMail({
|
||||
to: orderUserEmail,
|
||||
subject: `Anfrageänderung ${order.order_number}`,
|
||||
text: `Hallo,\n\nihre Anfrage wurde erfolgreich aktualisiert!\n\nNeue Anfragedetails:\n- Anfrage-Nummer: ${order.order_number}\n- Datum: ${formattedDate}\n- Endkunde: ${customerSnapshot.company_name}\n${totalDetailsText}\n\nIm Anhang dieser E-Mail finden Sie Ihre aktualisierte Anfrage als PDF-Dokument.\n\nViele Grüße,\nIhr CASPOS Shop-Team`,
|
||||
text: `Hallo,\n\nihre Anfrage wurde erfolgreich aktualisiert!\n\nNeue Anfragedetails:\n- Anfrage-Nummer: ${order.order_number}\n- Datum: ${formattedDate}\n- Endkunde: ${customerSnapshot.company_name}\n${totalDetailsText}\n\nIm Anhang dieser E-Mail finden Sie Ihre aktualisierte Anfrage als PDF-Dokument.\n\nPDF herunterladen: ${process.env.NEXT_PUBLIC_SITE_URL || 'https://staging.hephex.de'}/api/orders/${order.id}/download\n\nViele Grüße,\nIhr CASPOS Shop-Team`,
|
||||
html: `
|
||||
<div style="font-family: sans-serif; max-width: 600px; margin: 0 auto; padding: 20px; border: 1px solid #e2e8f0; border-radius: 8px;">
|
||||
<h2 style="color: #0f172a; margin-bottom: 16px;">Ihre Anfrage wurde aktualisiert!</h2>
|
||||
@@ -780,6 +783,9 @@ export async function updateOrder(
|
||||
</table>
|
||||
</div>
|
||||
<p style="color: #475569; font-size: 16px; line-height: 1.5;">Im Anhang dieser E-Mail finden Sie Ihre aktualisierte Anfragebestätigung als PDF-Dokument.</p>
|
||||
<div style="text-align: center; margin: 24px 0;">
|
||||
<a href="${process.env.NEXT_PUBLIC_SITE_URL || 'https://staging.hephex.de'}/api/orders/${order.id}/download" style="display: inline-block; background-color: #3b82f6; color: #ffffff; text-decoration: none; padding: 12px 24px; border-radius: 6px; font-weight: bold; font-size: 14px;">📄 PDF herunterladen</a>
|
||||
</div>
|
||||
<p style="color: #475569; font-size: 16px; line-height: 1.5; margin-top: 24px;">Mit freundlichen Grüßen,<br>Ihr CASPOS Shop-Team</p>
|
||||
</div>
|
||||
`,
|
||||
|
||||
Reference in New Issue
Block a user