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

{% block content %}
<div class='container prestalist mt-5'>
   <h1>{{type}} :</h1>
    <div class="row">
    {% for presta in prestas %}
	    <div class="col-12 col-md-6 mb-2">
	    	<div class='card'>
				<div class="card-header"><h2>{{presta.raison}}</h2></div>
				<div class="card-body">
					<h4 class="card-title">{{presta.statut}} - {{presta.siret}}</h4>
					<h6 class="card-title">{{ 'Responsable'|trans }} : {{presta.responsable}} ({{presta.metier}})</h6>
					<div class="card-text">
						{% if presta.media %}
							<p class='mb-4'>
								{% set pathMedia = mediaurl(presta.media, 'reference') %}
								{% if pathMedia ends with '.jpg' or pathMedia ends with '.png' or pathMedia ends with '.bmp' or pathMedia ends with '.gif' %}
									<img src="{% path presta.media, 'reference' %}" style="max-width: 100%;"/>
								{% else %}
									<a href="{% path presta.media, 'reference' %}">{{'Télécharger'|trans}}</a>
								{% endif %}
							</p>
						{% endif %}
						{% if presta.description != null %}
							<p class='mb-4'>
								{{presta.description|raw}}
							</p>
						{% endif %}
						{% if presta.horaires != null %}
							<em class='mb-4'>
								{{ 'Horaires'|trans }} : {{presta.horaires|raw}}
							</em>
						{% endif %}
						{% if presta.web != null %}
							<p>
								<a href='{{presta.web}}'>{{ 'Site web'|trans }}</a>
							</p>
						{% endif %}
					</div>
				</div>
			</div>
		</div>
		{% if loop.index%2 == 0 %}
			</div>
			<div class="row">
		{% endif %}
    {% endfor %}
	</div>
</div>
{% endblock %}
