Files
kooltab-backoffice/apps/api/templates/emails

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.
{{#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:
  {{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