Skip to content

Commit

Permalink
Update order created and order completed email template
Browse files Browse the repository at this point in the history
  • Loading branch information
nghiavohuynhdai committed Mar 14, 2024
1 parent ba5b1ef commit bfdc2e0
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 14 deletions.
18 changes: 17 additions & 1 deletion src/payment/services/payment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,23 @@ export class PaymentService {
to: order.customer.email,
subject: `[Furnique] Đã nhận đơn hàng #${order.orderId}`,
template: 'order-created',
context: order
context: {
customer: order.customer,
items: order.items.map((item) => {
const variant = item.product.variants.find((variant) => variant.sku === item.sku)
return {
...item,
product: {
...item.product,
variant: {
...variant,
price: Intl.NumberFormat('en-DE').format(variant.price)
}
}
}
}),
totalAmount: Intl.NumberFormat('en-DE').format(order.totalAmount)
}
})
// 10. Send notification to staff
} else {
Expand Down
18 changes: 17 additions & 1 deletion src/task/services/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,23 @@ export class TaskService {
to: order.customer.email,
subject: `[Furnique] Đơn hàng #${order.orderId} đã được giao thành công`,
template: 'order-completed',
context: order
context: {
customer: order.customer,
items: order.items.map((item) => {
const variant = item.product.variants.find((variant) => variant.sku === item.sku)
return {
...item,
product: {
...item.product,
variant: {
...variant,
price: Intl.NumberFormat('en-DE').format(variant.price)
}
}
}
}),
totalAmount: Intl.NumberFormat('en-DE').format(order.totalAmount)
}
})
// 4. Send notification to staff

Expand Down
6 changes: 3 additions & 3 deletions src/templates/order-completed.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Chi tiết đơn hàng:
<tr>
<td style="border: 1px solid #ddd; padding: 8px;"><%= item.product.name %></td>
<td style="border: 1px solid #ddd; padding: 8px;"><%= item.quantity %></td>
<td style="border: 1px solid #ddd; padding: 8px;"><%= item.product.variants.find(variant => variant.sku == item.sku).price %></td>
<td style="border: 1px solid #ddd; padding: 8px;">&#8363;<%= item.product.variant.price %></td>
</tr>
<% }); %>
</tbody>
</table>
Tổng Cộng: <b><%= totalAmount %></b>
Tổng Cộng: <b>&#8363;<%= totalAmount %></b>
<div align="center" style="padding-top:10px">
<a href="https://www.furnique.tech/customer/orders/<%= _id %>" target="_blank">
<a href="https://www.furnique.tech/customer/orders/<%= _id %>" target="_blank" style="text-decoration: none;">
<img src="https://ci3.googleusercontent.com/meips/ADKq_NYVaPakFqAiVY0nV0ofSouvN9L1z5IPXEMnXGI7cDC2QzODNqWZbtxPiVtknKQTDcngkmkS0VgcnEczKmq2VcvjA7rxWbMeLU19p7LjY9ScARIX6-0xLQ=s0-d-e1-ft#https://img.alicdn.com/tfs/TB178CsJeH2gK0jSZFEXXcqMpXa-300-50.jpg" style="max-width:300px" border="0" class="CToWUd" data-bit="iit">
</a>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/templates/order-created.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Chi tiết đơn hàng:
<tr>
<td style="border: 1px solid #ddd; padding: 8px;"><%= item.product.name %></td>
<td style="border: 1px solid #ddd; padding: 8px;"><%= item.quantity %></td>
<td style="border: 1px solid #ddd; padding: 8px;"><%= item.product.variants.find(variant => variant.sku == item.sku).price %></td>
<td style="border: 1px solid #ddd; padding: 8px;">&#8363;<%= item.product.variant.price %></td>
</tr>
<% }); %>
</tbody>
</table>
Tổng Cộng: <b><%= totalAmount %></b>
Tổng tiền: <b>&#8363;<%= totalAmount %></b>
<div align="center" style="padding-top:10px">
<a href="https://www.furnique.tech/customer/orders/<%= _id %>" target="_blank">
<a href="https://www.furnique.tech/customer/orders/<%= _id %>" target="_blank" style="text-decoration: none;">
<img src="https://ci3.googleusercontent.com/meips/ADKq_NYVaPakFqAiVY0nV0ofSouvN9L1z5IPXEMnXGI7cDC2QzODNqWZbtxPiVtknKQTDcngkmkS0VgcnEczKmq2VcvjA7rxWbMeLU19p7LjY9ScARIX6-0xLQ=s0-d-e1-ft#https://img.alicdn.com/tfs/TB178CsJeH2gK0jSZFEXXcqMpXa-300-50.jpg" style="max-width:300px" border="0" class="CToWUd" data-bit="iit">
</a>
</div>
Expand Down
14 changes: 8 additions & 6 deletions src/templates/web-footer.ejs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<pre style="font-family: Arial, Helvetica, sans-serif; font-size: 1.5em;">
□□□───────────────────────────────
Trân trọng,
Furnique

□□□───────────────────────────────

Trân trọng,
Furnique

Email: [email protected]
Website: <a href="https://www.furnique.tech">https://www.furnique.tech</a>
────────────────────────────────□□□
</pre>

────────────────────────────────□□□
</pre>

0 comments on commit bfdc2e0

Please sign in to comment.