{% extends 'base.html.twig' %}
{% block section %}
<section class="container-fluid p-0 mb-0">
{% block slider %}
{% include('clientWeb/slider/slider.html.twig') %}
{% endblock %}
<aside class="container py-0 my-3">
<div class="justify-content-center align-items-center mx-0 px-0 my-2 py-0 title-section">
<h2 class="title text-right mr-2 py-lg-2 py-0 my-lg-2 my-0">Livre d'or</h2>
</div>
<div class="row mx-0 px-0 justify-content-center" id="presentationCard">
<div class="col-12" id="postList">
<div class="row justify-content-center" id="accordion">
{% if listComment is not null %}
{% set index =1 %}
{% for groupsComment in listComment %}
<div class="col-12 card postGroup" id="postGroup">
<div class="row justify-content-center">
<div class="col-12 card-header" id="postTitle{{ index }}">
<div class="row justify-content-center mx-0 px-0" >
<a class="btn btn-link btnCommunityPost col-md-10 col-8 text-left" data-toggle="collapse" data-target="#postContent{{ index }}" aria-expanded="true" aria-controls="postContent{{ index }}">
<p class="text my-0 py-0">Posté par <span class="text-dark">{{ groupsComment.userId.pseudonym }}</span> - date de publication {{ groupsComment.datePostComment|date("d/m/Y") }}</p>
</a>
<div class="col-md-2 col-4 text-right">
{% if groupsComment.notation == 5 %}
{% set imgNotation = '5etoile.png' %}
{% elseif groupsComment.notation > 4.5 and groupsComment.notation < 5 or groupsComment.notation == 4.5 %}
{% set imgNotation = '4_5etoile.png' %}
{% elseif groupsComment.notation > 4 and groupsComment.notation < 4.49 or groupsComment.notation == 4 %}
{% set imgNotation = '4etoile.png' %}
{% elseif groupsComment.notation > 3.5 and groupsComment.notation < 4 or groupsComment.notation == 3.5 %}
{% set imgNotation = '3_5etoile.png' %}
{% elseif groupsComment.notation > 3 and groupsComment.notation < 3.5 or groupsComment.notation == 3 %}
{% set imgNotation = '3etoile.png' %}
{% elseif groupsComment.notation > 2.5 and groupsComment.notation < 3 or groupsComment.notation == 2.5 %}
{% set imgNotation = '2_5etoile.png' %}
{% elseif groupsComment.notation > 2 and groupsComment.notation < 2.5 or groupsComment.notation == 2 %}
{% set imgNotation = '2etoile.png' %}
{% elseif groupsComment.notation > 1.5 and groupsComment.notation < 2 or groupsComment.notation == 1.5 %}
{% set imgNotation = '1_5etoile.png' %}
{% elseif groupsComment.notation > 1 and groupsComment.notation < 1.5 or groupsComment.notation == 1 %}
{% set imgNotation = '1etoile.png' %}
{% elseif groupsComment.notation > 0.5 and groupsComment.notation < 1 or groupsComment.notation == 0.5 %}
{% set imgNotation = '0_5etoile.png' %}
{% else %}
{% set imgNotation = 'aucuneEtoile.png' %}
{% endif %}
<img class="img-fluid py-0 my-0" src="{{ absolute_url(asset('img/profil/' ~ imgNotation)) }}" />
</div>
</div>
</div>
<div class="collapse" aria-labelledby="postTitle{{ index }}" data-parent="#accordion" id="postContent{{ index }}">
<div class="card-body">
{{ groupsComment.comment|raw }}
</div>
</div>
</div>
</div>
{% set index=index+1 %}
{% endfor %}
{% else %}
<p class="text col-12">Aucun commentaires postés</p>
{% endif %}
</div>
</div>
</div>
</aside>
{% if is_granted('ROLE_USER') %}
<aside class="container-fluid p-0 mx-0 my-5">
<div class="row justify-content-center">
{{ form_start(formPost, {'attr': {'class':'col-12 px-0'}}) }}
<div class="row justify-content-center mx-0 px-0">
<div class="col-md-10 col-sm-12 col-12 mx-0 px-0">
<div class="row justify-content-center mb-2">
{{ form_widget(formPost.comment) }}
</div>
</div>
<div class="col-md-10 col-sm-12 col-12 mx-0 px-0 my-3">
<div class="row justify-content-center mb-2 form-check text-center">
<h5 class="col-12 my-2 px-0 mx-0">Notez nous !</h5>
<div class="col-12 my-2 px-0 mx-0">
<div class="row justify-content-center mx-0 px-0">
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-6 col-12 mx-0 px-0">
<div class="row justify-content-center mx-0 px-0 iconRow">
<i class="col-1 px-0 mx-0 fa fa-star"></i><i class="col-1 px-0 mx-0 fa fa-star"></i><i class="col-1 px-0 mx-0 fa fa-star"></i><i class="col-1 px-0 mx-0 fa fa-star"></i><i class="col-1 px-0 mx-0 fa fa-star"></i>
</div>
</div>
</div>
</div>
<div class="col-12 px-0 mx-0 my-2">
<div class="row justify-content-center">
{{ form_widget(formPost.notation) }}
</div>
</div>
</div>
</div>
<div class="col-12 text-center mx-0 px-0">
<button class="btn btn-lg my-2 font-weight-bold col-md-2 col-12" id="loginButton" type="submit">
Publier
</button>
</div>
</div>
{{ form_end(formPost) }}
</div>
</aside>
{% endif %}
</section>
{% endblock %}