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

{% block content %}
<div class='container rubriquelist mt-2'>
	{% include '@kohinos/block/breadcrumb.html.twig' with {'label' : 'Rubriques'|trans} %}
	<h1>{{ 'Rubriques'|trans }}</h1>
	<div class="row">
    {% for rubrique in rubriques %}
    	{% if rubrique.prestataires|length > 0 %}
	    	<div class="col-12 col-md-6 mb-2">
		    	<div class="card mb-2">
					<h5 class="card-header text-primary" style='cursor:pointer;'>
					  	{% if rubrique.media is not null %}
							{% thumbnail rubrique.media, 'small' %}
						{% endif %}
						<a class='rubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name}}</a>
					</h5>
					{% if rubrique.content|length > 0 %}
						<div class="card-body">
							<div class="card-text">
					    		{{rubrique.content|raw}}
					    	</div>
						</div>
					{% endif %}
					<div class="card-text mx-auto text-center mt-2">
						<h5 class='btn btn-secondary'><a href="#" class="card-text mt-3" style='cursor:pointer;' data-toggle="collapse" data-target="#collapsepresta{{rubrique.id}}" aria-expanded="false" aria-controls="collapsepresta{{rubrique.id}}">
							{% if tav_env == 1 %}
								{{ 'Voir le(s)'|trans }} {{rubrique.prestataires|length}} {{'point(s) de vente'|trans}}
							{% else %}
								{{ 'Voir le(s)'|trans }} {{rubrique.prestataires|length}} {{'prestataire(s)'|trans}}
							{% endif %}
						</a></h5>
					</div>
		    		<ul class="list-group list-group-flush collapse mx-2 my-2" id="collapsepresta{{rubrique.id}}">
		    			{% for presta in rubrique.prestataires %}
			    			<div class='my-2'>
			    				{% include '@kohinos/presta/onepresta.html.twig' with { 'withrubrique': false} %}
			    			</div>
	                  	{% endfor %}
	                </ul>
				</div>
			</div>
		{% endif %}
    {% endfor %}
</div>
</div>
{% endblock %}
