/** * Source-of-truth: time-entry-rejected email template. * * Uses the shared email layout wrapper. Body content is built from * per-language translated strings so that only text differs between locales. */ const { wrapEmailLayout } = require('../../_shared/emailLayout.cjs'); const { BRAND_PRIMARY } = require('../../_shared/constants.cjs'); const TEMPLATE_NAME = 'time-entry-rejected'; const SUBTYPE_NAME = 'Time Entry Rejected'; const SUBJECTS = { en: 'Time Entry Rejected', fr: 'Saisie de temps refus\u00e9e', es: 'Registro de tiempo rechazado', de: 'Zeiteintrag abgelehnt', nl: 'Tijdregistratie afgewezen', it: 'Voce di tempo respinta', pl: 'Wpis czasu odrzucony', }; /* eslint-disable max-len */ const COPY = { en: { headerLabel: 'Time Entry Rejected', intro: 'Your time entry has been rejected.', date: 'Date', duration: 'Duration', project: 'Project', task: 'Task', rejectedBy: 'Rejected By', reason: 'Reason', viewButton: 'View Time Entry', footer: 'Powered by Alga PSA · Keeping teams aligned', textHeader: 'Time Entry Rejected', textIntro: 'Your time entry has been rejected:', textView: 'View time entry at', }, fr: { headerLabel: 'Saisie de temps refus\u00e9e', intro: 'Votre saisie de temps a \u00e9t\u00e9 refus\u00e9e.', date: 'Date', duration: 'Dur\u00e9e', project: 'Projet', task: 'T\u00e2che', rejectedBy: 'Refus\u00e9e par', reason: 'Motif', viewButton: 'Voir la saisie', footer: 'Powered by Alga PSA · Gardons les \u00e9quipes align\u00e9es', textHeader: 'Saisie de temps refus\u00e9e', textIntro: 'Votre saisie de temps a \u00e9t\u00e9 refus\u00e9e :', textView: 'Voir la saisie sur', }, es: { headerLabel: 'Registro de tiempo rechazado', intro: 'Su registro de tiempo ha sido rechazado.', date: 'Fecha', duration: 'Duraci\u00f3n', project: 'Proyecto', task: 'Tarea', rejectedBy: 'Rechazado por', reason: 'Motivo', viewButton: 'Ver registro', footer: 'Powered by Alga PSA · Manteniendo a los equipos alineados', textHeader: 'Registro de tiempo rechazado', textIntro: 'Su registro de tiempo ha sido rechazado:', textView: 'Ver registro en', }, de: { headerLabel: 'Zeiteintrag abgelehnt', intro: 'Ihr Zeiteintrag wurde abgelehnt.', date: 'Datum', duration: 'Dauer', project: 'Projekt', task: 'Aufgabe', rejectedBy: 'Abgelehnt von', reason: 'Grund', viewButton: 'Zeiteintrag anzeigen', footer: 'Powered by Alga PSA · Teams auf Kurs halten', textHeader: 'Zeiteintrag abgelehnt', textIntro: 'Ihr Zeiteintrag wurde abgelehnt:', textView: 'Zeiteintrag anzeigen unter', }, nl: { headerLabel: 'Tijdregistratie afgewezen', intro: 'Uw tijdregistratie is afgewezen.', date: 'Datum', duration: 'Duur', project: 'Project', task: 'Taak', rejectedBy: 'Afgewezen door', reason: 'Reden', viewButton: 'Tijdregistratie bekijken', footer: 'Powered by Alga PSA · Teams op \u00e9\u00e9n lijn houden', textHeader: 'Tijdregistratie afgewezen', textIntro: 'Uw tijdregistratie is afgewezen:', textView: 'Tijdregistratie bekijken op', }, it: { headerLabel: 'Voce di tempo respinta', intro: 'La Sua voce di tempo \u00e8 stata respinta.', date: 'Data', duration: 'Durata', project: 'Progetto', task: 'Attivit\u00e0', rejectedBy: 'Respinta da', reason: 'Motivo', viewButton: 'Visualizza voce di tempo', footer: 'Powered by Alga PSA · Manteniamo i team allineati', textHeader: 'Voce di tempo respinta', textIntro: 'La Sua voce di tempo \u00e8 stata respinta:', textView: 'Visualizza la voce di tempo su', }, pl: { headerLabel: 'Wpis czasu odrzucony', intro: 'Twój wpis czasu zosta\u0142 odrzucony.', date: 'Data', duration: 'Czas trwania', project: 'Projekt', task: 'Zadanie', rejectedBy: 'Odrzuci\u0142(a)', reason: 'Powód', viewButton: 'Zobacz wpis czasu', footer: 'Powered by Alga PSA', textHeader: 'Wpis czasu odrzucony', textIntro: 'Twój wpis czasu zosta\u0142 odrzucony:', textView: 'Zobacz wpis czasu na', }, }; /* eslint-enable max-len */ function buildBodyHtml(c) { return `

${c.intro}

${c.date} {{timeEntry.date}}
${c.duration} {{timeEntry.duration}}
${c.project} {{timeEntry.project}}
${c.task} {{timeEntry.task}}
${c.rejectedBy} {{timeEntry.rejectedBy}}
${c.reason} {{timeEntry.rejectionReason}}
${c.viewButton}
`; } function buildText(c) { return `${c.textHeader} ${c.textIntro} ${c.date}: {{timeEntry.date}} ${c.duration}: {{timeEntry.duration}} ${c.project}: {{timeEntry.project}} ${c.task}: {{timeEntry.task}} ${c.rejectedBy}: {{timeEntry.rejectedBy}} ${c.reason}: {{timeEntry.rejectionReason}} ${c.textView}: {{timeEntry.url}}`; } function getTemplate() { return { templateName: TEMPLATE_NAME, subtypeName: SUBTYPE_NAME, translations: Object.entries(COPY).map(([lang, copy]) => ({ language: lang, subject: SUBJECTS[lang], htmlContent: wrapEmailLayout({ language: lang, headerLabel: copy.headerLabel, bodyHtml: buildBodyHtml(copy), footerText: copy.footer, }), textContent: buildText(copy), })), }; } module.exports = { TEMPLATE_NAME, SUBTYPE_NAME, getTemplate };