<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
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;
/* application/cart/index.html.twig */
class __TwigTemplate_be0c9c969b30e7db22307d83a1035d25df30b0c520d84948e16a9fc15cbf0995 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->blocks = [
'content' => [$this, 'block_content'],
'scripts' => [$this, 'block_scripts'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "application/layout.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "application/cart/index.html.twig"));
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "application/cart/index.html.twig"));
$this->parent = $this->loadTemplate("application/layout.html.twig", "application/cart/index.html.twig", 1);
yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
}
// line 3
public function block_content($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "content"));
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "content"));
// line 4
yield " <main class=\"main\">
<div class=\"breadcrumb\">
<div class=\"container\">
<ol class=\"breadcrumb__list\">
<li class=\"breadcrumb__item\"><a href=\"";
// line 8
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("home");
yield "\" class=\"breadcrumb__link\">Главная</a></li>
<li class=\"breadcrumb__item active\" aria-current=\"page\">Корзина</li>
</ol>
</div>
</div>
<div id=\"cartItems\">
";
// line 15
yield Twig\Extension\CoreExtension::include($this->env, $context, "application/cart/items.html.twig");
yield "
</div>
</main>
";
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
return; yield '';
}
// line 21
public function block_scripts($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "scripts"));
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "scripts"));
// line 22
yield "<script>
function initCartItems() {
\$('#clearPromo').click(function () {
\$(this).hide();
\$.ajax({
type: \"POST\",
url: '";
// line 29
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("clear-promo-ajax");
yield "',
success: function (data) {
location.reload();
}
}).fail(function() {
alertPopup('Ошибка');
});
return false;
});
\$('#promoForm').submit(function () {
\$.ajax({
type: \"POST\",
url: '";
// line 43
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("apply-promo-ajax");
yield "',
data: \$(this).serialize(),
success: function (data) {
if (data.success) {
//alertPopup('Промокод успешно активирован');
/*
\$('#promoButton').hide();
\$('#promoAlert').show();
\$('#clearPromo').show();
promo.attr('disabled', 'disabled');
*/
location.reload();
} else {
alertPopup('Неверный промокод');
}
}
}).fail(function() {
alertPopup('Ошибка');
});
return false;
});
\$('.addRelatedProduct').click(function () {
let id = \$(this).attr('data-id');
\$.ajax({
type: \"POST\",
url: '";
// line 71
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-put-ajax");
yield "',
data: {
id: id,
count: 1
},
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
})
});
\$('.cart-quantity').change(function () {
let id = \$(this).attr('data-id');
let count = \$(this).val();
\$.ajax({
type: \"POST\",
url: '";
// line 92
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-put-ajax");
yield "',
data: {
id: id,
count: count
},
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
})
});
\$('.cart-delete').click(function () {
let button = \$(this);
let id = button.attr('data-id');
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '";
// line 114
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-delete-ajax");
yield "',
data: {
id: id
},
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
\$('#draftSave').click(function () {
let button = \$(this);
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '";
// line 138
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("draft-save-ajax");
yield "',
success: function (data) {
alertPopup('Черновик сохранен');
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
\$('#clearCart').click(function () {
let button = \$(this);
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '";
// line 156
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-clear-ajax");
yield "',
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
\$('#cartLoadRetail').click(function () {
let button = \$(this);
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '";
// line 177
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-load-retail-ajax");
yield "',
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
}
initCartItems();
";
// line 196
if (CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 196, $this->source); })()), "request", [], "any", false, false, false, 196), "query", [], "any", false, false, false, 196), "get", ["changed"], "method", false, false, false, 196)) {
// line 197
yield " alertPopup('Состав корзины был актуализирован в соответствии с доступными остатками');
";
}
// line 199
yield " ";
if (CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 199, $this->source); })()), "request", [], "any", false, false, false, 199), "query", [], "any", false, false, false, 199), "get", ["notInStock"], "method", false, false, false, 199)) {
// line 200
yield " alertPopup('На складе нет нужного количества товаров');
";
}
// line 202
yield " ";
if (CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 202, $this->source); })()), "request", [], "any", false, false, false, 202), "query", [], "any", false, false, false, 202), "get", ["notValid"], "method", false, false, false, 202)) {
// line 203
yield " alertPopup('Для приема заказа недостаточно информации. Просим Вас обратиться к Вашему менеджеру');
";
}
// line 205
yield "</script>
";
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
return; yield '';
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName()
{
return "application/cart/index.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable()
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo()
{
return array ( 332 => 205, 328 => 203, 325 => 202, 321 => 200, 318 => 199, 314 => 197, 312 => 196, 290 => 177, 266 => 156, 245 => 138, 218 => 114, 193 => 92, 169 => 71, 138 => 43, 121 => 29, 112 => 22, 102 => 21, 86 => 15, 76 => 8, 70 => 4, 60 => 3, 37 => 1,);
}
public function getSourceContext()
{
return new Source("{% extends 'application/layout.html.twig' %}
{% block content %}
<main class=\"main\">
<div class=\"breadcrumb\">
<div class=\"container\">
<ol class=\"breadcrumb__list\">
<li class=\"breadcrumb__item\"><a href=\"{{ path('home') }}\" class=\"breadcrumb__link\">Главная</a></li>
<li class=\"breadcrumb__item active\" aria-current=\"page\">Корзина</li>
</ol>
</div>
</div>
<div id=\"cartItems\">
{{ include('application/cart/items.html.twig') }}
</div>
</main>
{% endblock %}
{% block scripts %}
<script>
function initCartItems() {
\$('#clearPromo').click(function () {
\$(this).hide();
\$.ajax({
type: \"POST\",
url: '{{ path('clear-promo-ajax') }}',
success: function (data) {
location.reload();
}
}).fail(function() {
alertPopup('Ошибка');
});
return false;
});
\$('#promoForm').submit(function () {
\$.ajax({
type: \"POST\",
url: '{{ path('apply-promo-ajax') }}',
data: \$(this).serialize(),
success: function (data) {
if (data.success) {
//alertPopup('Промокод успешно активирован');
/*
\$('#promoButton').hide();
\$('#promoAlert').show();
\$('#clearPromo').show();
promo.attr('disabled', 'disabled');
*/
location.reload();
} else {
alertPopup('Неверный промокод');
}
}
}).fail(function() {
alertPopup('Ошибка');
});
return false;
});
\$('.addRelatedProduct').click(function () {
let id = \$(this).attr('data-id');
\$.ajax({
type: \"POST\",
url: '{{ path('cart-put-ajax') }}',
data: {
id: id,
count: 1
},
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
})
});
\$('.cart-quantity').change(function () {
let id = \$(this).attr('data-id');
let count = \$(this).val();
\$.ajax({
type: \"POST\",
url: '{{ path('cart-put-ajax') }}',
data: {
id: id,
count: count
},
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
})
});
\$('.cart-delete').click(function () {
let button = \$(this);
let id = button.attr('data-id');
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '{{ path('cart-delete-ajax') }}',
data: {
id: id
},
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
\$('#draftSave').click(function () {
let button = \$(this);
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '{{ path('draft-save-ajax') }}',
success: function (data) {
alertPopup('Черновик сохранен');
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
\$('#clearCart').click(function () {
let button = \$(this);
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '{{ path('cart-clear-ajax') }}',
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
\$('#cartLoadRetail').click(function () {
let button = \$(this);
button.attr('disabled', 'disabled');
\$.ajax({
type: \"POST\",
url: '{{ path('cart-load-retail-ajax') }}',
success: function (data) {
\$('#cartDiv').html(data.cartHtml);
\$('#cartItems').html(data.itemsHtml);
initCartItems();
prepareProductBlockCount(\$('#cartItems'));
}
}).fail(function() {
alertPopup('Ошибка');
}).always(function() {
button.removeAttr('disabled');
});
return false;
});
}
initCartItems();
{% if app.request.query.get('changed') %}
alertPopup('Состав корзины был актуализирован в соответствии с доступными остатками');
{% endif %}
{% if app.request.query.get('notInStock') %}
alertPopup('На складе нет нужного количества товаров');
{% endif %}
{% if app.request.query.get('notValid') %}
alertPopup('Для приема заказа недостаточно информации. Просим Вас обратиться к Вашему менеджеру');
{% endif %}
</script>
{% endblock %}", "application/cart/index.html.twig", "/var/www/html/templates/application/cart/index.html.twig");
}
}