{% extends 'layout.html.twig' %}
{% block layout %}
<div class="row">
<div class="d-lg-block col-lg-3 homepage-navbar">
<div class="list-group">
<a href="{{ path('search', {search: search, categorie: null}) }}" class="list-group-item list-group-item-action {{ (null == categoryRequest) ? "active" : "" }}">
Toutes les catégories
</a>
<a href="{{ path('search', {search: search, categorie: 'jurisprudences'}) }}" class="color jurisprudence list-group-item list-group-item-action {{ ('jurisprudences' == categoryRequest) ? "active" : "" }}">
Jurisprudences
</a>
<div class="list-group list-group-horizontal">
<a href="{{ path('search', {search: search, categorie: 'tutos'}) }}" class="color tuto flex-fill list-group-item list-group-item-action {{ ('tutos' == categoryRequest) and (null == catId) ? "active" : "" }}" style="border-radius:0px;">
La Base
</a>
<button class="list-group-item list-group-item-action col-2 {{ ('tutos' == categoryRequest) and (null == catId) ? "active" : "" }}" type="button" data-toggle="collapse" data-target="#tutoscat" aria-expanded="false" aria-controls="tutoscat" style="text-align:center;border-radius:0px;"><span class="fa fa-caret-down"></button>
</div>
{% for labaseCat in labaseCategory %}
<a id="tutoscat" href="{{ path('search', {search: search, categorie: 'tutos', id: labaseCat.id}) }}" class="{{ ('tutos' == categoryRequest) and (null != catId) ? "" : "collapse"}} list-group-item list-group-item-action {{ ('tutos' == categoryRequest) and (catId == labaseCat.id) ? "active" : "" }}"><i>{{labaseCat.name}}</i></a>
{% endfor %}
<div class="list-group list-group-horizontal">
<a href="{{ path('search', {search: search, categorie: 'infos'}) }}" class="color news list-group-item list-group-item-action {{ ('infos' == categoryRequest) and (null == catId) ? "active" : "" }}" style="border-radius:0px;">
Actus
</a>
<button class="list-group-item list-group-item-action col-2 {{ ('infos' == categoryRequest) and (null == catId) ? "active" : "" }}" type="button" data-toggle="collapse" data-target="#newscat" aria-expanded="false" aria-controls="tutoscat" style="text-align:center;border-radius:0px;"><span class="fa fa-caret-down"></button>
</div>
{% for newsCat in newsCategory %}
<a id="newscat" href="{{ path('search', {search: search, categorie: 'infos', id: newsCat.id}) }}" class="{{('infos' == categoryRequest) and (null != catId) ? "" : "collapse" }} list-group-item list-group-item-action {{ ('infos' == categoryRequest) and (catId == newsCat.id) ? "active" : "" }}"><i>{{newsCat.name}}</i></a>
{% endfor %}
</div>
</div>
<div class="col-lg-9 col-12">
<div class="row">
{% if dataContent|length > 0 %}
{% for data in dataContent %}
<div class="col-sm-12 col-lg-6 liste">
<div class="card" style="border: 1px solid black;height: 100%;min-height:215px">
<h5 class="card-header color {% if data.type == 'tuto' %} tuto {% elseif data.type == 'news' %} news {% else %} jurisprudence {% endif %}">
<strong>
{{ data.title }}
</strong>
</h5>
<div class="card-body">
<p class="card-text">
<i>
{% if data.chapo != null %}
{{ data.chapo|length > 200 ? data.chapo|slice(0,200)|raw : data.chapo|raw }}
{{ data.chapo|length > 200 ? '...' : ''}}
{% else %}
{{ data.content|length > 200 ? data.content|slice(0,200)|raw : data.content|raw }}
{{ data.content|length > 200 ? '...' : ''}}
{% endif %}
</i>
</p>
</div>
<div class="card-footer">
{% if data.type == 'tuto' %}
<a href="{{ path('tuto_read', {tutoId: data.id}) }}" style="float:right; background-color:var(--info); border-color:var(--info);" class="btn btn-primary">
Lire l'article
</a>
{% elseif data.type == 'news' %}
<a href="{{ path('news_read', {actuId: data.id}) }}" style="float:right; background-color:var(--news-color); border-color:var(--news-color);" class="btn btn-primary">
Lire l'actu
</a>
{% else %}
<a href="{{ path('jurisprudence_show', {jurisprudenceId: data.id}) }}" style="float:right;" class="btn btn-primary">
Consulter la jurisprudence
</a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="col-12">
<p>
Aucune ressource ne correspond à votre recherche
</p>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}