<div class="single s info_review">
<h3>Avis</h3>
<div class="general">
<div class="list">
<div class="single_class_review">
<div class="title">Stellaire</div>
<div class="sep"></div>
<div class="count">{{ countByNote[5] }}</div>
</div>
<div class="single_class_review">
<div class="title">Galactique</div>
<div class="sep"></div>
<div class="count">{{ countByNote[4] }}</div>
</div>
<div class="single_class_review">
<div class="title">Solaire</div>
<div class="sep"></div>
<div class="count">{{ countByNote[3] }}</div>
</div>
<div class="single_class_review">
<div class="title">Lunaire</div>
<div class="sep"></div>
<div class="count">{{ countByNote[2] }}</div>
</div>
<div class="single_class_review">
<div class="title">Cométaire</div>
<div class="sep"></div>
<div class="count">{{ countByNote[1] }}</div>
</div>
</div>
<div class="counting infos">
<div class="avg">{{ averageNote }}</div>
<!-- Afficher la moyenne des notes ici -->
<div class="rating">
<div
class="list_stars">
<!-- Vous pouvez afficher les étoiles en fonction de la moyenne des notes -->
{% for i in 1..5 %}
{% if i <= averageNote %}
<div class="star">
<i class="fa-solid fa-star"></i>
</div>
{% else %}
<div class="star">
<i class="fa-regular fa-star"></i>
</div>
{% endif %}
{% endfor %}
</div>
</div>
<div class="total">{{ avis|length }}
Avis</div>
<!-- Afficher le nombre total d'avis -->
</div>
</div>
<div class="list_rating">
{% for avi in avis %}
<div class="item">
<div class="avatar">
<img src="{{ asset('images/cours/person.jpg') }}" alt="">
</div>
<div class="avis_content">
<div class="top infos">
<div class="username">{{ avi.getIdUser().getUsername()}}</div> <!-- Accéder au nom d'utilisateur via la relation avec l'entité User -->
<div class="date">{{ avi.getDate().format('d/m/Y') }}</div>
<div class="rating">
<div class="list_stars">
{% for i in 1..5 %}
{% if avi.getNote() >= i %}
<div class="star">
<i class="fa-solid fa-star"></i>
</div>
{% else %}
<div class="star">
<i class="fa-regular fa-star"></i>
</div>
{% endif %}
{% endfor %}
</div>
<small>({{ avi.getNote() }})</small>
</div>
</div>
<div class="avis_p">
<p>{{ avi.getMessage() }}</p>
</div>
</div>
<div class="options">
<div class="dropdown dropstart">
<div class="drop_btn" data-bs-toggle="dropdown">
<i class="fa-solid fa-ellipsis-v"></i>
</div>
<ul class="dropdown-menu">
<li>
<div opengeneralpopup data-link="{{ path('home_avis_avis_modifier', {id: avi.getIdAvi ,courSlug:courSlug})}}">modifier</div>
</li>
<li>
<a href="{{ path('home_avis_avis_supprimer', {id: avi.getIdAvi ,courSlug:courSlug})}}">supprimer</a>
</li>
</ul>
</div>
</div>
</div>
{% endfor %}
</div>
<div class="my_review">
<h4>Ajouter un Avis</h4>
<form method="post" action="{{ path('home_avis_ajouter_avis') }}">
<input type="hidden" name="courId" value="{{courId}}">
<input type="hidden" name="courSlug" value="{{courSlug}}">
<div class="rate infos">
<span>Notez ce cours</span>
<div class="rating">
<div class="list_stars">
<input
type="hidden" name="note" value="5">
{# Par défaut, la note est 5 #}
{% for i in 1..5 %}
<div class="star">
<input type="radio" id="star{{ i }}" name="note" value="{{ i }}">
<label for="star{{ i }}">
<div class="star">
<i class="fa-solid fa-star"></i>
</div>
</label>
</div>
{% endfor %}
</div>
</div>
</div>
<div>
<label class="form-label">Écrire un message</label>
<textarea class="form-control" rows="3" name="message"></textarea>
</div>
<button class="btn_main" type="submit">Poster</button>
</form>
</div>
</div>