{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <div class="row max-width-initial">
        <div class="small-12 columns">
            <p class="form-hint-text">Complete the form details below</p>
            <form method="POST" action="{{ path('user_access_form_process') }}">
                <input type="hidden" name="userType" value="{{ userType }}" />
                <div class="button-container bottom">
                    <button type="submit" class="button action-btn save-btn no-margin-bottom">Save</button>
                    <a href="{{ path('user_access') }}" class="button secondary no-margin-bottom">Back</a>
                </div>
                <hr class="max-width-initial">
                <ul>
                    <li><label for=""><input id="checkAll" type="checkbox"> Check All</label></li>
                    {% set ctr = 0 %}
                    {% for access in accesses %}
                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: access} %}
                        {% set ctr = ctr + 1 %}
                        {% if access.children is defined and access.children is iterable %}
                            <li>
                                <ul>
                                    {% for accessChildren1 in access.children %}
                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren1} %}
                                        {% set ctr = ctr + 1 %}
                                        {% if accessChildren1.children is defined and accessChildren1.children is iterable %}
                                            <li>
                                                <ul>
                                                    {% for accessChildren2 in accessChildren1.children %}
                                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren2} %}
                                                        {% set ctr = ctr + 1 %}
                                                        {% if accessChildren2.children is defined and accessChildren2.children is iterable %}
                                                            <li>
                                                                <ul>
                                                                    {% for accessChildren3 in accessChildren2.children %}
                                                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren3} %}
                                                                        {% set ctr = ctr + 1 %}
                                                                        {% if accessChildren3.children is defined and accessChildren3.children is iterable %}
                                                                            <li>
                                                                                <ul>
                                                                                    {% for accessChildren4 in accessChildren3.children %}
                                                                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren4} %}
                                                                                        {% set ctr = ctr + 1 %}
                                                                                        {% if accessChildren4.children is defined and accessChildren4.children is iterable %}
                                                                                            <li>
                                                                                                <ul>
                                                                                                    {% for accessChildren5 in accessChildren4.children %}
                                                                                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren5} %}
                                                                                                        {% set ctr = ctr + 1 %}
                                                                                                        {% if accessChildren5.children is defined and accessChildren5.children is iterable %}
                                                                                                            <li>
                                                                                                                <ul>
                                                                                                                    {% for accessChildren6 in accessChildren5.children %}
                                                                                                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren6} %}
                                                                                                                        {% set ctr = ctr + 1 %}
                                                                                                                        {% if accessChildren6.children is defined and accessChildren6.children is iterable %}
                                                                                                                            <li>
                                                                                                                                <ul>
                                                                                                                                    {% for accessChildren7 in accessChildren6.children %}
                                                                                                                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren7} %}
                                                                                                                                        {% set ctr = ctr + 1 %}
                                                                                                                                        {% if accessChildren7.children is defined and accessChildren7.children is iterable %}
                                                                                                                                            <li>
                                                                                                                                                <ul>
                                                                                                                                                    {% for accessChildren8 in accessChildren7.children %}
                                                                                                                                                        {% include '@RxConnexion/AccountUser/access_form_row_fields.html.twig' with {access: accessChildren8} %}
                                                                                                                                                        {% set ctr = ctr + 1 %}
                                                                                                                                                    {% endfor %}
                                                                                                                                                </ul>
                                                                                                                                            </li>
                                                                                                                                        {% endif %}
                                                                                                                                    {% endfor %}
                                                                                                                                </ul>
                                                                                                                            </li>
                                                                                                                        {% endif %}
                                                                                                                    {% endfor %}
                                                                                                                </ul>
                                                                                                            </li>
                                                                                                        {% endif %}
                                                                                                    {% endfor %}
                                                                                                </ul>
                                                                                            </li>
                                                                                        {% endif %}
                                                                                    {% endfor %}
                                                                                </ul>
                                                                            </li>
                                                                        {% endif %}
                                                                    {% endfor %}
                                                                </ul>
                                                            </li>
                                                        {% endif %}
                                                    {% endfor %}
                                                </ul>
                                            </li>
                                        {% endif %}
                                    {% endfor %}
                                </ul>
                            </li>
                        {% endif %}
                    {% endfor %}
                </ul>
                <hr class="max-width-initial">
                <div class="button-container">
                    <button type="submit" class="button action-btn save-btn">Save</button>
                    <a href="{{ path('user_access') }}" class="button secondary">Back</a>
                </div>
            </form>
        </div>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        jQ("#checkAll").click(function(){
            jQ('input:checkbox').not(this).prop('checked', this.checked);
        });
    </script>
{% endblock %}