fix: move mail template to assets folder

pull/53/head
shancheas 2024-08-06 06:13:13 +07:00
parent 81a463e761
commit e7abc7db13
8 changed files with 412 additions and 417 deletions

View File

@ -1,412 +1,412 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Email Confirmation</title> <title>Email Confirmation</title>
<style> <style>
/* ------------------------------------- /* -------------------------------------
GLOBAL RESETS GLOBAL RESETS
------------------------------------- */ ------------------------------------- */
img { img {
border: none; border: none;
-ms-interpolation-mode: bicubic; -ms-interpolation-mode: bicubic;
max-width: 100%; max-width: 100%;
} }
body { body {
background-color: #f6f6f6; background-color: #f6f6f6;
font-family: sans-serif; font-family: sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
font-size: 14px; font-size: 14px;
line-height: 1.4; line-height: 1.4;
margin: 0; margin: 0;
padding: 0; padding: 0;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
} }
table { table {
border-collapse: separate; border-collapse: separate;
mso-table-lspace: 0pt; mso-table-lspace: 0pt;
width: 100%; width: 100%;
} }
table td { table td {
font-family: sans-serif; font-family: sans-serif;
font-size: 14px; font-size: 14px;
vertical-align: top; vertical-align: top;
} }
/* ------------------------------------- /* -------------------------------------
BODY & CONTAINER BODY & CONTAINER
------------------------------------- */ ------------------------------------- */
.body { .body {
background-color: #f6f6f6; background-color: #f6f6f6;
width: 100%; width: 100%;
} }
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink /* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink
down on a phone or something */ down on a phone or something */
.container { .container {
display: block; display: block;
Margin: 0 auto !important; Margin: 0 auto !important;
/* makes it centered */ /* makes it centered */
max-width: 580px; max-width: 580px;
padding: 10px; padding: 10px;
width: 580px; width: 580px;
} }
/* This should also be a block element, so that it will fill 100% of the .container */ /* This should also be a block element, so that it will fill 100% of the .container */
.content { .content {
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
Margin: 0 auto; Margin: 0 auto;
max-width: 580px; max-width: 580px;
padding: 10px; padding: 10px;
} }
/* ------------------------------------- /* -------------------------------------
HEADER, FOOTER, MAIN HEADER, FOOTER, MAIN
------------------------------------- */ ------------------------------------- */
.main { .main {
background: #ffffff; background: #ffffff;
border-radius: 3px; border-radius: 3px;
width: 100%; width: 100%;
} }
.wrapper { .wrapper {
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
} }
.content-block { .content-block {
padding-bottom: 10px; padding-bottom: 10px;
padding-top: 10px; padding-top: 10px;
} }
.footer { .footer {
clear: both; clear: both;
Margin-top: 10px; Margin-top: 10px;
text-align: center; text-align: center;
width: 100%; width: 100%;
} }
.footer td, .footer td,
.footer p, .footer p,
.footer span, .footer span,
.footer a { .footer a {
color: #999999; color: #999999;
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
} }
/* ------------------------------------- /* -------------------------------------
TYPOGRAPHY TYPOGRAPHY
------------------------------------- */ ------------------------------------- */
h1, h1,
h2, h2,
h3, h3,
h4 { h4 {
color: #000000; color: #000000;
font-family: sans-serif; font-family: sans-serif;
font-weight: 400; font-weight: 400;
line-height: 1.4; line-height: 1.4;
margin: 0; margin: 0;
Margin-bottom: 30px; Margin-bottom: 30px;
} }
h1 { h1 {
font-size: 35px; font-size: 35px;
font-weight: 300; font-weight: 300;
text-align: center; text-align: center;
text-transform: capitalize; text-transform: capitalize;
} }
p, p,
ul, ul,
ol { ol {
font-family: sans-serif; font-family: sans-serif;
font-size: 14px; font-size: 14px;
font-weight: normal; font-weight: normal;
margin: 0; margin: 0;
Margin-bottom: 15px; Margin-bottom: 15px;
} }
p li, p li,
ul li, ul li,
ol li { ol li {
list-style-position: inside; list-style-position: inside;
margin-left: 5px; margin-left: 5px;
} }
a { a {
color: #3498db; color: #3498db;
text-decoration: underline; text-decoration: underline;
} }
/* ------------------------------------- /* -------------------------------------
BUTTONS BUTTONS
------------------------------------- */ ------------------------------------- */
.btn { .btn {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
} }
.btn>tbody>tr>td { .btn>tbody>tr>td {
padding-bottom: 15px; padding-bottom: 15px;
} }
.btn table { .btn table {
width: auto; width: auto;
} }
.btn table td { .btn table td {
background-color: #ffffff; background-color: #ffffff;
border-radius: 5px; border-radius: 5px;
text-align: center; text-align: center;
} }
.btn a { .btn a {
background-color: #ffffff; background-color: #ffffff;
border: solid 1px #3498db; border: solid 1px #3498db;
border-radius: 5px; border-radius: 5px;
box-sizing: border-box; box-sizing: border-box;
color: #3498db; color: #3498db;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
margin: 0; margin: 0;
padding: 12px 25px; padding: 12px 25px;
text-decoration: none; text-decoration: none;
text-transform: capitalize; text-transform: capitalize;
} }
.btn-primary table td { .btn-primary table td {
background-color: #3498db; background-color: #3498db;
} }
.btn-primary a { .btn-primary a {
background-color: #3498db; background-color: #3498db;
border-color: #3498db; border-color: #3498db;
color: #ffffff; color: #ffffff;
} }
/* ------------------------------------- /* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */ ------------------------------------- */
.last { .last {
margin-bottom: 0; margin-bottom: 0;
} }
.first { .first {
margin-top: 0; margin-top: 0;
} }
.align-center { .align-center {
text-align: center; text-align: center;
} }
.align-right { .align-right {
text-align: right; text-align: right;
} }
.align-left { .align-left {
text-align: left; text-align: left;
} }
.clear { .clear {
clear: both; clear: both;
} }
.mt0 { .mt0 {
margin-top: 0; margin-top: 0;
} }
.mb0 { .mb0 {
margin-bottom: 0; margin-bottom: 0;
} }
.preheader { .preheader {
color: transparent; color: transparent;
display: none; display: none;
height: 0; height: 0;
max-height: 0; max-height: 0;
max-width: 0; max-width: 0;
opacity: 0; opacity: 0;
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
width: 0; width: 0;
} }
.powered-by a { .powered-by a {
text-decoration: none; text-decoration: none;
} }
hr { hr {
border: 0; border: 0;
border-bottom: 1px solid #f6f6f6; border-bottom: 1px solid #f6f6f6;
Margin: 20px 0; Margin: 20px 0;
} }
/* ------------------------------------- /* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */ ------------------------------------- */
@media only screen and (max-width: 620px) { @media only screen and (max-width: 620px) {
table[class=body] h1 { table[class=body] h1 {
font-size: 28px !important; font-size: 28px !important;
margin-bottom: 10px !important; margin-bottom: 10px !important;
} }
table[class=body] p, table[class=body] p,
table[class=body] ul, table[class=body] ul,
table[class=body] ol, table[class=body] ol,
table[class=body] td, table[class=body] td,
table[class=body] span, table[class=body] span,
table[class=body] a { table[class=body] a {
font-size: 16px !important; font-size: 16px !important;
} }
table[class=body] .wrapper, table[class=body] .wrapper,
table[class=body] .article { table[class=body] .article {
padding: 10px !important; padding: 10px !important;
} }
table[class=body] .content { table[class=body] .content {
padding: 0 !important; padding: 0 !important;
} }
table[class=body] .container { table[class=body] .container {
padding: 0 !important; padding: 0 !important;
width: 100% !important; width: 100% !important;
} }
table[class=body] .main { table[class=body] .main {
border-left-width: 0 !important; border-left-width: 0 !important;
border-radius: 0 !important; border-radius: 0 !important;
border-right-width: 0 !important; border-right-width: 0 !important;
} }
table[class=body] .btn table { table[class=body] .btn table {
width: 100% !important; width: 100% !important;
} }
table[class=body] .btn a { table[class=body] .btn a {
width: 100% !important; width: 100% !important;
} }
table[class=body] .img-responsive { table[class=body] .img-responsive {
height: auto !important; height: auto !important;
max-width: 100% !important; max-width: 100% !important;
width: auto !important; width: auto !important;
} }
} }
/* ------------------------------------- /* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */ ------------------------------------- */
@media all { @media all {
.ExternalClass { .ExternalClass {
width: 100%; width: 100%;
} }
.ExternalClass, .ExternalClass,
.ExternalClass p, .ExternalClass p,
.ExternalClass span, .ExternalClass span,
.ExternalClass font, .ExternalClass font,
.ExternalClass td, .ExternalClass td,
.ExternalClass div { .ExternalClass div {
line-height: 100%; line-height: 100%;
} }
.apple-link a { .apple-link a {
color: inherit !important; color: inherit !important;
font-family: inherit !important; font-family: inherit !important;
font-size: inherit !important; font-size: inherit !important;
font-weight: inherit !important; font-weight: inherit !important;
line-height: inherit !important; line-height: inherit !important;
text-decoration: none !important; text-decoration: none !important;
} }
.btn-primary table td:hover { .btn-primary table td:hover {
background-color: #34495e !important; background-color: #34495e !important;
} }
.btn-primary a:hover { .btn-primary a:hover {
background-color: #34495e !important; background-color: #34495e !important;
border-color: #34495e !important; border-color: #34495e !important;
} }
} }
ol { ol {
padding: 0 0 0 1em; padding: 0 0 0 1em;
} }
ol li { ol li {
margin: 1em 0; margin: 1em 0;
} }
</style> </style>
</head> </head>
<body class=""> <body class="">
<table border="0" cellpadding="0" cellspacing="0" class="body"> <table border="0" cellpadding="0" cellspacing="0" class="body">
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td class="container"> <td class="container">
<div class="content"> <div class="content">
<table class="main"> <table class="main">
<!-- START MAIN CONTENT AREA --> <!-- START MAIN CONTENT AREA -->
<tr> <tr>
<td class="wrapper"> <td class="wrapper">
<table border="0" cellpadding="0" cellspacing="0"> <table border="0" cellpadding="0" cellspacing="0">
<tr> <tr>
<td> <td>
<p class="mb0"><b>Dear,</b></p> <p class="mb0"><b>Dear,</b></p>
<p class="mb0">{{customer_name}}</p> <p class="mb0">{{customer_name}}</p>
<p>{{customer_phone}}</p> <p>{{customer_phone}}</p>
<p class="mb0">We are excited to inform you that your payment has been successfully received!</p> <p class="mb0">We are excited to inform you that your payment has been successfully received!</p>
<p class="mb0">Attached to this email, you will find your confirmatin receipt</p> <p class="mb0">Attached to this email, you will find your confirmatin receipt</p>
<p class="mb0">Please keep this safe as you will need to show it at the entrance upon your arrival</p> <p class="mb0">Please keep this safe as you will need to show it at the entrance upon your arrival</p>
<p>It's your golden ticket to all the fun and excitement awaiting you!</p> <p>It's your golden ticket to all the fun and excitement awaiting you!</p>
<br> <br>
<p class="mb0">Here's a quick recap:</p> <p class="mb0">Here's a quick recap:</p>
<p class="mb0">Booking Date: {{booking_date}}</p> <p class="mb0">Booking Date: {{booking_date}}</p>
<p class="mb0">Invoice Code: {{invoice_code}}</p> <p class="mb0">Invoice Code: {{invoice_code}}</p>
<p class="mb0">Payment Date: {{payment_date}}</p> <p class="mb0">Payment Date: {{payment_date}}</p>
<p class="mb0">Payment Code: {{payment_code}}</p> <p class="mb0">Payment Code: {{payment_code}}</p>
<p class="mb0">Payment Via: {{payment_via}}</p> <p class="mb0">Payment Via: {{payment_via}}</p>
<p class="mb0">Account No: {{account_no}}</p> <p class="mb0">Account No: {{account_no}}</p>
<p>On Behalf Of: {{account_name}}</p> <p>On Behalf Of: {{account_name}}</p>
<br> <br>
<p class="mb0">If you have any questions or need assistance, feel free to reach out to our support team at</p> <p class="mb0">If you have any questions or need assistance, feel free to reach out to our support team at</p>
<b>{{phone_cs}}</b> <b>{{phone_cs}}</b>
<br> <br>
<p class="mb0">Font forget to bring a smile and your confirmation receipt (attached) for a smooth entry</p> <p class="mb0">Font forget to bring a smile and your confirmation receipt (attached) for a smooth entry</p>
<p>We can't wait to see you and ensure you have an amazing time with us!</p> <p>We can't wait to see you and ensure you have an amazing time with us!</p>
<br><br> <br><br>
<b>Best Regrads,</b><br> <b>Best Regrads,</b><br>
<b>WEplayground</b> <b>WEplayground</b>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<!-- END MAIN CONTENT AREA --> <!-- END MAIN CONTENT AREA -->
</table> </table>
</div> </div>
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>

View File

@ -1,6 +1,5 @@
import * as nodemailer from 'nodemailer'; import * as nodemailer from 'nodemailer';
import * as handlebars from 'handlebars'; import * as handlebars from 'handlebars';
import * as path from 'path';
import * as fs from 'fs'; import * as fs from 'fs';
import { TransactionPaymentType } from 'src/modules/transaction/transaction/constants'; import { TransactionPaymentType } from 'src/modules/transaction/transaction/constants';
import { InvoiceType } from 'src/modules/configuration/export/constants'; import { InvoiceType } from 'src/modules/configuration/export/constants';
@ -18,11 +17,7 @@ export async function sendEmail(receivers, invoiceType, attachment?) {
for (const receiver of receivers) { for (const receiver of receivers) {
try { try {
const templateName = getTemplate(receiver.payment_type, invoiceType); const templateName = getTemplate(receiver.payment_type, invoiceType);
let templatePath = path.join( const templatePath = `./assets/email-template/${templateName}.html`;
__dirname,
`../email-template/${templateName}.html`,
);
templatePath = templatePath.replace(/dist/g, 'src');
const templateSource = fs.readFileSync(templatePath, 'utf8'); const templateSource = fs.readFileSync(templatePath, 'utf8');
const template = handlebars.compile(templateSource); const template = handlebars.compile(templateSource);