109 lines
3.0 KiB
JavaScript
109 lines
3.0 KiB
JavaScript
const moment = require("moment");
|
|
const {default: RenderInstanceManager} = require("../utils/instanceMgr");
|
|
const {header, end, start} = require("./html");
|
|
|
|
// Required Strings
|
|
// - header - The header of the email
|
|
// - subHeader - The subheader of the email
|
|
// - body - The body of the email
|
|
|
|
// Optional Strings (Have default values)
|
|
// - footer - The footer of the email
|
|
// - dateLine - The date line of the email
|
|
|
|
const defaultFooter = () => {
|
|
return RenderInstanceManager({
|
|
imex: 'ImEX Online Collision Repair Management System',
|
|
rome: 'Rome Technologies',
|
|
promanager: 'ProManager',
|
|
});
|
|
};
|
|
|
|
const now = () => moment().format('MM/DD/YYYY @ hh:mm a');
|
|
|
|
const generateEmailTemplate = (strings) => {
|
|
|
|
return `
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">`
|
|
+ header
|
|
+ start
|
|
+ `
|
|
<table class="row">
|
|
<tbody>
|
|
<tr>
|
|
<th class="small-12 large-12 columns first last">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<h6 style="text-align:left"><strong>${strings.header}</strong></h6>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p style="font-size:90%">${strings.subHeader}</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<!-- End Report Title -->
|
|
<!-- Task Detail -->
|
|
<table class="row">
|
|
<tbody>
|
|
<tr>
|
|
<th class="small-12 large-12 columns first last">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td>${strings.body}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<!-- End Task Detail -->
|
|
<!-- Footer -->
|
|
<table class="row collapsed footer" id="non-printable">
|
|
<tbody>
|
|
<tr>
|
|
<th class="small-3 large-3 columns first">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td><p style="font-size:70%;">${strings?.dateLine || now()}</p></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</th>
|
|
<th class="small-6 large-6 columns">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td><p style="font-size:70%; text-align:center">${strings?.footer || defaultFooter()}</p></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</th>
|
|
<th class="small-3 large-3 columns last">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td><p style="font-size:70%"> </p></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>`
|
|
+ end
|
|
};
|
|
|
|
module.exports = generateEmailTemplate;
|