settings email templates - BevvyTech/BrewskiDocs GitHub Wiki

Settings – Email Templates (/settings/email-templates)

Purpose

  • Allow team owners/admins to manage the email templates used for client communications (invoices, newsletters, etc.).
  • Surface a shortcut for super users to the dedicated global template management page at /settings/email-templates/global.

Data & Permissions

  • Fetches team template metadata via GET /email-templates with the active teamId.
  • Saving uses PUT /email-templates/:identifier; reverting calls DELETE /email-templates/:identifier.
  • “Send test email” posts to /email-templates/:identifier/test and delivers a sample to the current user’s email address, using mock context data.
  • Requires owner/admin membership for the active team. Super-user access to Brewski-wide templates now lives at /settings/email-templates/global.

UI & Interactions

  • Primary controls (Save, Revert, Send test email) live in the page header beside the breadcrumbs so the layout matches other detail pages; buttons disable while requests are in flight or the user lacks permission.
  • Dropdown selector lists available templates (label pulled from registry). Selecting a template fills the subject/HTML/text editors, and the choice is remembered per team via a cookie so reloads reopen the same template.
  • Metadata sidebar surfaces template source (custom vs default), last updated timestamp, and marketing category (where applicable).
  • “Available variables” now renders as a table: each {{variable}} has a single text field whose placeholder shows the page-provided default sample. Overrides persist in the brewski_email_template_variable_overrides cookie so test values survive reloads; leaving a field blank falls back to the placeholder default. When you send a test email, the current overrides feed directly into the payload so you can preview personalised content.
  • HTML and text editors sit inside collapsible sections. Preview actions on each open a modal—HTML renders in an iframe, the text version renders in a <pre> block—using the current override values (no send required).
  • The card hides when no team is selected. Global templates are managed on the dedicated super-user page.
⚠️ **GitHub.com Fallback** ⚠️