{% extends 'forms/base_widget.html' %}


{% block html %}
    {% set value_json = field._value() | tojson %}
    <div data-tooltip-anchor>
        <div id="userGroupList-{{ field.id }}" style="margin-bottom: 10px;"></div>
        <input type="hidden" id="{{ field.id }}" name="{{ field.name }}" value="{{ value_json | forceescape }}"
               {{ input_args | html_params }}>
        <span></span>
    </div>
{% endblock %}


{% block javascript %}
    <script>
        setupPrincipalListWidget({
            formContext: {{ [field.get_form().__class__.__name__, field.id] | tojson }},
            fieldId: {{ field.id | tojson }},
            eventId: {{ (field._event.id if field._event else none) | tojson }},
            withGroups: {{  field.allow_groups | tojson }},
            withExternalUsers: {{ field.allow_external_users | tojson }},
            withEventRoles: {{ field.allow_event_roles | tojson }},
            withCategoryRoles: {{ field.allow_category_roles | tojson }},
            withRegistrants: {{ field.allow_registration_forms | tojson }},
            withEmails: {{ field.allow_emails | tojson }},
            protectedFieldId: {{ field.protected_field_id | default(none) | tojson }},
            searchToken: {{ field.search_token | tojson }},
        });
    </script>
{% endblock %}
