{% extends 'base_widget.html.twig' %}

{% block title %}WidgetController{% endblock %}

{% block body %}
    <div class="container-fluid">
        <div class="review-source-wrapper row" data-controller="reviewSource">
            {% for item in reviewSources %}
                <div class="col-md-4">
                    <div class="row align-items-center">
                        <div class="col-4">
                            <img src="/img/logo/{{item.name}}.png" alt="{{item.name}}" width="100%">
                        </div>
                        <div class="col-8">
                            <div class="rating-widget-star mt-2">
                                {% for i in 1..5 %}
                                    {% if item.rating_total|ceil >= i %}
                                        {% if item.isFloat and item.rating_total|ceil == i %}
                                            <i class="fa fa-star-half-o" aria-hidden="true"></i>
                                        {% else %}
                                            <i class="fa fa-star" aria-hidden="true"></i>
                                        {% endif %}
                                    {% else %}
                                        <i class="fa fa-star-o" aria-hidden="true"></i>           
                                    {% endif %}
                                {% endfor %}
                            </div>
                            <p>
                            {% if item.count_row_total > 0 %}
                                <span>{{ item.count_row_total }} оценок.</span>
                            {% endif %}
                            <span>В среднем - {{ rFloat(item.rating_total) }}</span>  
                            </p>
                        </div>
                    </div>
                </div>
            {% endfor %}
        </div>
    </div>
{% endblock %}
