{# _macros.html — Reusable Jinja2 components. Import with: {% from "_macros.html" import stat_card, auto_refresh_toggle, ... %} Use call block for modal: {% call m.modal_overlay(...) %} ... {% endcall %} #} {# ─── STAT CARD ───────────────────────────────────────────────────────────── label : visible label text value_id : DOM id for the big number (filled by JS via setStatFlash) sub : small subtitle text below the number variant : "" | "red" | "amber" | "green" (drives color + left border) sub_id : optional DOM id for the sub text (when JS updates it too) value_style: optional inline style string for the value span ─────────────────────────────────────────────────────────────────────────── #} {% macro stat_card(label, value_id, sub, variant="", sub_id="", value_style="") %}
{{ label }} {{ sub }}
{% endmacro %} {# ─── AUTO-REFRESH TOGGLE ──────────────────────────────────────────────────── Renders the auto-refresh label + live dot + toggle switch used in the header_right block. Page script must implement toggleAutoRefresh(bool). interval: display string shown in the title tooltip (e.g. "30s", "10s") ─────────────────────────────────────────────────────────────────────────── #} {% macro auto_refresh_toggle(interval="30s") %} {% endmacro %} {# ─── TABLE HEADER ─────────────────────────────────────────────────────────── icon : Font Awesome class, e.g. "fa-list-ul" title : displayed text count_id : DOM id for the count badge (filled by JS) extra : raw HTML injected after the count badge (e.g. a Refresh button) ─────────────────────────────────────────────────────────────────────────── #} {% macro table_header(icon, title, count_id, extra="") %}
{{ title }}
{{ extra | safe }}
{% endmacro %} {# ─── FILTER SEARCH INPUT ──────────────────────────────────────────────────── input_id : DOM id for the placeholder: placeholder text oninput_fn : JS expression for the oninput handler (e.g. "debounceLoad()") width : CSS width string (default "200px") ─────────────────────────────────────────────────────────────────────────── #} {% macro filter_search(input_id, placeholder, oninput_fn, width="200px") %}
{% endmacro %} {# ─── FILTER ACTIONS ───────────────────────────────────────────────────────── clear_fn : JS function name for the Clear button (called with "()") refresh_expression : full JS expression for the Refresh button onclick refresh_label : button label (default "Refresh") ─────────────────────────────────────────────────────────────────────────── #} {% macro filter_actions(clear_fn, refresh_expression, refresh_label="Refresh") %}
{% endmacro %} {# ─── MODAL OVERLAY ────────────────────────────────────────────────────────── Use with a {% call %} block so the caller controls the modal head + body: {% call m.modal_overlay("detailModal", "closeModal") %} {% endcall %} overlay_id : DOM id for the backdrop overlay close_event_fn : JS function name called with `(event)` on backdrop click ─────────────────────────────────────────────────────────────────────────── #} {% macro modal_overlay(overlay_id, close_event_fn) %} {% endmacro %} {# ─── PAGINATION BAR ───────────────────────────────────────────────────────── bar_id : DOM id for the outer .pagination container info_id : DOM id for the left info span ("1–15 of 320") btns_id : DOM id for the .pagination-btns container right_id: DOM id for the optional right-side info span (can be "") ─────────────────────────────────────────────────────────────────────────── #} {% macro pagination_bar(bar_id, info_id="", btns_id="", right_id="") %} {% endmacro %} {# ─── EMPTY STATE ──────────────────────────────────────────────────────────── icon : Font Awesome class, e.g. "fa-circle-check" message : text shown below the icon cols : colspan for the wrapping (default 6) ─────────────────────────────────────────────────────────────────────────── #} {% macro empty_state(icon, message, cols=6) %}

{{ message }}

{% endmacro %} {# ─── LOADING ROW ──────────────────────────────────────────────────────────── cols: colspan for the spinner cell (default 6) ─────────────────────────────────────────────────────────────────────────── #} {% macro loading_row(cols=6) %} {% endmacro %}