{# Client select component - when only one client exists, pre-fill and gray out per Issue #467 #}
{% macro client_select(name, clients, selected_id=None, required=False, only_one_client=False, single_client=None, id=None) %}
{% set input_id = id or name %}
{% set locked_client = get_locked_client() %}
{% if locked_client %}
{% elif (not only_one_client) and (single_client is none) and clients and (clients|length == 1) %}
{# Fallback: if route didn't pass only_one_client/single_client, infer it from the list #}
{% elif only_one_client and single_client %}
{% else %}
{% endif %}
{% endmacro %}