<?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/cart.twig */
class __TwigTemplate_96b9e786a97f3d5ac9378bf1cbc39477045e4d96cec06fc2a924f09db5fc83cb 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
        echo "<div id=\"cart\" class=\"container\">
  <ul class=\"list-unstyled\">
    ";
        // line 3
        if ((($context["products"] ?? null) || ($context["vouchers"] ?? null))) {
            // line 4
            echo "    <li class=\"in50\">";
            echo ($context["text_cart"] ?? null);
            echo "</li><li class=\"in50 text-right\">";
            echo ($context["text_weight"] ?? null);
            echo " ";
            echo ($context["weight"] ?? null);
            echo "</li>
    ";
            // line 5
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["products"] ?? null));
            foreach ($context['_seq'] as $context["_key"] => $context["product"]) {
                // line 6
                echo "    <li class=\"trow product-layout\">
      <span class=\"r-talert\">
      <p>";
                // line 8
                echo ($context["text_del"] ?? null);
                echo "</p>
      <b onclick=\"cart.remove('";
                // line 9
                echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 9);
                echo "');\">";
                echo ($context["text_yes"] ?? null);
                echo "</b>
      <b class=\"cart-no\">";
                // line 10
                echo ($context["text_no"] ?? null);
                echo "</b>
      </span>
        <div class=\"tblock timage\">
          ";
                // line 13
                if ( !twig_get_attribute($this->env, $this->source, $context["product"], "stock", [], "any", false, false, false, 13)) {
                    // line 14
                    echo "          <i class=\"fa fa-exclamation\"></i>
          ";
                }
                // line 16
                echo "          ";
                if (twig_get_attribute($this->env, $this->source, $context["product"], "thumb", [], "any", false, false, false, 16)) {
                    // line 17
                    echo "          <a href=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "href", [], "any", false, false, false, 17);
                    echo "\"><img src=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "thumb", [], "any", false, false, false, 17);
                    echo "\" alt=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "name", [], "any", false, false, false, 17);
                    echo "\" title=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "name", [], "any", false, false, false, 17);
                    echo "\" class=\"cart";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 17);
                    echo "\" /></a>
          ";
                }
                // line 19
                echo "\t    </div>
\t\t<div class=\"tblock tdes\">
\t\t  <div class=\"tblock pname\">
            <div class=\"tblock w50\">
              <a href=\"";
                // line 23
                echo twig_get_attribute($this->env, $this->source, $context["product"], "href", [], "any", false, false, false, 23);
                echo "\">";
                echo twig_get_attribute($this->env, $this->source, $context["product"], "name", [], "any", false, false, false, 23);
                echo "</a>
\t\t\t  ";
                // line 24
                if (twig_get_attribute($this->env, $this->source, $context["product"], "option", [], "any", false, false, false, 24)) {
                    // line 25
                    echo "\t\t\t  ";
                    $context['_parent'] = $context;
                    $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["product"], "option", [], "any", false, false, false, 25));
                    foreach ($context['_seq'] as $context["_key"] => $context["option"]) {
                        // line 26
                        echo "\t\t\t  <br />
\t\t\t  <small>";
                        // line 27
                        echo twig_get_attribute($this->env, $this->source, $context["option"], "name", [], "any", false, false, false, 27);
                        echo ": ";
                        echo twig_get_attribute($this->env, $this->source, $context["option"], "value", [], "any", false, false, false, 27);
                        echo "</small>
\t\t\t  ";
                    }
                    $_parent = $context['_parent'];
                    unset($context['_seq'], $context['_iterated'], $context['_key'], $context['option'], $context['_parent'], $context['loop']);
                    $context = array_intersect_key($context, $_parent) + $_parent;
                    // line 29
                    echo "\t\t\t  ";
                }
                // line 30
                echo "\t\t\t  ";
                if (twig_get_attribute($this->env, $this->source, $context["product"], "reward", [], "any", false, false, false, 30)) {
                    // line 31
                    echo "\t\t\t  <br />
\t\t\t  <small>";
                    // line 32
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "reward", [], "any", false, false, false, 32);
                    echo "</small>
\t\t\t  ";
                }
                // line 34
                echo "\t\t\t  ";
                if (twig_get_attribute($this->env, $this->source, $context["product"], "recurring", [], "any", false, false, false, 34)) {
                    // line 35
                    echo "\t\t\t  <br />
\t\t\t  <span class=\"label label-info\">";
                    // line 36
                    echo ($context["text_recurring_item"] ?? null);
                    echo "</span> <small>";
                    echo twig_get_attribute($this->env, $this->source, ($context["option"] ?? null), "recurring", [], "any", false, false, false, 36);
                    echo "</small>
\t\t\t  ";
                }
                // line 38
                echo "            </div><div class=\"tblock\">
\t\t\t  <i class=\"fa fa-trash-o\"></i>
\t\t\t  ";
                // line 40
                if (($context["iwishlist"] ?? null)) {
                    echo "<i class=\"fa fa-heart-o\" onclick=\"wishlist.add('";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "product_id", [], "any", false, false, false, 40);
                    echo "','cart";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 40);
                    echo "');\"></i>";
                }
                // line 41
                echo "\t\t\t  ";
                if (($context["icompare"] ?? null)) {
                    echo "<i onclick=\"compare.add('";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "product_id", [], "any", false, false, false, 41);
                    echo "','cart";
                    echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 41);
                    echo "');\" class=\"fa fa-align-left\"></i>";
                }
                // line 42
                echo "\t\t\t</div>
\t\t  </div><div class=\"tblock tprice\">
\t\t    <div class=\"tblock\">";
                // line 44
                echo twig_get_attribute($this->env, $this->source, $context["product"], "price", [], "any", false, false, false, 44);
                echo "</div><div class=\"qty\" title=\"";
                echo ($context["entry_qty"] ?? null);
                echo "\">
\t\t      <div class=\"plus\" data-id=\"";
                // line 45
                echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 45);
                echo "\"><i class=\"fa fa-caret-up\"></i></div>
\t\t\t  <input type=\"text\" name=\"quantity[";
                // line 46
                echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 46);
                echo "]\" value=\"";
                echo twig_get_attribute($this->env, $this->source, $context["product"], "quantity", [], "any", false, false, false, 46);
                echo "\" id=\"cart-quantity";
                echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 46);
                echo "\" class=\"input-quantity\" onchange=\"kolvo_cart()\"/>
\t\t\t  <div class=\"minus\" data-id=\"";
                // line 47
                echo twig_get_attribute($this->env, $this->source, $context["product"], "cart_id", [], "any", false, false, false, 47);
                echo "\" data-min=\"";
                echo twig_get_attribute($this->env, $this->source, $context["product"], "minimum", [], "any", false, false, false, 47);
                echo "\"><i class=\"fa fa-caret-down\"></i></div>
\t\t\t</div><div class=\"tblock text-right\">";
                // line 48
                echo twig_get_attribute($this->env, $this->source, $context["product"], "total", [], "any", false, false, false, 48);
                echo "</div>
\t\t  </div>
\t\t</div>
    </li>";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['product'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 51
            echo "<li class=\"class50\">
\t  <div class=\"marg30\">
\t    <div class=\"input-group btn-block\">
          <input type=\"text\" name=\"coupon2\" value=\"";
            // line 54
            echo ($context["coupon"] ?? null);
            echo "\" placeholder=\"";
            echo ($context["text_cupon"] ?? null);
            echo "\" id=\"input-coupon2\" class=\"form-control\">
          <span class=\"input-group-btn\">                   
          ";
            // line 56
            if (($context["coupon"] ?? null)) {
                // line 57
                echo "\t\t  <button type=\"button\" id=\"del-coupon\" onclick=\"cupon_cart(1)\"><i class=\"fa fa-times-circle\"></i></button>
\t\t  ";
            }
            // line 59
            echo "          <button type=\"button\" id=\"button-coupon\" class=\"btn\" onclick=\"cupon_cart(0)\">";
            echo ($context["text_add"] ?? null);
            echo "</button>
          </span>
\t\t</div>
\t  </div>
\t</li><li class=\"class50\">
      <div class=\"over marg30\">
        <table class=\"total-block\">
          ";
            // line 66
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["totals"] ?? null));
            foreach ($context['_seq'] as $context["_key"] => $context["total"]) {
                // line 67
                echo "          <tr>
            <td class=\"text-right\">";
                // line 68
                echo twig_get_attribute($this->env, $this->source, $context["total"], "title", [], "any", false, false, false, 68);
                echo "</td>
            <td class=\"text-right\"><strong>";
                // line 69
                echo twig_get_attribute($this->env, $this->source, $context["total"], "text", [], "any", false, false, false, 69);
                echo "</strong></td>
          </tr>
          ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['total'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 72
            echo "        </table>  
      </div>
\t  </li>
      ";
            // line 75
            if (($context["button"] ?? null)) {
                // line 76
                echo "\t  <li class=\"class50\"><p class=\"text-right\"><a href=\"";
                echo ($context["checkout"] ?? null);
                echo "\" class=\"abtn\">";
                echo ($context["text_checkout"] ?? null);
                echo "</a></p></li>
\t  ";
            } else {
                // line 78
                echo "\t<li class=\"class100\"><div class=\"cart-info\">";
                echo ($context["text_error"] ?? null);
                echo "</div></li>
\t";
            }
            // line 80
            echo "\t";
            if (($context["madeshop_order"] ?? null)) {
                echo "<li class=\"class50\"><div id=\"fast-form-btn\" class=\"abtn fast-form-btn\">";
                echo ($context["text_btn"] ?? null);
                echo "</div></li>
\t  <li class=\"fast-form\">
  <div id=\"fast-form\" class=\"table\">
<div class=\"cart-panel fast-form-btn\"><div class=\"container\"><i class=\"fa fa-arrow-up\"></i>";
                // line 83
                echo ($context["text_p"] ?? null);
                echo "</div></div> \t 
\t<div class=\"table-cell\">
\t  <div class=\"w65\"> 
\t\t<form method=\"POST\" id=\"form-order\">
          <div class=\"over marg30\">

\t\t<table class=\"total-block\">
          ";
                // line 90
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(($context["totals"] ?? null));
                foreach ($context['_seq'] as $context["_key"] => $context["total"]) {
                    // line 91
                    echo "          <tr>
            <td class=\"text-left\">";
                    // line 92
                    echo twig_get_attribute($this->env, $this->source, $context["total"], "title", [], "any", false, false, false, 92);
                    echo "</td>
            <td class=\"text-right\"><strong>";
                    // line 93
                    echo twig_get_attribute($this->env, $this->source, $context["total"], "text", [], "any", false, false, false, 93);
                    echo "</strong></td>
          </tr>
          ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['total'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 96
                echo "\t\t  
        </table>  
      </div><hr>
\t\t  <div class=\"form-group sm required\"><input name=\"order_phone\" type=\"tel\" placeholder=\"";
                // line 99
                echo ($context["text_phone"] ?? null);
                echo "\" value=\"\" id=\"order-phone\" required=\"\" class=\"form-control no-border\" data-inputmask=\"'mask': '";
                echo ($context["text_mask"] ?? null);
                echo "'\"></div>
          <div class=\"form-group\">
\t\t\t<button type=\"submit\" id=\"button-order\" class=\"btn made-btn\">";
                // line 101
                echo ($context["text_btn"] ?? null);
                echo "</button>
          </div>
          <div class=\"form-group\">
            <p class=\"checkbox\"><input type=\"checkbox\" checked=\"checked\" id=\"agree-order\"/> <label for=\"agree\">";
                // line 104
                echo ($context["text_agree"] ?? null);
                echo "</label></p>
          </div>
        </form>
\t  </div>\t
    </div>
  </div>
  </li>
\t  ";
            }
            // line 112
            echo "    ";
        } else {
            // line 113
            echo "    <li>
      <p class=\"empty\">";
            // line 114
            echo ($context["text_empty"] ?? null);
            echo "</p>
    </li>
    ";
        }
        // line 117
        echo "\t
  </ul>
</div>
<script type=\"text/javascript\"><!--
\$(document).ready(function() {
\t\t\$(document).on('click', '#fast-form-btn', function() { 
\t\t\t\$.getScript(\"catalog/view/theme/madeshop/script/inputmask.min.js\", function() {
\t\t\t\$(\"#order-phone\").inputmask();
\t\t\t});
        });
    });
    \$(document).on('click', '.fast-form-btn', function() {
\t   \$('#cart li:not(.fast-form)').slideToggle(500);
\t   \$('.fast-form').toggleClass('iopen');
\t   
    });
\t
    \$(document).on('click', '#button-order', function(e) {
    e.preventDefault();
        \$.ajax({
\t\t\turl: 'index.php?route=madeshop/order',
\t\t\ttype: 'post',
\t\t\tdata: \$('#order-phone').serialize(), 
            dataType: 'json',
\t\t\tbeforeSend: function() {
\t\t\t//\$('#cart').addClass('load-block');
\t\t\t},
\t\t\tcomplete: function(json) {\t
            console.log(json);\t\t\t
\t\t\t},
\t\t\tsuccess: function(json) {
            \$('#form-order .form-group').removeClass('has-error');
\t\t\tif (json['error']) {
            \$('#order-phone').parent().addClass('has-error');
\t\t\t
\t\t\t} else {
            \$('#cart-url .total').replaceWith('<span class=\"total red\">0</span>');\t
            \$('#form-order').slideUp();
\t\t\t\t\$('#fast-form .w65').append('<div class=\"text-center a-success\">' + json['text_order']+ '</div>');
\t\t\t\tsetTimeout(function () {
\t\t\t\t\t\$('body').click();
\t\t\t\t\t\$('#cart > ul').load('index.php?route=madeshop/cart/info ul li');
\t\t\t\t}, 4000);
\t\t\t}
\t\t\t}\t\t\t
        });
    });

\t\$(document).on('click', '.fa-trash-o', function(e) { 
        \$('.trow.open').removeClass('open');
        \$(this).parent().parent().parent().parent().addClass('open');

    });

\t\$(document).mouseup(function (e) {
\t\tvar container = \$(\".trow\");
\t\tif (container.has(e.target).length === 0){
\t\t\t\$('.trow.open').removeClass('open');
\t\t}
\t});

\t\$(document).on('click', '.cart-product', function() { 
\t    \$('.cart-alert').removeClass('open');
\t    \$(this).prev().addClass('open');
\t});

    \$(document).on('click', '.cart-no', function() { 
        \$(this).parent().parent().removeClass('open');
    });
    
\t\$(document).on('click', '.cart-wishlist', function() {
        \$(this).parent().parent().removeClass('open');
        var id = \$(this).attr('data-id');
        var pid = \$(this).attr('data-pid');
        cart.remove(id);
        wishlist.add(pid,2);
    });

    \$(document).on('click', '.minus', function() { 
        \$id = \$(this).attr('data-id'); 
        \$min = \$(this).attr('data-min');\t\t
\t\tvar \$input = \$('#cart-quantity'+\$id);
\t\tvar count = parseInt(\$input.val()) - 1;
        count = count < \$min ? \$min : count;
        \$input.val(count);
        \$input.change();
        return false;
    });
   \$(document).on('click', '.plus', function() {
        var id = \$(this).attr('data-id');
\t\tvar \$input = \$('#cart-quantity'+id);
        \$input.val(parseInt(\$input.val()) + 1);

        \$input.change();
        return false;
    });

    function kolvo_cart() {
\t\t\$.ajax({
\t\t\turl: 'index.php?route=madeshop/cart/edit',
\t\t\ttype: 'post',
\t\t\tdata: \$('#cart .input-quantity').serialize(), 
            dataType: 'json',
\t\t\tbeforeSend: function() {
\t\t\t\$('#cart').addClass('load-block');
\t\t\t},
\t\t\tcomplete: function() {\t\t\t
\t\t\t},
\t\t\tsuccess: function(json) {
\t\t\t\t\$('#cart').removeClass('load-block');
\t\t\t\t\$('#cart > ul').load('index.php?route=madeshop/cart/info ul li');
\t\t\t\t\$('#cart-url .total').replaceWith('<span class=\"total red\">' + json['total']+ '</span>');\t
\t\t\t}\t\t\t
        });\t\t\t
\t}

    function cupon_cart(del) {
        \$.ajax({
\t\turl: 'index.php?route=madeshop/cart/coupon',
\t\ttype: 'post',
\t\tdata: 'coupon=' + encodeURIComponent(\$('input[name=\\'coupon2\\']').val())+'&del='+del,
\t\tdataType: 'json',
\t\tbeforeSend: function() {\t\t\t
\t\t\t\$('#cart').addClass('load-block');
\t\t\t\$('#button-coupon').button('loading');
\t\t},
\t\tcomplete: function() {\t\t\t
\t\t\t
\t\t\t\$('#button-coupon').button('reset');
\t\t},
\t\tsuccess: function(json) {
\t\t\t\$('#cart').removeClass('load-block');
\t\t\t\$('.alert').remove();

\t\t\tif (json['error']) {
\t\t\t\talert(json['error']);

\t\t\t}

\t\t\tif (json['redirect']) {
\t\t\t\t\$('#cart > ul').load('index.php?route=madeshop/cart/info ul li');
\t\t\t}
\t\t}
\t    });
    }
    \$('#agree-order').on('click', function(e) {
    e.preventDefault();
    alert('";
        // line 264
        echo ($context["text_alert"] ?? null);
        echo "');
    });
\t
\t
\t\$(document).delegate('.madeshop-agree', 'click', function(e) {
    e.preventDefault();
    \$(\"#form-order\").slideUp( 300, \"linear\", function(){
    \$.ajax({
        url: \$(element).attr('href'),
        type: 'get',
        dataType: 'html',
        success: function(data) {
            html = '        <div id=\"agree-block\">';
            html += '        <b class=\"back\"><i class=\"fa fa-long-arrow-left\"></i>";
        // line 277
        echo ($context["text_back"] ?? null);
        echo "</b>';
            html += '        <div class=\"modal-title\">' + \$(element).text() + '</div>';
            html += '      <div class=\"form-body\">' + data + '</div>';
            html += '</div>';

            \$('#fast-form .table-cell').after(html);
        }
    });
    });
    var element = this;
});
\$(document).delegate('.back', 'click', function(e) {
    \$(\"#form-order\").slideDown();
    \$('#agree-block').remove();
});
//--></script>";
    }

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

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  532 => 277,  516 => 264,  367 => 117,  361 => 114,  358 => 113,  355 => 112,  344 => 104,  338 => 101,  331 => 99,  326 => 96,  317 => 93,  313 => 92,  310 => 91,  306 => 90,  296 => 83,  287 => 80,  281 => 78,  273 => 76,  271 => 75,  266 => 72,  257 => 69,  253 => 68,  250 => 67,  246 => 66,  235 => 59,  231 => 57,  229 => 56,  222 => 54,  217 => 51,  207 => 48,  201 => 47,  193 => 46,  189 => 45,  183 => 44,  179 => 42,  170 => 41,  162 => 40,  158 => 38,  151 => 36,  148 => 35,  145 => 34,  140 => 32,  137 => 31,  134 => 30,  131 => 29,  121 => 27,  118 => 26,  113 => 25,  111 => 24,  105 => 23,  99 => 19,  85 => 17,  82 => 16,  78 => 14,  76 => 13,  70 => 10,  64 => 9,  60 => 8,  56 => 6,  52 => 5,  43 => 4,  41 => 3,  37 => 1,);
    }

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