spurrin-backend/src/templates/welcomeEmail.js
2025-06-09 11:11:52 +05:30

87 lines
6.2 KiB
JavaScript

const generateWelcomeEmail = (data) => {
const { email, hospitalName, subdomain, password, adminName, back_url } = data;
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to Spurrinai</title>
<style>
@media only screen and (max-width: 600px) {
.container { width: 100% !important; padding-block: 60px; }
.header-image { height: 150px !important; background-color: #F2F2F7; }
.content { padding: 20px !important; }
.credentials-table { font-size: 14px !important; }
}
</style>
</head>
<body style="margin: 0; padding: 0; font-family: Inter, sans-serif; background-color: #f4f4f4;">
<table role="presentation" style="width: 100%; border-collapse: collapse; display: flex; justify-content: center; align-items: center; height: 100vh;">
<tr>
<td align="center" style="padding: 0;">
<table role="presentation" class="container" style="width: 680px; margin: 0 auto; background-color: #F2F2F7; box-shadow: 0 0 10px rgba(0,0,0,0.1); border-radius: 12px;">
<tr>
<td style="padding: 0;">
<table role="presentation" style="width: 100%; border-collapse: collapse;">
<tr>
<td style="padding: 20px 25px; background-color: #F2F2F7;">
<h1 style="margin: 0; font-size: 24px; color: #333333;">Spurrinai</h1>
</td>
</tr>
<tr style="padding: 0px 0px; display: grid; width: 93%; margin: auto;">
<td class="header-image" style="height: 200px; background-color: #b5e8e0; background-image: url(${back_url})">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="content" style="padding: 20px 25px;">
<h2 style="margin: 0 0 20px; font-size: 28px; color: #333333;">Greetings, ${adminName},</h2>
<p style="margin: 0 0 20px; font-size: 16px; line-height: 1.5; color: #666666;">
Congratulations! Your hospital, <span style="color: #4F5A68; font-weight: 600;">${hospitalName}</span>, has been successfully onboarded to <span style="color: #4F5A68; font-weight: 600;">Spurrinai</span>. We are excited to have you on board and look forward to supporting your hospital's needs.
</p>
<p style="margin: 0 0 20px; font-size: 16px; line-height: 1.5; color: #4F5A68;">
<strong style="font-weight: 600; color: #4F5A68;">Please find your hospital's login credentials below:</strong>
</p>
<table role="presentation" class="credentials-table rounded-table" style="width: 100%; border-collapse: collapse; margin-bottom: 20px;">
<tbody style="border: 1px solid #dddddd; border-radius: 8px; display: list-item; list-style-type: none; background-color: #fff;">
<tr style="display: flex; list-style: none;">
<td style="width: 100%; color: #1B1B1B; padding: 10px; background-color: #F1fffe; border: 1px solid #dddddd; font-weight: 600;">Hospital Name</td>
<td style="width: 100%; padding: 10px; color: #151515; font-weight: 300; border: 1px solid #dddddd;">${hospitalName}</td>
</tr>
<tr style="display: flex; list-style: none;">
<td style="width: 100%; color: #1B1B1B; padding: 10px; background-color: #F1fffe; border: 1px solid #dddddd; font-weight: 600;">Domain</td>
<td style="width: 100%; padding: 10px; color: #151515; font-weight: 300; border: 1px solid #dddddd;">${subdomain}</td>
</tr>
<tr style="display: flex; list-style: none;">
<td style="width: 100%; color: #1B1B1B; padding: 10px; background-color: #F1fffe; border: 1px solid #dddddd; font-weight: 600;">Username</td>
<td style="width: 100%; padding: 10px; color: #151515; font-weight: 300; border: 1px solid #dddddd;">${email}</td>
</tr>
<tr style="display: flex; list-style: none;">
<td style="width: 100%; color: #1B1B1B; padding: 10px; background-color: #F1fffe; border: 1px solid #dddddd; font-weight: 600;">Temporary Password</td>
<td style="width: 100%; padding: 10px; color: #151515; font-weight: 300; border: 1px solid #dddddd;">${password}</td>
</tr>
</tbody>
</table>
<p style="margin: 0 0 20px; font-size: 16px; line-height: 1.5; color: #525660;">
For security reasons, we recommend changing your password immediately after logging in.
</p>
<table role="presentation" style="width: 100%;">
<tr>
<td align="left">
<a href="https://${subdomain}.spurrinai.com" style="display: inline-block; padding: 12px 24px; background-color: #4F5A68; color: #fff; text-decoration: none; border-radius: 4px; font-weight: bold;">Log In and Change Password</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>`;
};
module.exports = generateWelcomeEmail;