<div hx-get="{{ insert_tag('env::request') }}" hx-headers='{"VR-Ajax": "WaSlotsModule"}' hx-trigger="updateWaList from:body" class="{{ class }} content-wrapper block"{{ cssID }}{% if style is defined and style is not empty %} style="{{ style }}"{% endif %}>

    {% block filter %}
        <form hx-get="{{ insert_tag('env::request') }}" hx-headers='{"VR-Ajax": "WaSlotsModule"}' hx-trigger="change, submit" hx-target="closest .content-wrapper" class="filter">
            <div class="flex">
                <div class="full two-fifth-500 kapazitaet">
                    <select name="filter_kapazitaet">
                        <option value="">-</option>
                        {% for option in filter.kapazitaet.options %}
                            <option value="{{ option }}"{% if filter.kapazitaet.selected is defined and filter.kapazitaet.selected == option %} selected{% endif %}>{{ option }}</option>
                        {% endfor %}
                    </select>
                </div>
                <div class="full two-fifth-500 sorte">
                    <select name="filter_sorte">
                        <option value="">-</option>
                        {% for key, option in filter.sorte.options %}
                            <option value="{{ key }}"{% if filter.sorte.selected is defined and filter.sorte.selected == key %} selected{% endif %}>{{ option }}</option>
                        {% endfor %}
                    </select>
                </div>
                <div class="full fifth-500 submit"><button>Filter übernehmen</button></div>
            </div>
        </form>
    {% endblock %}

    {% block content %}
        {% if days is defined and days|length %}
            <div class="list">
                {% for day,slots in days %}
                    <h3 class="toggler-dis">{{ day|date('d.m.Y') }}<span class="counter">{{ slots|length }}</span></h3>
                    <div class="accordion-dis">
                        <div class="slots">
                            {% for slot in slots %}
                                <div class="row{{ not slot.buchbar ? ' error' : '' }}">
                                    <div class="flex align-items-center">
                                        <div class="full half-500 third-900 time">
                                            <span class="title">Uhrzeit</span>
                                            {{ slot.time|date('H:i') }}
                                        </div>
                                        <div class="full half-500 fourth-900 behaelter">
                                            <span class="title">Verfügbare Behälterkapazität</span>
                                            {{ slot.behaelterAvailable }}
                                        </div>
                                        <div class="full two-third-500 fourth-900 rebsorten">
                                            <span class="title">Verarbeitete Sorten</span>
                                            {{ slot.sorte|join(', ') }}
                                        </div>
                                        <div class="full third-500 sixth-900 align-right action">
                                            <a hx-get="/_ajax/vr_wa/v1/slot?do=details&id={{ slot.id }}" hx-target="body" hx-swap="beforeend" href="javascript:;" class="button{{ not slot.buchbar ? ' pseudo' : '' }}">Anzeigen</a>
                                        </div>
                                    </div>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                {% endfor %}
            </div>
        {% endif %}
    {% endblock %}

    {% block script %}
        {#<script>
            jQuery(function($) {
                $(".mod_wa_slots_list").accordion({
                    // Put custom options here
                    heightStyle: 'content',
                    header: '.toggler',
                    collapsible: true,
                    create: function(event, ui) {
                        ui.header.addClass('active');
                        $('.toggler').attr('tabindex', 0);
                    },
                    activate: function(event, ui) {
                        ui.newHeader.addClass('active');
                        ui.oldHeader.removeClass('active');
                        $('.toggler').attr('tabindex', 0);
                    }
                });
            });
        </script>#}
    {% endblock %}

</div>