{% extends '@kohinos/common/layout.html.twig' %}

{% block content %}
<div class='container prestalist mt-2'>
	{% if type == 'Prestataires' and tav_env == 1 %}
		{% set label = 'Points de vente' %}
	{% else %}
		{% set label = type %}
	{% endif %}
	{% include '@kohinos/block/breadcrumb.html.twig' with {'label' : label} %}
   	<div class="d-flex justify-content-center">
	   	<div class="btn-group text-center mb-2" role="group" aria-label="Basic example">
			<a href='{{ path('liste_prestataire', {'order': 'raison'}) }}' type="button" class="btn btn-secondary">Par nom</a>
			<a href='#' type="button" class="btn btn-primary">Par groupe local</a>
		</div>
	</div>
    {% set groupe = '' %}
    {% set groupePrestaHtml = [] %}
    {% for presta in prestas %}
    	{% if groupe != presta.groupe.name %}
    		{% if loop.index != 1 %}
    			</div>
    			</div>
    		{% endif %}
    		{% set groupe = presta.groupe.name %}
			<h5 class="w-100 card-header mb-3 text-primary border border-primary" style='cursor:pointer;'>
				<a class='d-inline' href='{{ path('liste_presta_by_groupe', {'slug': presta.groupe.slug}) }}'>GROUPE LOCAL : {{ presta.groupe.name|upper }}</a>
				<a href='#' class='nounderline d-inline float-right' tyle='cursor:pointer;' data-toggle="collapse" data-target="#collapsepresta{{ presta.groupe.id }}" aria-expanded="false" aria-controls="collapsepresta{{ presta.groupe.id }}"><i class="fa fa-caret-down ml-2" aria-hidden="true"></i></a>
			</h5>
			<div id="collapsepresta{{ presta.groupe.id }}" class='collapse show'>
			{% if loop.index != 1 %}
				<div class='row'>
    		{% endif %}
		{% endif %}
    	{% if loop.index == 1 %}
    		<div class="row">
		{% endif %}
	    <div class="col-12 col-md-6 mb-2">
	    	{% include '@kohinos/presta/onepresta.html.twig' %}
		</div>
		{% if loop.index%2 == 0 %}
			</div>
			<div class="row">
		{% endif %}
    {% endfor %}
	</div>
</div>
{% endblock %}
