{% extends '/uniqskills/cartcms.html.twig' %}
{% block title %}{{ 'uniqskills.metaTitle.cart'|trans }}{% endblock %}
{% block customcss %}
{# {{ parent() }}#}
<link href="https://www.literka.pl/css/styles_literka-2-0.css?v=189&version=548" rel="stylesheet">
<link rel="stylesheet" href="https://geowidget.inpost.pl/inpost-geowidget.css"/>
{{ encore_entry_link_tags('cartcms-css') }}
{% endblock %}
{% block content %}
<div class="container container-cart-2">
<div id="cart-content" style="min-height: 400px" data-locale="{{ app.request.locale() }}">
{% include 'uniqskills/cartcms/_partials/_spinner.html.twig' %}
</div>
</div>
{% if app.session.flashbag.peekAll|length > 0 %}
<div id="swal_messages">
{% for type, messages in app.session.flashbag.all %}
{% for message in messages %}
<div data-role="sweetAlertContent" data-alerttype="{{ type }}" data-msg="{{ message }}"></div>
{% endfor %}
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% block customjs %}
{{ parent() }}
<script>
$(document).ready(function () {
// activeSpinner('show');
let searchParams = new URLSearchParams(window.location.search);
if (searchParams.has('prod') || searchParams.has('pack'))
{
$.ajax({
type: 'POST',
url: 'cart/add-product',
data: {
productVariantNoComplete: searchParams.get('prod'),
productPackId: searchParams.get('pack'),
couponCode: searchParams.get('coupon')
},
async:false,
success: function(data) {
if (data.success === 'ok')
{
sessionStorage.setItem('backToShoppingUrl', window.location.pathname);
if (typeof gtag === 'function' && data.gaEvent)
{
gtag.apply(this, data.gaEvent);
}
}
}
});
window.history.replaceState(null, '', window.location.pathname);
}
$.ajax({
url: 'cart/render-index-data',
success: function (data) {
$('#cart-content').html(data.cart);
if (typeof gtag === 'function' && data.gaEvent)
{
gtag.apply(this, data.gaEvent);
}
// activeSpinner('hide');
},
}).done(function () {
var swal_div_messages = $('div#swal_messages');
if (swal_div_messages.length > 0 && swal_div_messages.is(':empty') === false) {
showSweetAlert();
}
})
});
</script>
{% endblock %}