{% extends "base.html" %} {% block title %}Customers{% endblock %} {% block content %}
{# ── Header row ── #}

people Customers

{{ total_count }} customer{{ 's' if total_count != 1 }}
{# ── CSV Import Banner ── #}
upload_file
{# ── Idle state ── #}

Import Addons CSV for customer names & historical orders

Export the CSV from Addons → Statistics (semicolon-delimited). This adds client names, websites, and order history not available via API.

{# ── Processing state ── #} {# ── Complete state ── #} {# ── Error state ── #}
{# ── Filters ── #}
{# Preserve sort + pill values as hidden inputs (updated by JS) #} {% if filters.search or filters.country or filters.bc or filters.ctype or filters.online or filters.module %} Clear {% endif %}
{# ── Online / Module pill filters ── #}
Online: {% set online_opts = [('', 'All'), ('yes', 'Online'), ('no', 'Offline'), ('unchecked', 'Unchecked')] %} {% for val, label in online_opts %} {% endfor %}
Module: {% set module_opts = [('', 'All'), ('yes', 'Found'), ('no', 'Not found'), ('unchecked', 'Unchecked')] %} {% for val, label in module_opts %} {% endfor %}
{# ── Summary strip (live-updated during checks) ── #}
Showing {{ total_count }} customer{{ 's' if total_count != 1 }} {% if check_summary %} | task_alt {{ check_summary.checked | default(0) }} checked · {{ check_summary.online | default(0) }} online · {{ check_summary.offline | default(0) }} offline · extension {{ check_summary.module_found | default(0) }} modules · schedule {{ check_summary.unchecked | default(0) }} queued {% endif %}
{# ── Inline website-check progress banner (hidden until check runs) ── #} {# ── Sort tabs ── #}
{% set sort_options = [ ('activity_desc', 'Recent Activity'), ('revenue_desc', 'Top Revenue'), ('orders_desc', 'Most Orders'), ('tickets_desc', 'Most Tickets'), ('name_asc', 'Name A-Z'), ] %} {% for val, label in sort_options %} {{ label }} {% endfor %}
{# ── Customers table ── #} {% if customers %}
{% set base_url = url_for('customers_list', search=filters.search, country=filters.country, ctype=filters.ctype, bc=filters.bc, online=filters.online, module=filters.module, page=1) %} {% macro sort_th(label, key, align='left') %} {% set cur = filters.sort or 'activity_desc' %} {% set is_active = cur.startswith(key) %} {% set next_sort = key + '_asc' if cur == key + '_desc' else key + '_desc' %} {% set arrow = '' %} {% if cur == key + '_desc' %}{% set arrow = ' ▼' %}{% elif cur == key + '_asc' %}{% set arrow = ' ▲' %}{% endif %} {% endmacro %} {{ sort_th('Customer', 'name') }} {{ sort_th('Website', 'website') }} {{ sort_th('Country', 'country') }} {{ sort_th('Revenue', 'revenue', 'right') }} {{ sort_th('Orders', 'orders', 'center') }} {{ sort_th('Products', 'products', 'center') }} {{ sort_th('Tickets', 'tickets', 'center') }} {{ sort_th('Last Activity', 'activity') }} {% for c in customers %} {# Customer name #} {# Website URL #} {# Online status #} {# Module found #} {# Country #} {# Revenue #} {# Orders #} {# Products #} {# Tickets #} {# BC badge #} {# Last Activity #} {% endfor %}
{{ label }}{{ arrow | safe }} Online ModuleBC
{{ c.display_name }} {% if c.website %} {% set ws_href = c.website if c.website.startswith('http') else 'https://' + c.website %} {{ c.website | truncate(30) }} {% else %} -- {% endif %} {% set ss = site_status.get(c.customer_hash) %} {% if ss and ss.is_online == true %} {% set tip = 'Online' %} {% if ss.error_message %}{% set tip = 'Online (' ~ ss.http_status ~ ' — ' ~ ss.error_message ~ ')' %} {% elif ss.http_status %}{% set tip = 'Online (' ~ ss.http_status ~ ', ' ~ (ss.response_time_ms or '?') ~ 'ms)' %}{% endif %} {% elif ss and ss.is_online == false %} {% set tip = 'Offline' %} {% if ss.error_message %}{% set tip = 'Offline — ' ~ ss.error_message %}{% endif %} {% else %}--{% endif %} {% set ss = site_status.get(c.customer_hash) %} {% if ss and ss.modules_found_slugs %}
{% for slug in ss.modules_found_slugs %} {% if slug in ss.get('purchased_slugs', []) %} {{ slug }} {% else %} {{ slug }} {% endif %} {% endfor %}
{% elif ss and ss.module_found == false %}No {% else %}--{% endif %}
{{ c.country_code or '--' }} €{{ c.total_revenue }} {{ c.total_orders }} {{ c.total_products }} {{ c.total_threads }} {% if c.has_bc %} BC {% else %} -- {% endif %} {{ c.last_activity.strftime('%Y-%m-%d') if c.last_activity else '--' }}
{# ── Pagination ── #} {% if total_pages > 1 %}

Page {{ page }} of {{ total_pages }}

{% if page > 1 %} chevron_left {% endif %} {% for p in range(1, total_pages + 1) %} {% if p == page %} {{ p }} {% elif p == 1 or p == total_pages or (p >= page - 2 and p <= page + 2) %} {{ p }} {% elif p == 2 or p == total_pages - 1 %} {% endif %} {% endfor %} {% if page < total_pages %} chevron_right {% endif %}
{% endif %} {% else %} {# ── Empty state ── #}
people

No customers found.

Try adjusting your filters or sync orders first.

{% endif %}
{% endblock %}