<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* madeshop/template/madeshop/review_product.twig */
class __TwigTemplate_eb171bd1f28103a7ec39946f1b042ed52789ae621fc20534a07aedf05f358cd3 extends \Twig\Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        if (($context["reviews"] ?? null)) {
            // line 2
            echo "  <div class=\"r-top\">
  <div class=\"row\">
    <div class=\"col-sm-8\">
      <p>";
            // line 5
            echo ($context["review_info"] ?? null);
            echo "</p>
    </div>
    <div class=\"col-sm-4\">  
      <div class=\"rating-block\">      
      ";
            // line 9
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["review_num"] ?? null));
            foreach ($context['_seq'] as $context["key"] => $context["value"]) {
                // line 10
                echo "      <div class=\"r-line\"><span class=\"rating\">";
                echo $context["key"];
                echo "</span><div style=\"width:";
                echo (($context["value"] / ($context["review_total"] ?? null)) * 100);
                echo "%\"></div><span class=\"count-r\">";
                echo $context["value"];
                echo "</span></div>
      ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['key'], $context['value'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 12
            echo "      </div>
    </div>
  </div>
  </div>
  ";
            // line 16
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["reviews"] ?? null));
            foreach ($context['_seq'] as $context["_key"] => $context["review"]) {
                // line 17
                echo "  <div class=\"review-block rev rev";
                echo twig_get_attribute($this->env, $this->source, $context["review"], "review_id", [], "any", false, false, false, 17);
                echo "\">
    <div class=\"rev-info\">
      <ul class=\"list-unstyled\">
      ";
                // line 20
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(range(1, 5));
                foreach ($context['_seq'] as $context["_key"] => $context["i"]) {
                    // line 21
                    echo "    \t";
                    if ((twig_get_attribute($this->env, $this->source, $context["review"], "rating", [], "any", false, false, false, 21) < $context["i"])) {
                        // line 22
                        echo "    \t<li class=\"nocheck\"></li>
    \t";
                    } else {
                        // line 24
                        echo "    \t<li class=\"\"></li>
    \t";
                    }
                    // line 26
                    echo "    \t";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['i'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 27
                echo "      </ul>
      <div class=\"rev-autor\">";
                // line 28
                echo twig_get_attribute($this->env, $this->source, $context["review"], "author", [], "any", false, false, false, 28);
                echo "</div>
    </div>
    <div>
      <p>";
                // line 31
                echo twig_get_attribute($this->env, $this->source, $context["review"], "text", [], "any", false, false, false, 31);
                echo "</p>
      <div class=\"over\">
    \t<div class=\"pull-left rev-data\">";
                // line 33
                echo twig_get_attribute($this->env, $this->source, $context["review"], "date_added", [], "any", false, false, false, 33);
                echo "</div>
    \t<div class=\"pull-right\">
    \t  <div class=\"r-vote\">
    \t\t<div class=\"block-plus\" onclick=\"vote('";
                // line 36
                echo twig_get_attribute($this->env, $this->source, $context["review"], "review_id", [], "any", false, false, false, 36);
                echo "','like');\"><i class=\"fa fa-thumbs-up\"></i><div class=\"r-num like\">";
                echo twig_get_attribute($this->env, $this->source, $context["review"], "yes", [], "any", false, false, false, 36);
                echo "</div></div>
    \t\t<div class=\"block-minus\" onclick=\"vote('";
                // line 37
                echo twig_get_attribute($this->env, $this->source, $context["review"], "review_id", [], "any", false, false, false, 37);
                echo "','unlike');\"><i class=\"fa fa-thumbs-down\"></i><div class=\"r-num unlike\">";
                echo twig_get_attribute($this->env, $this->source, $context["review"], "unlike", [], "any", false, false, false, 37);
                echo "</div></div>
    \t  </div>
    \t</div>
      </div>
\t  ";
                // line 41
                if (twig_get_attribute($this->env, $this->source, $context["review"], "mtext", [], "any", false, false, false, 41)) {
                    // line 42
                    echo "\t  <div class=\"mtext\">
\t  <b>Admin</b>
\t  ";
                    // line 44
                    echo twig_get_attribute($this->env, $this->source, $context["review"], "mtext", [], "any", false, false, false, 44);
                    echo "
\t  </div>
\t  ";
                }
                // line 47
                echo "    </div>
  </div>
  ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['review'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 50
            echo "  <div class=\"text-right\">";
            echo ($context["pagination"] ?? null);
            echo "</div>
";
        } else {
            // line 52
            echo "  <p class=\"empty\">";
            echo ($context["text_no_reviews"] ?? null);
            echo "</p>
";
        }
        // line 53
        echo " 
<script>
function vote(id,type){
    \$('.rev'+id).addClass('r-alert'); 
\t\$.post('index.php?route=madeshop/review_product/vote', {id:id, type:type}, function(data){\t\t
\t\tif(data){
\t\t    var vol = parseInt(\$('.rev'+id+' .'+type).text());
\t\t    \$('.rev'+id+' .'+type).text(vol+1);\t\t  
\t\t} else {
\t\t    alert('";
        // line 62
        echo ($context["text_ready"] ?? null);
        echo "');
\t\t}\t
\t});
}
--></script>";
    }

    public function getTemplateName()
    {
        return "madeshop/template/madeshop/review_product.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  184 => 62,  173 => 53,  167 => 52,  161 => 50,  153 => 47,  147 => 44,  143 => 42,  141 => 41,  132 => 37,  126 => 36,  120 => 33,  115 => 31,  109 => 28,  106 => 27,  100 => 26,  96 => 24,  92 => 22,  89 => 21,  85 => 20,  78 => 17,  74 => 16,  68 => 12,  55 => 10,  51 => 9,  44 => 5,  39 => 2,  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "madeshop/template/madeshop/review_product.twig", "");
    }
}
