mail changer
This commit is contained in:
parent
55e44ab21c
commit
3a43558d47
@ -278,224 +278,298 @@ export class EmailTemplates {
|
|||||||
acceptUrl: string;
|
acceptUrl: string;
|
||||||
rejectUrl: string;
|
rejectUrl: string;
|
||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
const mjmlTemplate = `
|
|
||||||
<mjml>
|
|
||||||
<mj-head>
|
|
||||||
<mj-attributes>
|
|
||||||
<mj-all font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" />
|
|
||||||
<mj-text font-size="14px" color="#333333" line-height="1.6" />
|
|
||||||
</mj-attributes>
|
|
||||||
<mj-style>
|
|
||||||
.info-row {
|
|
||||||
padding: 8px 0;
|
|
||||||
border-bottom: 1px solid #e0e0e0;
|
|
||||||
}
|
|
||||||
.info-label {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #0066cc;
|
|
||||||
}
|
|
||||||
</mj-style>
|
|
||||||
</mj-head>
|
|
||||||
<mj-body background-color="#f4f4f4">
|
|
||||||
<!-- Header -->
|
|
||||||
<mj-section background-color="#0066cc" padding="20px">
|
|
||||||
<mj-column>
|
|
||||||
<mj-text font-size="28px" font-weight="bold" color="#ffffff" align="center">
|
|
||||||
Nouvelle demande de réservation
|
|
||||||
</mj-text>
|
|
||||||
<mj-text font-size="16px" color="#ffffff" align="center">
|
|
||||||
Xpeditis
|
|
||||||
</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<!-- Introduction -->
|
|
||||||
<mj-section background-color="#ffffff" padding="20px">
|
|
||||||
<mj-column>
|
|
||||||
<mj-text font-size="16px">
|
|
||||||
Bonjour,
|
|
||||||
</mj-text>
|
|
||||||
<mj-text>
|
|
||||||
Vous avez reçu une nouvelle demande de réservation via Xpeditis. Veuillez examiner les détails ci-dessous et confirmer ou refuser cette demande.
|
|
||||||
</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<!-- Booking Details -->
|
|
||||||
<mj-section background-color="#ffffff" padding="20px 20px 10px 20px">
|
|
||||||
<mj-column>
|
|
||||||
<mj-text font-size="20px" font-weight="bold" color="#0066cc">
|
|
||||||
Détails du transport
|
|
||||||
</mj-text>
|
|
||||||
<mj-divider border-color="#0066cc" border-width="2px" />
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px">
|
|
||||||
<mj-column width="40%">
|
|
||||||
<mj-text css-class="info-label">Route</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="60%">
|
|
||||||
<mj-text>{{origin}} → {{destination}}</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px">
|
|
||||||
<mj-column width="40%">
|
|
||||||
<mj-text css-class="info-label">Volume</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="60%">
|
|
||||||
<mj-text>{{volumeCBM}} CBM</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px">
|
|
||||||
<mj-column width="40%">
|
|
||||||
<mj-text css-class="info-label">Poids</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="60%">
|
|
||||||
<mj-text>{{weightKG}} kg</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px">
|
|
||||||
<mj-column width="40%">
|
|
||||||
<mj-text css-class="info-label">Palettes</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="60%">
|
|
||||||
<mj-text>{{palletCount}}</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px">
|
|
||||||
<mj-column width="40%">
|
|
||||||
<mj-text css-class="info-label">Type de conteneur</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="60%">
|
|
||||||
<mj-text>{{containerType}}</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px">
|
|
||||||
<mj-column width="40%">
|
|
||||||
<mj-text css-class="info-label">Transit</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="60%">
|
|
||||||
<mj-text>{{transitDays}} jours</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px 20px 20px">
|
|
||||||
<mj-column width="40%">
|
|
||||||
<mj-text css-class="info-label">Prix</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="60%">
|
|
||||||
<mj-text font-size="18px" font-weight="bold" color="#00aa00">
|
|
||||||
{{#if (eq primaryCurrency "EUR")}}
|
|
||||||
{{priceEUR}} EUR
|
|
||||||
{{else}}
|
|
||||||
{{priceUSD}} USD
|
|
||||||
{{/if}}
|
|
||||||
</mj-text>
|
|
||||||
<mj-text font-size="12px" color="#666666">
|
|
||||||
{{#if (eq primaryCurrency "EUR")}}
|
|
||||||
(≈ {{priceUSD}} USD)
|
|
||||||
{{else}}
|
|
||||||
(≈ {{priceEUR}} EUR)
|
|
||||||
{{/if}}
|
|
||||||
</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<!-- Documents Section -->
|
|
||||||
<mj-section background-color="#f9f9f9" padding="20px">
|
|
||||||
<mj-column>
|
|
||||||
<mj-text font-size="18px" font-weight="bold" color="#0066cc">
|
|
||||||
📄 Documents fournis
|
|
||||||
</mj-text>
|
|
||||||
<mj-divider border-color="#0066cc" border-width="2px" />
|
|
||||||
{{#each documents}}
|
|
||||||
<mj-text padding="5px 0">
|
|
||||||
• <strong>{{this.type}}:</strong> {{this.fileName}}
|
|
||||||
</mj-text>
|
|
||||||
{{/each}}
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
|
||||||
<mj-section background-color="#ffffff" padding="30px 20px">
|
|
||||||
<mj-column>
|
|
||||||
<mj-text font-size="16px" font-weight="bold" align="center">
|
|
||||||
Veuillez confirmer votre décision:
|
|
||||||
</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<mj-section background-color="#ffffff" padding="0px 20px 30px 20px">
|
|
||||||
<mj-column width="50%" padding="0px 10px">
|
|
||||||
<mj-button
|
|
||||||
background-color="#00aa00"
|
|
||||||
href="{{acceptUrl}}"
|
|
||||||
font-size="16px"
|
|
||||||
font-weight="bold"
|
|
||||||
border-radius="5px"
|
|
||||||
padding="15px 30px"
|
|
||||||
>
|
|
||||||
✓ Accepter la demande
|
|
||||||
</mj-button>
|
|
||||||
</mj-column>
|
|
||||||
<mj-column width="50%" padding="0px 10px">
|
|
||||||
<mj-button
|
|
||||||
background-color="#cc0000"
|
|
||||||
href="{{rejectUrl}}"
|
|
||||||
font-size="16px"
|
|
||||||
font-weight="bold"
|
|
||||||
border-radius="5px"
|
|
||||||
padding="15px 30px"
|
|
||||||
>
|
|
||||||
✗ Refuser la demande
|
|
||||||
</mj-button>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<!-- Important Notice -->
|
|
||||||
<mj-section background-color="#fff8e1" padding="20px">
|
|
||||||
<mj-column>
|
|
||||||
<mj-text font-size="14px" color="#f57c00" font-weight="bold">
|
|
||||||
⚠️ Important
|
|
||||||
</mj-text>
|
|
||||||
<mj-text font-size="13px" color="#666666">
|
|
||||||
Cette demande expire automatiquement dans <strong>7 jours</strong> si aucune action n'est prise. Merci de répondre dans les meilleurs délais.
|
|
||||||
</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<mj-section background-color="#f4f4f4" padding="20px">
|
|
||||||
<mj-column>
|
|
||||||
<mj-text font-size="12px" color="#666666" align="center">
|
|
||||||
Référence de réservation: <strong>{{bookingId}}</strong>
|
|
||||||
</mj-text>
|
|
||||||
<mj-divider border-color="#cccccc" padding="10px 0" />
|
|
||||||
<mj-text font-size="12px" color="#666666" align="center">
|
|
||||||
© 2025 Xpeditis. Tous droits réservés.
|
|
||||||
</mj-text>
|
|
||||||
<mj-text font-size="11px" color="#999999" align="center">
|
|
||||||
Cet email a été envoyé automatiquement. Merci de ne pas y répondre directement.
|
|
||||||
</mj-text>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
|
||||||
</mj-body>
|
|
||||||
</mjml>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Register Handlebars helper for equality check
|
// Register Handlebars helper for equality check
|
||||||
Handlebars.registerHelper('eq', function (a, b) {
|
Handlebars.registerHelper('eq', function (a, b) {
|
||||||
return a === b;
|
return a === b;
|
||||||
});
|
});
|
||||||
|
|
||||||
const { html } = mjml2html(mjmlTemplate);
|
const htmlTemplate = `
|
||||||
const template = Handlebars.compile(html);
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Nouvelle demande de réservation</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: 'Arial', 'Helvetica', sans-serif;
|
||||||
|
background-color: #f4f6f8;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 20px auto;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
background: linear-gradient(135deg, #045a8d, #00bcd4);
|
||||||
|
color: #ffffff;
|
||||||
|
padding: 30px 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.header h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.header p {
|
||||||
|
margin: 5px 0 0;
|
||||||
|
font-size: 14px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 30px 20px;
|
||||||
|
}
|
||||||
|
.section-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #045a8d;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
border-bottom: 2px solid #00bcd4;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
.details-table {
|
||||||
|
width: 100%;
|
||||||
|
margin: 20px 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
.details-table td {
|
||||||
|
padding: 12px 10px;
|
||||||
|
border-bottom: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
.details-table td:first-child {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #045a8d;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
.details-table td:last-child {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.price-highlight {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #00aa00;
|
||||||
|
}
|
||||||
|
.price-secondary {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.documents-section {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 6px;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.documents-section ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 10px 0 0;
|
||||||
|
}
|
||||||
|
.documents-section li {
|
||||||
|
padding: 8px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.documents-section li:before {
|
||||||
|
content: '📄 ';
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
.action-buttons {
|
||||||
|
text-align: center;
|
||||||
|
margin: 30px 0;
|
||||||
|
}
|
||||||
|
.action-buttons p {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
.button-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
gap: 15px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 15px 30px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
.btn-accept {
|
||||||
|
background-color: #00aa00;
|
||||||
|
}
|
||||||
|
.btn-accept:hover {
|
||||||
|
background-color: #008800;
|
||||||
|
}
|
||||||
|
.btn-reject {
|
||||||
|
background-color: #cc0000;
|
||||||
|
}
|
||||||
|
.btn-reject:hover {
|
||||||
|
background-color: #aa0000;
|
||||||
|
}
|
||||||
|
.important-notice {
|
||||||
|
background-color: #fff8e1;
|
||||||
|
border-left: 4px solid #f57c00;
|
||||||
|
padding: 15px;
|
||||||
|
margin: 20px 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.important-notice p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.important-notice strong {
|
||||||
|
color: #f57c00;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
background-color: #f4f6f8;
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.footer p {
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
.booking-reference {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #045a8d;
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 600px) {
|
||||||
|
.container {
|
||||||
|
margin: 10px;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.header h1 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
.button-container {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
width: 100%;
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="header">
|
||||||
|
<h1>🚢 Nouvelle demande de réservation</h1>
|
||||||
|
<p>Xpeditis</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<div class="content">
|
||||||
|
<p style="font-size: 16px; margin-bottom: 20px;">
|
||||||
|
Bonjour,
|
||||||
|
</p>
|
||||||
|
<p style="font-size: 14px; line-height: 1.6; margin-bottom: 20px;">
|
||||||
|
Vous avez reçu une nouvelle demande de réservation via Xpeditis. Veuillez examiner les détails ci-dessous et confirmer ou refuser cette demande.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- Booking Details -->
|
||||||
|
<div class="section-title">📋 Détails du transport</div>
|
||||||
|
<table class="details-table">
|
||||||
|
<tr>
|
||||||
|
<td>Route</td>
|
||||||
|
<td>{{origin}} → {{destination}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Volume</td>
|
||||||
|
<td>{{volumeCBM}} CBM</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Poids</td>
|
||||||
|
<td>{{weightKG}} kg</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Palettes</td>
|
||||||
|
<td>{{palletCount}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Type de conteneur</td>
|
||||||
|
<td>{{containerType}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Transit</td>
|
||||||
|
<td>{{transitDays}} jours</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Prix</td>
|
||||||
|
<td>
|
||||||
|
<span class="price-highlight">
|
||||||
|
{{#if (eq primaryCurrency "EUR")}}
|
||||||
|
{{priceEUR}} EUR
|
||||||
|
{{else}}
|
||||||
|
{{priceUSD}} USD
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
<span class="price-secondary">
|
||||||
|
{{#if (eq primaryCurrency "EUR")}}
|
||||||
|
(≈ {{priceUSD}} USD)
|
||||||
|
{{else}}
|
||||||
|
(≈ {{priceEUR}} EUR)
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- Documents Section -->
|
||||||
|
<div class="documents-section">
|
||||||
|
<div class="section-title">📄 Documents fournis</div>
|
||||||
|
<ul>
|
||||||
|
{{#each documents}}
|
||||||
|
<li><strong>{{this.type}}:</strong> {{this.fileName}}</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div class="action-buttons">
|
||||||
|
<p>Veuillez confirmer votre décision :</p>
|
||||||
|
<div class="button-container">
|
||||||
|
<a href="{{acceptUrl}}" class="btn btn-accept">✓ Accepter la demande</a>
|
||||||
|
<a href="{{rejectUrl}}" class="btn btn-reject">✗ Refuser la demande</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Important Notice -->
|
||||||
|
<div class="important-notice">
|
||||||
|
<p>
|
||||||
|
<strong>⚠️ Important</strong><br>
|
||||||
|
Cette demande expire automatiquement dans <strong>7 jours</strong> si aucune action n'est prise. Merci de répondre dans les meilleurs délais.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<div class="footer">
|
||||||
|
<p class="booking-reference">Référence de réservation : {{bookingId}}</p>
|
||||||
|
<p>© 2025 Xpeditis. Tous droits réservés.</p>
|
||||||
|
<p>Cet email a été envoyé automatiquement. Merci de ne pas y répondre directement.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const template = Handlebars.compile(htmlTemplate);
|
||||||
return template(data);
|
return template(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user