feat: change email template + add list of items

This commit is contained in:
2026-10-09 09:30:26 +02:00
parent 6f237a937a
commit 5246aeabc1
17 changed files with 474 additions and 55 deletions
+27 -2
View File
@@ -16,6 +16,25 @@ Write `{{name}}` to insert a value. Values are HTML-escaped in the `.html` file
and inserted as-is in the `.txt` file. A placeholder without a value stops the email from being sent,
so a typo never reaches a customer.
### Blocks
`{{#name}} ... {{/name}}` does one of two things, depending on the value:
- **A list** repeats the block once per item. Inside it you can use that item's placeholders
(and every placeholder from outside the block).
- **Anything else** shows the block only when the value is set (e.g. `true`), and hides it otherwise.
```html
{{#hasItems}}
<p>Overzicht van je poef:</p>
<table>
{{#items}}<tr><td>{{quantity}}x {{productName}}</td><td>{{lineTotal}}</td></tr>{{/items}}
</table>
{{/hasItems}}
```
Amounts are already formatted the Belgian way (`€ 25,00`).
### `payment-reminder`
Sent by "Send reminders" to customers with an unpaid balance.
@@ -24,8 +43,14 @@ Sent by "Send reminders" to customers with an unpaid balance.
|---|---|
| `{{customerName}}` | Jan Peeters |
| `{{venueName}}` | Café De Kroon |
| `{{amount}}` | €12.50 |
| `{{itemCount}}` | 3 |
| `{{amount}}` | € 29,00 |
| `{{itemCount}}` | 12 |
| `{{#hasItems}}…{{/hasItems}}` | Shown when the tab's lines are known. Terminals on an older app version don't report them. |
| `{{#items}}…{{/items}}` | Repeated for each line on the tab, with: |
| &nbsp;&nbsp;`{{quantity}}` | 10 |
| &nbsp;&nbsp;`{{productName}}` | Cola |
| &nbsp;&nbsp;`{{unitPrice}}` | € 2,50 |
| &nbsp;&nbsp;`{{lineTotal}}` | € 25,00 |
### `test-email`
@@ -2,12 +2,28 @@
<html>
<head>
<meta charset="utf-8">
<title>Payment reminder for your tab at {{venueName}}</title>
<title>Herinnering aan open poef bij {{venueName}}</title>
</head>
<body>
<p>Hi {{customerName}},</p>
<p>This is a friendly reminder that you have an open tab of <strong>{{amount}}</strong> at {{venueName}} (items: {{itemCount}}).</p>
<p>Please settle your tab at the bar at your earliest convenience.</p>
<p>Thank you!</p>
<p>Beste {{customerName}},</p>
<p>Dit is een kleine reminder om je poef van <strong>{{amount}}</strong> nog te betalen (items: {{itemCount}}).</p>
{{#hasItems}}
<p>Overzicht van je poef:</p>
<table cellpadding="4" cellspacing="0" style="border-collapse: collapse;">
{{#items}}
<tr>
<td>{{quantity}}x {{productName}}</td>
<td style="text-align: right; padding-left: 24px;">{{lineTotal}}</td>
</tr>
{{/items}}
<tr>
<td style="border-top: 1px solid #ccc;"><strong>Totaal</strong></td>
<td style="border-top: 1px solid #ccc; text-align: right; padding-left: 24px;"><strong>{{amount}}</strong></td>
</tr>
</table>
{{/hasItems}}
<p>Gelieve je poef zo spoedig mogelijk te betalen.</p>
<p>Met vriendelijke groet,</p>
<p>{{venueName}}</p>
</body>
</html>
+10 -5
View File
@@ -1,7 +1,12 @@
Hi {{customerName}},
Beste {{customerName}},
This is a friendly reminder that you have an open tab of {{amount}} at {{venueName}} (items: {{itemCount}}).
Dit is een vriendelijke herinnering om je openstaande poef van {{amount}} bij {{venueName}} (items: {{itemCount}}) te betalen.
{{#hasItems}}
Overzicht van je poef:
{{#items}}{{quantity}}x {{productName}} {{lineTotal}}
{{/items}}Totaal: {{amount}}
{{/hasItems}}
Gelieve je poef zo spoedig mogelijk te betalen.
Please settle your tab at the bar at your earliest convenience.
Thank you!
Met vriendelijke groet,
{{venueName}}