diff --git a/server/email/tasksEmails.js b/server/email/tasksEmails.js
index 595665fe0..66a3a10fd 100644
--- a/server/email/tasksEmails.js
+++ b/server/email/tasksEmails.js
@@ -99,14 +99,16 @@ const formatPriority = (priority) => {
* @param priority
* @param description
* @param dueDate
+ * @param bodyshop
+ * @param job
* @param taskId
* @returns {{header, body: string, subHeader: string}}
*/
-const generateTemplateArgs = (title, priority, description, dueDate, taskId) => {
+const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId) => {
return {
header: title,
- subHeader: `Priority: ${formatPriority(priority)} ${formatDate(dueDate)}`,
- body: `${description || ""}
View this task.`
+ subHeader: `Body Shop: ${bodyshop.shopname} | Priority: ${formatPriority(priority)} ${formatDate(dueDate)}`,
+ body: `Reference: ${job.ro_number} | ${job.ownr_co_nm ? job.ownr_co_nm : `${job.ownr_fn || ""} ${job.ownr_ln || ""}`.trim()} | ${`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${job.v_model_desc || ""}`.trim()}
${description ? description + "
" : ""}View this task.`
};
};
@@ -175,7 +177,15 @@ const taskAssignedEmail = async (req, res) => {
user_email,
`A ${formatPriority(newTask.priority)} priority task has been ${dirty ? "reassigned to" : "created for"} you - ${newTask.title}`,
generateEmailTemplate(
- generateTemplateArgs(newTask.title, newTask.priority, newTask.description, newTask.due_date, newTask.id)
+ generateTemplateArgs(
+ newTask.title,
+ newTask.priority,
+ newTask.description,
+ newTask.due_date,
+ newTask.bodyshop,
+ newTask.job,
+ newTask.id
+ )
)
);
@@ -240,7 +250,15 @@ const tasksRemindEmail = async (req, res) => {
`New ${formatPriority(onlyTask.priority)} Priority Task Reminder - ${onlyTask.title} ${onlyTask.due_date ? `- ${formatDate(onlyTask.due_date)}` : ""}`.trim();
emailData.html = generateEmailTemplate(
- generateTemplateArgs(onlyTask.title, onlyTask.priority, onlyTask.description, onlyTask.due_date, onlyTask.id)
+ generateTemplateArgs(
+ onlyTask.title,
+ onlyTask.priority,
+ onlyTask.description,
+ onlyTask.due_date,
+ onlyTask.bodyshop,
+ onlyTask.job,
+ onlyTask.id
+ )
);
}
// There are multiple emails to send to this author.
@@ -253,7 +271,7 @@ const tasksRemindEmail = async (req, res) => {
body: `