upd
This commit is contained in:
@ -3,7 +3,8 @@ const db = require('./config/dbproc.js');
|
|||||||
|
|
||||||
const RECIPIENT = 'rizki.rmdhn1304@gmail.com';
|
const RECIPIENT = 'rizki.rmdhn1304@gmail.com';
|
||||||
|
|
||||||
function buildHtml(approverName, title, priorName) {
|
function buildHtml(approverName, title, priorName, idxjustification) {
|
||||||
|
const url = `https://e-portal.telkomcel.tl/app/ext/eproc/circulation/${idxjustification}`;
|
||||||
return `<p>Dear ${approverName},</p>
|
return `<p>Dear ${approverName},</p>
|
||||||
<p>A new workflow task requires your review and approval. Please find the details regarding this justification below:</p>
|
<p>A new workflow task requires your review and approval. Please find the details regarding this justification below:</p>
|
||||||
<ul>
|
<ul>
|
||||||
@ -13,17 +14,17 @@ function buildHtml(approverName, title, priorName) {
|
|||||||
<li><strong>Sent By:</strong> ${priorName}</li>
|
<li><strong>Sent By:</strong> ${priorName}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p><strong>Action Required:</strong><br>
|
<p><strong>Action Required:</strong><br>
|
||||||
<a href="https://e-portal.telkomcel.tl/app/ext/eproc/">https://e-portal.telkomcel.tl/app/ext/eproc/</a></p>
|
<a href="${url}">${url}</a></p>
|
||||||
<p>Best regards,<br>E-Procurement</p>`;
|
<p>Best regards,<br>E-Procurement</p>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function postEmail(approverName, title, priorName) {
|
function postEmail(approverName, title, priorName, idxjustification) {
|
||||||
const payload = JSON.stringify({
|
const payload = JSON.stringify({
|
||||||
to: [RECIPIENT],
|
to: [RECIPIENT],
|
||||||
cc: [],
|
cc: [],
|
||||||
bcc: [],
|
bcc: [],
|
||||||
subject: `[Approval Required] Justification for ${title}`,
|
subject: `[Approval Required] Justification for ${title}`,
|
||||||
html: buildHtml(approverName, title, priorName)
|
html: buildHtml(approverName, title, priorName, idxjustification)
|
||||||
});
|
});
|
||||||
|
|
||||||
const req = http.request({
|
const req = http.request({
|
||||||
@ -77,7 +78,7 @@ function notifyOnSubmit(idxjustification) {
|
|||||||
console.error('[email-notif] notifyOnSubmit: no approver found', err2);
|
console.error('[email-notif] notifyOnSubmit: no approver found', err2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
postEmail(rows2[0].fullname, title, creatorName);
|
postEmail(rows2[0].fullname, title, creatorName, idxjustification);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -114,7 +115,7 @@ function notifyOnSigned(idxjustification, signerNik) {
|
|||||||
console.log('[email-notif] notifyOnSigned: no more approvers to notify');
|
console.log('[email-notif] notifyOnSigned: no more approvers to notify');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
postEmail(rows3[0].fullname, title, signerName);
|
postEmail(rows3[0].fullname, title, signerName, idxjustification);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user