{% load reviews_tags %}
{% load i18n %}
{% load l10n %}

<article class="review">
    <div class="star-content">
        {% include "oscar/catalogue/reviews/partials/stars.html" with rating=review.score %}
        <p class="review-title">{{ review.title }}</p>
    </div>

    <p>{{ review.body|striptags }}</p>

    <p class="review-user">
        <small>
            {% if review.user == user %}
{% blocktrans with review_date=review.date_created %}Reviewed by you on {{ review_date }}{% endblocktrans %}
            {% else %}
{% blocktrans with name=review.reviewer_name review_date=review.date_created %}Reviewed by <strong>{{ name }}</strong> on {{ review_date }}{% endblocktrans %}
            {% endif %}
            | <a href="{% url 'catalogue:reviews-detail' product_slug=product.slug product_pk=product.pk pk=review.pk %}">{% trans 'Permalink' %}</a>
        </small>
    </p>

    <small><b>{% trans "Is this review helpful?" %}</b></small>
    <div class="inline-buttons">
        <form action="{% url 'catalogue:reviews-vote' product_slug=product.slug product_pk=product.pk pk=review.pk %}" method="post" class="vote_agree my-2" >
            {% csrf_token %}
            <input type="hidden" name="delta" value="1"/>
            <button type="submit" class="btn btn-outline-primary" data-loading-text="{% trans 'Submitting...' %}"><i class="fa fa-thumbs-up-solid"></i> {{ review.num_up_votes }}</button>
        </form>
        <form class="my-2"  action="{% url 'catalogue:reviews-vote' product_slug=product.slug product_pk=product.pk pk=review.pk %}" method="post">
            {% csrf_token %}
            <input type="hidden" name="delta" value="-1"/>
            <button type="submit" class="btn btn-outline-primary" data-loading-text="{% trans 'Submitting...' %}"><i class="fa fa-thumbs-down-solid"></i> {{ review.num_down_votes }}</button>
        </form>
    </div>
</article>
