/** * Source-of-truth: project-task-assigned-additional email template. * * Uses the shared email layout wrapper. Body content is built from * per-language translated strings so that only text differs between locales. * * Based on the modern styling from migration 20251217211644. */ const { wrapEmailLayout } = require('../../_shared/emailLayout.cjs'); const { BADGE_BG, BRAND_DARK, BRAND_PRIMARY, INFO_BOX_BG, INFO_BOX_BORDER, } = require('../../_shared/constants.cjs'); const TEMPLATE_NAME = 'project-task-assigned-additional'; const SUBTYPE_NAME = 'Project Task Assigned'; const SUBJECTS = { en: 'You have been added as additional resource to task: {{task.name}}', fr: 'Vous avez \u00e9t\u00e9 ajout\u00e9 comme ressource suppl\u00e9mentaire \u00e0 la t\u00e2che : {{task.name}}', es: 'Se te ha a\u00f1adido como recurso adicional a la tarea: {{task.name}}', de: 'Sie wurden der Aufgabe als zus\u00e4tzliche Ressource hinzugef\u00fcgt: {{task.name}}', nl: 'U bent toegevoegd als extra resource aan de taak: {{task.name}}', it: 'Sei stato aggiunto come risorsa aggiuntiva alla task: {{task.name}}', pl: 'Zosta\u0142e\u015b dodany jako dodatkowy zas\u00f3b do zadania: {{task.name}}', }; /* eslint-disable max-len */ const COPY = { en: { headerLabel: 'Task Assignment', intro: 'Hello{{#if recipientName}} {{recipientName}}{{/if}}, you have been added as an additional resource for a project task.', assignedBadge: 'Additional Resource', badgeBg: 'rgba(138,77,234,0.12)', badgeColor: '#5b38b0', taskLabel: 'Task', projectLabel: 'Project', dueDateLabel: 'Due Date', assignedByLabel: 'Assigned By', roleLabel: 'Role', descriptionTitle: 'Description', viewButton: 'View Task', buttonColor: '#8A4DEA', footer: 'Powered by Alga PSA', textHeader: 'Task Assignment', textIntro: 'You have been added as an Additional Resource for this task:', textView: 'View task at', }, fr: { headerLabel: 'Assignation de t\u00e2che', intro: 'Bonjour{{#if recipientName}} {{recipientName}}{{/if}}, vous avez \u00e9t\u00e9 ajout\u00e9 comme ressource suppl\u00e9mentaire pour une t\u00e2che de projet.', assignedBadge: 'Ressource suppl\u00e9mentaire', badgeBg: 'rgba(138,77,234,0.12)', badgeColor: '#5b38b0', taskLabel: 'T\u00e2che', projectLabel: 'Projet', dueDateLabel: 'Date d\'\u00e9ch\u00e9ance', assignedByLabel: 'Assign\u00e9 par', roleLabel: 'R\u00f4le', descriptionTitle: 'Description', viewButton: 'Voir la t\u00e2che', buttonColor: '#8A4DEA', footer: 'Powered by Alga PSA', textHeader: 'Assignation de t\u00e2che', textIntro: 'Vous avez \u00e9t\u00e9 ajout\u00e9 comme ressource suppl\u00e9mentaire pour cette t\u00e2che :', textView: 'Voir la t\u00e2che sur', }, es: { headerLabel: 'Asignaci\u00f3n de tarea', intro: 'Hola{{#if recipientName}} {{recipientName}}{{/if}}, se te ha a\u00f1adido como recurso adicional para una tarea del proyecto.', assignedBadge: 'Recurso adicional', badgeBg: 'rgba(138,77,234,0.12)', badgeColor: '#5b38b0', taskLabel: 'Tarea', projectLabel: 'Proyecto', dueDateLabel: 'Fecha de vencimiento', assignedByLabel: 'Asignado por', roleLabel: 'Rol', descriptionTitle: 'Descripci\u00f3n', viewButton: 'Ver tarea', buttonColor: '#8A4DEA', footer: 'Powered by Alga PSA', textHeader: 'Asignaci\u00f3n de tarea', textIntro: 'Se te ha a\u00f1adido como recurso adicional a esta tarea:', textView: 'Ver tarea en', }, de: { headerLabel: 'Aufgabenzuweisung', intro: 'Hallo{{#if recipientName}} {{recipientName}}{{/if}}, Sie wurden als zus\u00e4tzliche Ressource f\u00fcr eine Projektaufgabe hinzugef\u00fcgt.', assignedBadge: 'Zus\u00e4tzliche Ressource', badgeBg: 'rgba(138,77,234,0.12)', badgeColor: '#5b38b0', taskLabel: 'Aufgabe', projectLabel: 'Projekt', dueDateLabel: 'F\u00e4lligkeitsdatum', assignedByLabel: 'Zugewiesen von', roleLabel: 'Rolle', descriptionTitle: 'Beschreibung', viewButton: 'Aufgabe anzeigen', buttonColor: '#8A4DEA', footer: 'Powered by Alga PSA', textHeader: 'Aufgabenzuweisung', textIntro: 'Sie wurden als zus\u00e4tzliche Ressource f\u00fcr diese Aufgabe hinzugef\u00fcgt:', textView: 'Aufgabe anzeigen unter', }, nl: { headerLabel: 'Taaktoewijzing', intro: 'Hallo{{#if recipientName}} {{recipientName}}{{/if}}, u bent toegevoegd als extra resource voor een projecttaak.', assignedBadge: 'Extra resource', badgeBg: 'rgba(138,77,234,0.12)', badgeColor: '#5b38b0', taskLabel: 'Taak', projectLabel: 'Project', dueDateLabel: 'Vervaldatum', assignedByLabel: 'Toegewezen door', roleLabel: 'Rol', descriptionTitle: 'Beschrijving', viewButton: 'Taak bekijken', buttonColor: '#8A4DEA', footer: 'Powered by Alga PSA', textHeader: 'Taaktoewijzing', textIntro: 'U bent toegevoegd als extra resource voor deze taak:', textView: 'Taak bekijken op', }, it: { headerLabel: 'Assegnazione task', intro: 'Ciao{{#if recipientName}} {{recipientName}}{{/if}}, sei stato aggiunto come risorsa aggiuntiva per una task di progetto.', assignedBadge: 'Risorsa aggiuntiva', badgeBg: 'rgba(138,77,234,0.12)', badgeColor: '#5b38b0', taskLabel: 'Task', projectLabel: 'Progetto', dueDateLabel: 'Data di scadenza', assignedByLabel: 'Assegnato da', roleLabel: 'Ruolo', descriptionTitle: 'Descrizione', viewButton: 'Visualizza task', buttonColor: '#8A4DEA', footer: 'Powered by Alga PSA', textHeader: 'Assegnazione task', textIntro: 'Sei stato aggiunto come risorsa aggiuntiva per questa task:', textView: 'Visualizza task su', }, pl: { headerLabel: 'Przypisanie zadania', intro: 'Witaj{{#if recipientName}} {{recipientName}}{{/if}}, zosta\u0142e\u015b dodany jako dodatkowy zas\u00f3b do zadania projektowego.', assignedBadge: 'Dodatkowy zas\u00f3b', badgeBg: 'rgba(138,77,234,0.12)', badgeColor: '#5b38b0', taskLabel: 'Zadanie', projectLabel: 'Projekt', dueDateLabel: 'Termin', assignedByLabel: 'Przypisa\u0142(a)', roleLabel: 'Rola', descriptionTitle: 'Opis', viewButton: 'Zobacz zadanie', buttonColor: '#8A4DEA', footer: 'Powered by Alga PSA', textHeader: 'Przypisanie zadania', textIntro: 'Zosta\u0142e\u015b dodany jako dodatkowy zas\u00f3b do tego zadania:', textView: 'Zobacz zadanie pod adresem', }, }; /* eslint-enable max-len */ function buildBodyHtml(c) { return `

${c.intro}

${c.assignedBadge}
{{#if task.dueDate}} {{/if}} {{#if task.assignedBy}} {{/if}} {{#if task.role}} {{/if}}
${c.taskLabel} {{task.name}}
${c.projectLabel} {{task.project}}
${c.dueDateLabel} {{task.dueDate}}
${c.assignedByLabel} {{task.assignedBy}}
${c.roleLabel} {{task.role}}
{{#if task.description}}
${c.descriptionTitle}
{{task.description}}
{{/if}} ${c.viewButton}`; } function buildText(c) { return `${c.textHeader} ${c.textIntro} ${c.assignedBadge} ${c.taskLabel}: {{task.name}} ${c.projectLabel}: {{task.project}} {{#if task.dueDate}}${c.dueDateLabel}: {{task.dueDate}}{{/if}} {{#if task.assignedBy}}${c.assignedByLabel}: {{task.assignedBy}}{{/if}} {{#if task.role}}${c.roleLabel}: {{task.role}}{{/if}} {{#if task.description}}${c.descriptionTitle}: {{task.description}}{{/if}} ${c.textView}: {{task.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, headerTitle: '{{task.name}}', headerMeta: '{{task.project}}', bodyHtml: buildBodyHtml(copy), footerText: copy.footer, }), textContent: buildText(copy), })), }; } module.exports = { TEMPLATE_NAME, SUBTYPE_NAME, getTemplate };