{# Control form loaded into the shared modal. `action` selects which form. Account fields are dropdowns populated from the live account list. close_on_ok closes the modal after a successful mutation; the Status panel updates live via its own hx-target. #} {% set close_on_ok = "if(event.detail.successful) this.closest('dialog').close()" %} {% macro account_select(name="account", blank=False, blank_label="— keep —", extra=None) %} {% endmacro %} {% macro head(title) %} {% endmacro %} {% macro needs_account_notice(title) %} {{ head(title) }} {% endmacro %} {% if action == "advance" %} {{ head("Advance time") }} {% elif action == "setdate" %} {{ head("Set date") }} {% elif action == "account" %} {{ head("New account") }} {% elif action == "editaccount" %} {% if not accounts %}{{ needs_account_notice("Edit account") }}{% else %} {{ head("Edit account") }} {% endif %} {% elif action == "usage" %} {% if not accounts %}{{ needs_account_notice("Inject usage") }}{% else %} {{ head("Inject usage") }} {% endif %} {% elif action == "settings" %} {% if not accounts %}{{ needs_account_notice("Periodic settings") }}{% else %} {{ head("Periodic settings") }} {% endif %} {% elif action == "qos" %} {% if not accounts %}{{ needs_account_notice("QoS control") }}{% else %} {{ head("QoS control") }} {% endif %} {% elif action == "scenario" %} {{ head("Run scenario") }} {% else %} {{ head("Unknown control") }} {% endif %}