81 lines
2.7 KiB
Markdown
81 lines
2.7 KiB
Markdown
# Email templates
|
|
|
|
Each email the API sends is a pair of files in this folder:
|
|
|
|
| File | Purpose |
|
|
|---|---|
|
|
| `<name>.html` | The email itself. Its `<title>` is used as the subject line. |
|
|
| `<name>.txt` | Optional plain-text version, shown by mail clients that don't render HTML. |
|
|
|
|
Templates are read from disk every time an email is sent, so edits apply without restarting the API.
|
|
To keep them outside the image, mount a folder and point `EMAIL_TEMPLATES_DIR` at it.
|
|
|
|
## Placeholders
|
|
|
|
Write `{{name}}` to insert a value. Values are HTML-escaped in the `.html` file (and the subject),
|
|
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.
|
|
|
|
| Placeholder | Example |
|
|
|---|---|
|
|
| `{{customerName}}` | Jan Peeters |
|
|
| `{{venueName}}` | Café De Kroon |
|
|
| `{{amount}}` | € 29,00 |
|
|
| `{{itemCount}}` | 12 |
|
|
| `{{#hasItems}}…{{/hasItems}}` | Shown when there are drinks to list. |
|
|
| `{{#items}}…{{/items}}` | Repeated for each line on the tab, with: |
|
|
| `{{quantity}}` | 10 |
|
|
| `{{productName}}` | Cola |
|
|
| `{{unitPrice}}` | € 2,50 |
|
|
| `{{lineTotal}}` | € 25,00 |
|
|
|
|
### `test-email`
|
|
|
|
Sent by the test button next to a customer's email address.
|
|
|
|
| Placeholder | Example |
|
|
|---|---|
|
|
| `{{customerName}}` | Jan Peeters |
|
|
| `{{venueName}}` | Café De Kroon |
|
|
|
|
### `cash-payment`
|
|
|
|
Sent to the venue's cash payment addresses (dashboard settings) whenever a tab is paid in cash, on a terminal or on
|
|
the dashboard.
|
|
|
|
| Placeholder | Example |
|
|
|---|---|
|
|
| `{{customerName}}` | Jan Peeters |
|
|
| `{{venueName}}` | Café De Kroon |
|
|
| `{{amount}}` | € 29,00 |
|
|
| `{{settledAt}}` | 27 oktober 2026 om 22:15 |
|
|
| `{{settledBy}}` | Bar tablet, or the dashboard user's name |
|
|
| `{{#hasItems}}…{{/hasItems}}` | Shown when anything was paid for |
|
|
| `{{#items}}…{{/items}}` | Repeated for each paid line, with: |
|
|
| `{{quantity}}` | 10 |
|
|
| `{{productName}}` | Cola |
|
|
| `{{lineTotal}}` | € 25,00 |
|