{% if reviews %}
  <div class="r-top">
  <div class="row">
    <div class="col-sm-8">
      <p>{{ review_info }}</p>
    </div>
    <div class="col-sm-4">  
      <div class="rating-block">      
      {% for key,value in review_num %}
      <div class="r-line"><span class="rating">{{ key }}</span><div style="width:{{ (value/review_total)*100 }}%"></div><span class="count-r">{{ value }}</span></div>
      {% endfor %}
      </div>
    </div>
  </div>
  </div>
  {% for review in reviews %}
  <div class="review-block rev rev{{ review.review_id }}">
    <div class="rev-info">
      <ul class="list-unstyled">
      {% for i in 1..5 %}
    	{% if review.rating < i %}
    	<li class="nocheck"></li>
    	{% else %}
    	<li class=""></li>
    	{% endif %}
    	{% endfor %}
      </ul>
      <div class="rev-autor">{{ review.author }}</div>
    </div>
    <div>
      <p>{{ review.text }}</p>
      <div class="over">
    	<div class="pull-left rev-data">{{ review.date_added }}</div>
    	<div class="pull-right">
    	  <div class="r-vote">
    		<div class="block-plus" onclick="vote('{{ review.review_id }}','like');"><i class="fa fa-thumbs-up"></i><div class="r-num like">{{ review.yes }}</div></div>
    		<div class="block-minus" onclick="vote('{{ review.review_id }}','unlike');"><i class="fa fa-thumbs-down"></i><div class="r-num unlike">{{ review.unlike }}</div></div>
    	  </div>
    	</div>
      </div>
	  {% if review.mtext %}
	  <div class="mtext">
	  <b>Admin</b>
	  {{ review.mtext }}
	  </div>
	  {% endif %}
    </div>
  </div>
  {% endfor %}
  <div class="text-right">{{ pagination }}</div>
{% else %}
  <p class="empty">{{ text_no_reviews }}</p>
{% endif %} 
<script>
function vote(id,type){
    $('.rev'+id).addClass('r-alert'); 
	$.post('index.php?route=madeshop/review_product/vote', {id:id, type:type}, function(data){		
		if(data){
		    var vol = parseInt($('.rev'+id+' .'+type).text());
		    $('.rev'+id+' .'+type).text(vol+1);		  
		} else {
		    alert('{{ text_ready }}');
		}	
	});
}
--></script>