{% extends 'base.html.twig' %}
{% block title %}SiteWEB{% endblock %}
{% block body %}
<div class="row">
<div class="col-12">
<img src="//via.placeholder.com/500x300.png?text=promo" width="100%" height="250px" />
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 sous-menu-home">
<nav class="navbar navbar-light bg-light" style="display:block;justify-content: normal;padding:0; background-color: #fff !important;border-bottom: 1px solid #d1d5db;">
<a class="navbar-brand active" href="/">
À la une
<span class="border-active"></span>
</a>
<a class="navbar-brand" href="/new-promo">
Nouveaux ({{countNew}})
<span class="border-active"></span>
</a>
<a class="navbar-brand" href="/hot-promo">
Hot
<span class="border-active"></span>
</a>
<div class="filter-elment">
<a class="btn btn-info filter-element-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Filtrer
<i class="fa fa-sliders" aria-hidden="true"></i>
</a>
<div class="form-filter" aria-labelledby="dropdownMenuLink">
{{ render(controller('App\\Controller\\MainController::filterForm')) }}
</div>
</div>
</nav>
</div>
</div>
<div class="row">
<div class="col-lg-8 col-md-12 col-sm-12">
{% for article in articles %}
{% set classArticle = "" %}
{% if article.endPromo|date('Y-m-d') < "now"|date('Y-m-d') %}
{% set classArticle = "expired-article" %}
{% endif %}
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="card-article-detail home {{classArticle}}" style="width: 100%;margin-top: 15px;">
<div class="row" style="height: 180px;">
<div class="col-4">
<div class="img-home-article" style="position:relative;">
{% if article.best == true %}
<div class="hot-promo" data-toggle="tooltip" title="Ne ratez pas ce promo !"></div>
<img class="hot-promo-icon" data-toggle="tooltip" title="Ne ratez pas ce promo !" src="{{asset('img/hot-promo.png')}}">
{% endif %}
<img class="card-img-top" height="170" src="{{ vich_uploader_asset(article, 'imageFile')|imagine_filter('article') }}" alt="img-promo">
</div>
</div>
<div class="col-8">
<h5 class="card-title text-left" style="float:left;font-size:15px;" title="{{ article.titre | raw |title }}">{{ article.titre |title | slice(0, 100, true) }} {% if article.titre |length > 100 %}...{% endif %}</h5>
<span class="home-article-expire">
{% if article.endPromo|date('Y-m-d') >= "now"|date('Y-m-d') %}
<i class="fa fa-hourglass-half" aria-hidden="true"></i>
Expire le {{article.endPromo|date('d/m/Y')}}
{% else %}
<i class="fa fa-hourglass-end" aria-hidden="true"></i>
Expiré
{% endif %}
</span>
<h5 class="card-title text-left" style="float:left;font-size:15px;width:100%;" title="{{ article.contenu | raw |title }}">
{{ article.contenu | slice(0, 100, true)| raw }} {% if article.contenu |length > 100 %}...{% endif %}
</h5>
<span class="home-article-supplier">
Bons plans
<a href="{{ path('article_store', {'id': article.supplier.id}) }}">
{{article.supplier.name}}
</a>
</span>
</div>
</div>
<div class="card-footer" style="width: 100%;position: relative;padding: 0;background: white;border: none;">
{% if article.endPromo|date('Y-m-d') >= "now"|date('Y-m-d') %}
<a href="{{ path('web_store_article', {'slug': article.slug}) }}" class="btn btn-primary" style="float:right;">
<i class="fa fa-check" aria-hidden="true"></i>
Voir Promo
</a>
{% endif %}
<button type="button" class="btn btn-outline-info" style="float:right;margin-right: 5px;">
{% set nbrecomment = 0 %}
{% for comment in article.commentaires %}
{% if comment.actif == 1 %}
{% set nbrecomment = nbrecomment + 1 %}
{% endif %}
{% endfor %}
{{ nbrecomment }}
<i class="fa fa-comment"></i>
</span>
</button>
</div>
</div>
</div>
{% endfor %}
<div class="row">
<div class="col-12">
{{ knp_pagination_render(articles) }}
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
{{ render(controller('App\\Controller\\MainController::rigthData')) }}
</div>
</div>
<h1>Site WEB des promos</h1>
<p>Ceci est la page d'accueil</p>
{% if app.user is null %}
<a href="{{path('app_login')}}">Admin</a>
{% endif %}
{% endblock %}