318 lines
22 KiB
JavaScript
318 lines
22 KiB
JavaScript
import { readFile } from "node:fs/promises";
|
||
import { fileURLToPath } from "node:url";
|
||
import { dirname, resolve } from "node:path";
|
||
// Helper function to convert date from yyyy-mm-dd to dd.mm.yyyy
|
||
function formatDateGerman(dateString) {
|
||
const [year, month, day] = dateString.split('-');
|
||
return `${day}.${month}.${year}`;
|
||
}
|
||
let cachedLogoDataUrl = null;
|
||
async function getLogoDataUrl() {
|
||
if (cachedLogoDataUrl)
|
||
return cachedLogoDataUrl;
|
||
try {
|
||
const __filename = fileURLToPath(import.meta.url);
|
||
const __dirname = dirname(__filename);
|
||
const logoPath = resolve(__dirname, "../../../assets/stargilnails_logo_transparent.png");
|
||
const buf = await readFile(logoPath);
|
||
const base64 = buf.toString("base64");
|
||
cachedLogoDataUrl = `data:image/png;base64,${base64}`;
|
||
return cachedLogoDataUrl;
|
||
}
|
||
catch {
|
||
return null;
|
||
}
|
||
}
|
||
async function renderBrandedEmail(title, bodyHtml) {
|
||
const logo = await getLogoDataUrl();
|
||
const domain = process.env.DOMAIN || 'localhost:5173';
|
||
const protocol = domain.includes('localhost') ? 'http' : 'https';
|
||
const homepageUrl = `${protocol}://${domain}`;
|
||
const instagramProfile = process.env.INSTAGRAM_PROFILE;
|
||
const tiktokProfile = process.env.TIKTOK_PROFILE;
|
||
const companyName = process.env.COMPANY_NAME || 'Stargirlnails Kiel';
|
||
return `
|
||
<div style="font-family: Arial, sans-serif; color: #0f172a; background:#fdf2f8; padding:24px;">
|
||
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="max-width:640px; margin:0 auto; background:#ffffff; border-radius:12px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.06)">
|
||
<tr>
|
||
<td style="padding:24px 24px 0 24px; text-align:center;">
|
||
${logo ? `<img src="${logo}" alt="${companyName}" style="width:120px; height:auto; display:inline-block;" />` : `<div style=\"font-size:24px\">💅</div>`}
|
||
<div style="margin:16px 0 4px 0; font-size:16px; font-weight:600; color:#64748b;">${companyName}</div>
|
||
<h1 style="margin:0; font-size:22px; color:#db2777;">${title}</h1>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td style="padding:16px 24px 24px 24px;">
|
||
<div style="font-size:16px; line-height:1.6; color:#334155;">
|
||
${bodyHtml}
|
||
</div>
|
||
<hr style="border:none; border-top:1px solid #f1f5f9; margin:24px 0" />
|
||
<div style="text-align:center; margin-bottom:16px;">
|
||
<a href="${homepageUrl}" style="display: inline-block; background-color: #db2777; color: white; padding: 12px 24px; text-decoration: none; border-radius: 6px; font-weight: 600; font-size: 14px;">Zur Website</a>
|
||
</div>
|
||
${(instagramProfile || tiktokProfile) ? `
|
||
<div style="text-align:center; margin-bottom:16px;">
|
||
<p style="font-size:14px; color:#64748b; margin:0 0 8px 0;">Folge uns auf Social Media:</p>
|
||
<div style="display:inline-block;">
|
||
${instagramProfile ? `
|
||
<a href="${instagramProfile}" target="_blank" rel="noopener noreferrer" style="display:inline-block; margin:0 6px; background:linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); color:white; padding:10px 20px; text-decoration:none; border-radius:20px; font-size:14px; font-weight:600;">
|
||
<svg width="16" height="16" fill="currentColor" viewBox="0 0 24 24" style="vertical-align:middle; margin-right:6px;">
|
||
<path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/>
|
||
</svg>
|
||
Instagram
|
||
</a>
|
||
` : ''}
|
||
${tiktokProfile ? `
|
||
<a href="${tiktokProfile}" target="_blank" rel="noopener noreferrer" style="display:inline-block; margin:0 6px; background:#000000; color:white; padding:10px 20px; text-decoration:none; border-radius:20px; font-size:14px; font-weight:600;">
|
||
<svg width="16" height="16" fill="currentColor" viewBox="0 0 24 24" style="vertical-align:middle; margin-right:6px;">
|
||
<path d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1z"/>
|
||
</svg>
|
||
TikTok
|
||
</a>
|
||
` : ''}
|
||
</div>
|
||
</div>
|
||
` : ''}
|
||
<div style="font-size:12px; color:#64748b; text-align:center;">
|
||
© ${new Date().getFullYear()} Stargirlnails Kiel • Professional Nail Care
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>`;
|
||
}
|
||
export async function renderBookingPendingHTML(params) {
|
||
const { name, date, time, statusUrl } = params;
|
||
const formattedDate = formatDateGerman(date);
|
||
const domain = process.env.DOMAIN || 'localhost:5173';
|
||
const protocol = domain.includes('localhost') ? 'http' : 'https';
|
||
const legalUrl = `${protocol}://${domain}/legal`;
|
||
const inner = `
|
||
<p>Hallo ${name},</p>
|
||
<p>wir haben deine Anfrage für <strong>${formattedDate}</strong> um <strong>${time}</strong> erhalten.</p>
|
||
<p>Wir bestätigen deinen Termin in Kürze. Du erhältst eine weitere E-Mail, sobald der Termin bestätigt ist.</p>
|
||
${statusUrl ? `
|
||
<div style="background-color: #fef9f5; border-left: 4px solid #f59e0b; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #f59e0b;">⏳ Termin-Status ansehen:</p>
|
||
<p style="margin: 8px 0 12px 0; color: #475569;">Du kannst den aktuellen Status deiner Buchung jederzeit einsehen:</p>
|
||
<a href="${statusUrl}" style="display: inline-block; background-color: #f59e0b; color: white; padding: 12px 24px; text-decoration: none; border-radius: 6px; font-weight: 600;">Status ansehen</a>
|
||
</div>
|
||
` : ''}
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #3b82f6; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #3b82f6;">📋 Rechtliche Informationen:</p>
|
||
<p style="margin: 8px 0 12px 0; color: #475569;">Weitere Informationen findest du in unserem <a href="${legalUrl}" style="color: #3b82f6; text-decoration: underline;">Impressum und Datenschutz</a>.</p>
|
||
</div>
|
||
<p>Liebe Grüße,<br/>Stargirlnails Kiel</p>
|
||
`;
|
||
return renderBrandedEmail("Deine Terminanfrage ist eingegangen", inner);
|
||
}
|
||
export async function renderBookingConfirmedHTML(params) {
|
||
const { name, date, time, cancellationUrl, reviewUrl } = params;
|
||
const formattedDate = formatDateGerman(date);
|
||
const domain = process.env.DOMAIN || 'localhost:5173';
|
||
const protocol = domain.includes('localhost') ? 'http' : 'https';
|
||
const legalUrl = `${protocol}://${domain}/legal`;
|
||
const inner = `
|
||
<p>Hallo ${name},</p>
|
||
<p>wir haben deinen Termin am <strong>${formattedDate}</strong> um <strong>${time}</strong> bestätigt.</p>
|
||
<p>Wir freuen uns auf dich!</p>
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #db2777; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #db2777;">📋 Wichtiger Hinweis:</p>
|
||
<p style="margin: 8px 0 0 0; color: #475569;">Die Allgemeinen Geschäftsbedingungen (AGB) findest du im Anhang dieser E-Mail. Bitte lies sie vor deinem Termin durch.</p>
|
||
</div>
|
||
${cancellationUrl ? `
|
||
<div style="background-color: #fef9f5; border-left: 4px solid #db2777; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #db2777;">📅 Termin verwalten:</p>
|
||
<p style="margin: 8px 0 12px 0; color: #475569;">Du kannst deinen Termin-Status einsehen und bei Bedarf stornieren:</p>
|
||
<a href="${cancellationUrl}" style="display: inline-block; background-color: #db2777; color: white; padding: 12px 24px; text-decoration: none; border-radius: 6px; font-weight: 600;">Termin ansehen & verwalten</a>
|
||
</div>
|
||
` : ''}
|
||
${reviewUrl ? `
|
||
<div style="background-color: #eff6ff; border-left: 4px solid #3b82f6; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #3b82f6;">⭐ Bewertung abgeben:</p>
|
||
<p style="margin: 8px 0 12px 0; color: #475569;">Nach deinem Termin würden wir uns über deine Bewertung freuen!</p>
|
||
<a href="${reviewUrl}" style="display: inline-block; background-color: #3b82f6; color: white; padding: 12px 24px; text-decoration: none; border-radius: 6px; font-weight: 600;">Bewertung schreiben</a>
|
||
<p style="margin: 12px 0 0 0; color: #64748b; font-size: 13px;">Du kannst deine Bewertung nach dem Termin über diesen Link abgeben.</p>
|
||
</div>
|
||
` : ''}
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #3b82f6; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #3b82f6;">📋 Rechtliche Informationen:</p>
|
||
<p style="margin: 8px 0 12px 0; color: #475569;">Weitere Informationen findest du in unserem <a href="${legalUrl}" style="color: #3b82f6; text-decoration: underline;">Impressum und Datenschutz</a>.</p>
|
||
</div>
|
||
<p>Liebe Grüße,<br/>Stargirlnails Kiel</p>
|
||
`;
|
||
return renderBrandedEmail("Termin bestätigt", inner);
|
||
}
|
||
export async function renderBookingCancelledHTML(params) {
|
||
const { name, date, time } = params;
|
||
const formattedDate = formatDateGerman(date);
|
||
const domain = process.env.DOMAIN || 'localhost:5173';
|
||
const protocol = domain.includes('localhost') ? 'http' : 'https';
|
||
const legalUrl = `${protocol}://${domain}/legal`;
|
||
const inner = `
|
||
<p>Hallo ${name},</p>
|
||
<p>dein Termin am <strong>${formattedDate}</strong> um <strong>${time}</strong> wurde abgesagt.</p>
|
||
<p>Bitte buche einen neuen Termin. Bei Fragen helfen wir dir gerne weiter.</p>
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #3b82f6; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #3b82f6;">📋 Rechtliche Informationen:</p>
|
||
<p style="margin: 8px 0 12px 0; color: #475569;">Weitere Informationen findest du in unserem <a href="${legalUrl}" style="color: #3b82f6; text-decoration: underline;">Impressum und Datenschutz</a>.</p>
|
||
</div>
|
||
<p>Liebe Grüße,<br/>Stargirlnails Kiel</p>
|
||
`;
|
||
return renderBrandedEmail("Termin abgesagt", inner);
|
||
}
|
||
export async function renderAdminBookingNotificationHTML(params) {
|
||
const { name, date, time, treatment, phone, notes, hasInspirationPhoto } = params;
|
||
const formattedDate = formatDateGerman(date);
|
||
const inner = `
|
||
<p>Hallo Admin,</p>
|
||
<p>eine neue Buchungsanfrage ist eingegangen:</p>
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #db2777; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #db2777;">📅 Buchungsdetails:</p>
|
||
<ul style="margin: 8px 0 0 0; color: #475569; list-style: none; padding: 0;">
|
||
<li><strong>Name:</strong> ${name}</li>
|
||
<li><strong>Telefon:</strong> ${phone}</li>
|
||
<li><strong>Behandlung:</strong> ${treatment}</li>
|
||
<li><strong>Datum:</strong> ${formattedDate}</li>
|
||
<li><strong>Uhrzeit:</strong> ${time}</li>
|
||
${notes ? `<li><strong>Notizen:</strong> ${notes}</li>` : ''}
|
||
<li><strong>Inspiration-Foto:</strong> ${hasInspirationPhoto ? '✅ Im Anhang verfügbar' : '❌ Kein Foto hochgeladen'}</li>
|
||
</ul>
|
||
</div>
|
||
<p>Bitte logge dich in das Admin-Panel ein, um die Buchung zu bestätigen oder abzulehnen.</p>
|
||
<p>Liebe Grüße,<br/>Stargirlnails System</p>
|
||
`;
|
||
return renderBrandedEmail("Neue Buchungsanfrage - Admin-Benachrichtigung", inner);
|
||
}
|
||
export async function renderBookingRescheduleProposalHTML(params) {
|
||
const formattedOriginalDate = formatDateGerman(params.originalDate);
|
||
const formattedProposedDate = formatDateGerman(params.proposedDate);
|
||
const expiryDate = new Date(params.expiresAt);
|
||
const formattedExpiry = `${expiryDate.toLocaleDateString('de-DE')} ${expiryDate.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })}`;
|
||
const inner = `
|
||
<p>Hallo ${params.name},</p>
|
||
<p>wir müssen deinen Termin leider verschieben. Hier ist unser Vorschlag:</p>
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #f59e0b; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #92400e;">📅 Übersicht</p>
|
||
<table role="presentation" cellspacing="0" cellpadding="0" style="width:100%; margin-top:8px; font-size:14px; color:#475569;">
|
||
<tr>
|
||
<td style="padding:6px 0; width:45%"><strong>Alter Termin</strong></td>
|
||
<td style="padding:6px 0;">${formattedOriginalDate} um ${params.originalTime} Uhr</td>
|
||
</tr>
|
||
<tr>
|
||
<td style="padding:6px 0; width:45%"><strong>Neuer Vorschlag</strong></td>
|
||
<td style="padding:6px 0; color:#b45309;"><strong>${formattedProposedDate} um ${params.proposedTime} Uhr</strong></td>
|
||
</tr>
|
||
<tr>
|
||
<td style="padding:6px 0; width:45%"><strong>Behandlung</strong></td>
|
||
<td style="padding:6px 0;">${params.treatmentName}</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div style="background-color: #fffbeb; border-left: 4px solid #f59e0b; padding: 12px; margin: 16px 0; border-radius: 4px; color:#92400e;">
|
||
⏰ Bitte antworte bis ${formattedExpiry}.
|
||
</div>
|
||
<div style="text-align:center; margin: 20px 0;">
|
||
<a href="${params.acceptUrl}" style="display:inline-block; background-color:#16a34a; color:#ffffff; padding:12px 18px; border-radius:8px; text-decoration:none; font-weight:700; margin-right:8px;">Neuen Termin akzeptieren</a>
|
||
<a href="${params.declineUrl}" style="display:inline-block; background-color:#dc2626; color:#ffffff; padding:12px 18px; border-radius:8px; text-decoration:none; font-weight:700;">Termin ablehnen</a>
|
||
</div>
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #10b981; padding: 12px; margin: 16px 0; border-radius: 4px; color:#065f46;">
|
||
Wenn du den Vorschlag ablehnst, bleibt dein ursprünglicher Termin bestehen und wir kontaktieren dich für eine alternative Lösung.
|
||
</div>
|
||
<p>Falls du einen komplett neuen Termin buchen möchtest, kannst du deinen aktuellen Termin stornieren und einen neuen Termin auf unserer Website buchen.</p>
|
||
<p>Liebe Grüße,<br/>Stargirlnails Kiel</p>
|
||
`;
|
||
return renderBrandedEmail("Terminänderung vorgeschlagen", inner);
|
||
}
|
||
export async function renderAdminRescheduleDeclinedHTML(params) {
|
||
const inner = `
|
||
<p>Hallo Admin,</p>
|
||
<p>der Kunde <strong>${params.customerName}</strong> hat den Terminänderungsvorschlag abgelehnt.</p>
|
||
<div style="background-color:#f8fafc; border-left:4px solid #ef4444; padding:16px; margin:16px 0; border-radius:4px;">
|
||
<ul style="margin:0; padding:0; list-style:none; color:#475569; font-size:14px;">
|
||
<li><strong>Kunde:</strong> ${params.customerName}</li>
|
||
${params.customerEmail ? `<li><strong>E-Mail:</strong> ${params.customerEmail}</li>` : ''}
|
||
${params.customerPhone ? `<li><strong>Telefon:</strong> ${params.customerPhone}</li>` : ''}
|
||
<li><strong>Behandlung:</strong> ${params.treatmentName}</li>
|
||
<li><strong>Ursprünglicher Termin:</strong> ${formatDateGerman(params.originalDate)} um ${params.originalTime} Uhr (bleibt bestehen)</li>
|
||
<li><strong>Abgelehnter Vorschlag:</strong> ${formatDateGerman(params.proposedDate)} um ${params.proposedTime} Uhr</li>
|
||
</ul>
|
||
</div>
|
||
<p>Bitte kontaktiere den Kunden, um eine alternative Lösung zu finden.</p>
|
||
`;
|
||
return renderBrandedEmail("Kunde hat Terminänderung abgelehnt", inner);
|
||
}
|
||
export async function renderAdminRescheduleAcceptedHTML(params) {
|
||
const inner = `
|
||
<p>Hallo Admin,</p>
|
||
<p>der Kunde <strong>${params.customerName}</strong> hat den Terminänderungsvorschlag akzeptiert.</p>
|
||
<div style="background-color:#ecfeff; border-left:4px solid #10b981; padding:16px; margin:16px 0; border-radius:4px;">
|
||
<ul style="margin:0; padding:0; list-style:none; color:#475569; font-size:14px;">
|
||
<li><strong>Kunde:</strong> ${params.customerName}</li>
|
||
<li><strong>Behandlung:</strong> ${params.treatmentName}</li>
|
||
<li><strong>Alter Termin:</strong> ${formatDateGerman(params.originalDate)} um ${params.originalTime} Uhr</li>
|
||
<li><strong>Neuer Termin:</strong> ${formatDateGerman(params.newDate)} um ${params.newTime} Uhr ✅</li>
|
||
</ul>
|
||
</div>
|
||
<p>Der Termin wurde automatisch aktualisiert.</p>
|
||
`;
|
||
return renderBrandedEmail("Kunde hat Terminänderung akzeptiert", inner);
|
||
}
|
||
export async function renderAdminRescheduleExpiredHTML(params) {
|
||
const inner = `
|
||
<p>Hallo Admin,</p>
|
||
<p><strong>${params.expiredProposals.length} Terminänderungsvorschlag${params.expiredProposals.length > 1 ? 'e' : ''} ${params.expiredProposals.length > 1 ? 'sind' : 'ist'} abgelaufen</strong> und wurde${params.expiredProposals.length > 1 ? 'n' : ''} automatisch entfernt.</p>
|
||
<div style="background-color:#fef2f2; border-left:4px solid #ef4444; padding:16px; margin:16px 0; border-radius:4px;">
|
||
<p style="margin:0 0 12px 0; font-weight:600; color:#dc2626;">⚠️ Abgelaufene Vorschläge:</p>
|
||
${params.expiredProposals.map(proposal => `
|
||
<div style="background-color:#ffffff; border:1px solid #fecaca; border-radius:4px; padding:12px; margin:8px 0;">
|
||
<ul style="margin:0; padding:0; list-style:none; color:#475569; font-size:13px;">
|
||
<li><strong>Kunde:</strong> ${proposal.customerName}</li>
|
||
${proposal.customerEmail ? `<li><strong>E-Mail:</strong> ${proposal.customerEmail}</li>` : ''}
|
||
${proposal.customerPhone ? `<li><strong>Telefon:</strong> ${proposal.customerPhone}</li>` : ''}
|
||
<li><strong>Behandlung:</strong> ${proposal.treatmentName}</li>
|
||
<li><strong>Ursprünglicher Termin:</strong> ${formatDateGerman(proposal.originalDate)} um ${proposal.originalTime} Uhr</li>
|
||
<li><strong>Vorgeschlagener Termin:</strong> ${formatDateGerman(proposal.proposedDate)} um ${proposal.proposedTime} Uhr</li>
|
||
<li><strong>Abgelaufen am:</strong> ${new Date(proposal.expiredAt).toLocaleString('de-DE')}</li>
|
||
</ul>
|
||
</div>
|
||
`).join('')}
|
||
</div>
|
||
<p style="color:#dc2626; font-weight:600;">Bitte kontaktiere die Kunden, um eine alternative Lösung zu finden.</p>
|
||
<p>Die ursprünglichen Termine bleiben bestehen.</p>
|
||
`;
|
||
return renderBrandedEmail("Abgelaufene Terminänderungsvorschläge", inner);
|
||
}
|
||
export async function renderCustomerMessageHTML(params) {
|
||
const { customerName, message, appointmentDate, appointmentTime, treatmentName } = params;
|
||
const formattedDate = appointmentDate ? formatDateGerman(appointmentDate) : null;
|
||
const domain = process.env.DOMAIN || 'localhost:5173';
|
||
const protocol = domain.includes('localhost') ? 'http' : 'https';
|
||
const legalUrl = `${protocol}://${domain}/legal`;
|
||
const ownerName = process.env.OWNER_NAME || 'Stargirlnails Kiel';
|
||
const inner = `
|
||
<p>Hallo ${customerName},</p>
|
||
${(appointmentDate && appointmentTime && treatmentName) ? `
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #db2777; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #db2777;">📅 Zu deinem Termin:</p>
|
||
<ul style="margin: 8px 0 0 0; color: #475569; list-style: none; padding: 0;">
|
||
<li><strong>Behandlung:</strong> ${treatmentName}</li>
|
||
<li><strong>Datum:</strong> ${formattedDate}</li>
|
||
<li><strong>Uhrzeit:</strong> ${appointmentTime}</li>
|
||
</ul>
|
||
</div>
|
||
` : ''}
|
||
<div style="background-color: #fef9f5; border-left: 4px solid #f59e0b; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #f59e0b;">💬 Nachricht von ${ownerName}:</p>
|
||
<div style="margin: 12px 0 0 0; color: #475569; white-space: pre-wrap; line-height: 1.6;">${message.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')}</div>
|
||
</div>
|
||
<p>Bei Fragen oder Anliegen kannst du einfach auf diese E-Mail antworten – wir helfen dir gerne weiter!</p>
|
||
<div style="background-color: #f8fafc; border-left: 4px solid #3b82f6; padding: 16px; margin: 20px 0; border-radius: 4px;">
|
||
<p style="margin: 0; font-weight: 600; color: #3b82f6;">📋 Rechtliche Informationen:</p>
|
||
<p style="margin: 8px 0 12px 0; color: #475569;">Weitere Informationen findest du in unserem <a href="${legalUrl}" style="color: #3b82f6; text-decoration: underline;">Impressum und Datenschutz</a>.</p>
|
||
</div>
|
||
<p>Liebe Grüße,<br/>${ownerName}</p>
|
||
`;
|
||
return renderBrandedEmail("Nachricht zu deinem Termin", inner);
|
||
}
|