{% extends "base.html" %} {% from '_upsell.html' import crown_badge, max_badge, beta_pill %} {% block title %}{{ _("Quick Replies") }}{% endblock %} {% block content %} {# ── Message row macro (defined before use) ── #} {% macro _message_row(m) %}
{{ m.title }}
{{ m.body[:80] }}{% if m.body|length > 80 %}…{% endif %}
{% if m.source == 'addons' %} Addons {% else %} {{ _("Local") }} {% endif %} {% if m.is_global %} {{ _("Global") }} {% elif m.product_names %} {{ m.product_names | join(', ') | truncate(40) }} {% else %} - {% endif %} {{ m.iso_lang or '-' }} {{ m.updated_at|localdt('%Y-%m-%d') if m.updated_at else '-' }} {% if m.source == 'local' %}
{% else %} {{ _("Synced") }} {% endif %} {% endmacro %}

{{ _("Quick Replies") }}

{{ _("Manage predefined reply templates for tickets.") }}

{# Free plan cap: 5 local templates #} {% set _local_count = messages | selectattr('source', 'equalto', 'local') | list | length %} {% if org_plan == 'free' and _local_count >= 5 %} {% else %} {% endif %}
{# ── Category filter chips ── #}
{% for cat in categories %} {% endfor %}
{# ── Grouped message list ── #}
{# Build groups: categories with messages first, then uncategorized #} {% set ns = namespace(uncategorized=[]) %} {% for cat in categories %} {% set cat_messages = messages | selectattr('category_id', 'equalto', cat.id) | list %} {% if cat_messages %}

{{ cat.name }}

{{ cat_messages | length }}
{% for m in cat_messages %} {{ _message_row(m) }} {% endfor %}
{% endif %} {% endfor %} {# Uncategorized section #} {% set uncategorized = messages | selectattr('category_id', 'none') | list %} {% if uncategorized %}

{{ _("Uncategorized") }}

{{ uncategorized | length }}
{% for m in uncategorized %} {{ _message_row(m) }} {% endfor %}
{% endif %} {% if not messages %}
{% trans %}No predefined messages yet. Click "New Message" to create one, or Sync to import from Addons.{% endtrans %}
{% endif %}
{# ── Create Modal ── #} {# ── Edit Modal ── #} {# ── Manage Categories Modal ── #} {% endblock %}