Files
kooltab-backoffice/apps/api/templates/emails/README.md
T
brammie15 ca3af671cf
CI / build-and-test (push) Canceled after 0s
feat: add better tab view
2026-10-28 00:37:16 +01:00

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 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`
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: |
| &nbsp;&nbsp;`{{quantity}}` | 10 |
| &nbsp;&nbsp;`{{productName}}` | Cola |
| &nbsp;&nbsp;`{{lineTotal}}` | € 25,00 |