{% extends 'website/main.template.html.twig' %}
{% from 'utils.html.twig' import ico, imgUpload %}
{% block metaIndex %}
<meta name="robots" content="nofollow">
{% endblock %}
{# CART COMPLETE REGISTRATION #}
{% set cartCompleteRegistration = (getConfig('cart_complete_registration') == enum('CartEnum::YES')) %}
{% block headScripts %}
{% if activeMetrics == enum('ClientEnum::YES') %}
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:3636984,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
{% endif %}
{% endblock %}
{% block bodyTag %}
<body id="body" class="cart-body" data-theme="{{ isDarkTheme? 'dark':'light' }}" data-has-items="{{ (carts is empty)? 0:1 }}">
{% endblock %}
{% block menu_topo %}
{% include 'website/cart/cart-top.html.twig' with { title: getLanguage('finalize', 'cart') }%}
{% endblock %}
{% block body %}
<div class="container">
{# COM ITENS #}
<div class="cart-filled">
{# HAS CONTRACTS #}
{% set hasContracts = [] %}
{% for item in carts %}
{% set hasContracts = hasContracts|merge([
(item.product.contract is not empty) and (item.product.contract != 'null')
])%}
{% endfor %}
{% set hasContracts = hasContracts|merge([
(getConfig('contract') is not empty) and (getConfig('contract') != 'null')
])%}
{% set hasContracts = true in hasContracts %}
{# STEPS #}
{% include 'website/cart/cart-steps.html.twig' %}
{# ITEMS LIST #}
{% include 'website/cart/cart-section-list.html.twig' %}
{# LOGIN #}
{% if not user %}
{% include 'website/cart/cart-section-login.html.twig' %}
{# LOGADO #}
{% else %}
{# USER INFO #}
{% include 'website/cart/cart-section-user-info.html.twig' %}
{# CONTRACT #}
{% if hasContracts %}
{% include 'website/cart/cart-section-contract.html.twig' %}
{% endif %}
{# CHECKOUT INFO #}
{% include 'website/cart/cart-section-user-checkout-info.html.twig' %}
{# CART PAYMENT #}
<div id="cart-payment--content" class="step-container">
{# CART CUSTOM #}
{% if customCart %}
{% include 'website/cart/cart-section-custom-select-method.html.twig' %}
{# CART DEFAULT #}
{% else %}
{% include 'website/cart/cart-section-payment-default.html.twig' %}
{% endif %}
</div>
{# CART CUSTOM #}
{% if customCart %}
<div id="cart-payment-custom--content" class="step-container">
{% include 'website/cart/cart-section-payment-custom.html.twig' %}
</div>
{% endif %}
{% endif %}
{# Conclusion… #}
</div>
{# VAZIO #}
<div class="cart-empty">
<div class="info">
<h3>{{ getLanguage('shopping_cart_empty', 'cart') }}</h3>
<p>{{ getLanguage('choose_the_courses', 'cart') }}</p>
<div class="actions">
{% if hasProducts %}
<a href="{{ path('productListCourses', { type: "courses" }) }}" class="btn-continuar-peq">
{{ getLanguage('choose_courses', 'cart') }}
</a>
{% endif %}
{% if user %}
<a class="open-coupom" data-coupom-open="#empty-coupom-form">
{{ getLanguage('have_a_coupon', 'cart') }}
</a>
{% endif %}
</div>
{# COUPOM #}
{% if user %}
<div class="coupom-form" data-active="off">
<form id="empty-coupom-form" class="js--coupom-form" action="{{ path('applyCartCoupon') }}" method="post" novalidate>
<div class="wrap">
<input name="couponKey" placeholder="{{ getLanguage('coupon_code', 'cart') }}" required>
<div class="ico">{{ ico('check') }} {{ ico('x') }}</div>
</div>
<button type="submit" class="btn-continuar-gde btn-load">
<span>{{ getLanguage('apply_coupon', 'cart') }}</span>
<span>
{{ getLanguage('wait', 'util') }} … 
<i class="loader">{{ ico('loader-wish') }}</i>
</span>
</button>
</form>
</div>
{% endif %}
</div>
<div class="img">{{ ico('cart-empty') }}</div>
</div>
</div>{# -/.container #}
{# MODAL -- REDEFINIR SENHA #}
{% embed "website/includes/modal.html.twig" with {'id': 'modal-recover-password', 'title': 'Redefinir senha'} %}
{% block content %}
{% from 'utils.html.twig' import ico %}
<form id="formRecoverPasswordCart" action="{{ path('sendEmailRecoverPassword') }}" class="form-geral">
<div class="cp">
<label for="email">E-mail</label>
<input type="email" name="email" placeholder="{{ getLanguage('enter_an_email', 'login') }}" required="required" autofocus="autofocus">
</div>
<nav class="actions">
<button type="button" class="js--modal-fecha cancel">{{ getLanguage('cancel', 'cart') }}</button>
<button type="submit" id="btnRecoverPasswordCart" class="btn-continuar-peq btn-load">
<span>{{ getLanguage('send', 'login') }}</span>
<span>{{ getLanguage('wait', 'util') }} … <i class="loader">{{ ico('loader-wish') }}</i></span>
</button>
</nav>
</form>
{% endblock %}
{% endembed %}
{# MODAL -- COUPONS LIST #}
{% embed "website/includes/modal.html.twig" with { 'id': 'coupons-modal', 'title': getLanguage('avaliable_coupons', 'product')} %}
{% block content %}
{% from 'utils.html.twig' import ico %}
<div class="modal-coupons-content">
<div class="modal-loading">
<i class="modal-loader">{{ ico('loader-wish') }}</i> {{ getLanguage('wait', 'util') }}…
</div>
</div>
{% endblock %}
{% endembed %}
{# MODAL -- COUPONS CHARGE LIST #}
{% embed "website/includes/modal.html.twig" with { 'id': 'coupons-charge-modal', 'title': getLanguage('coupons_applied_charge', 'product')} %}
{% block content %}
{% from 'utils.html.twig' import ico %}
<div class="modal-coupons-charge-content">
<div class="modal-loading">
<i class="modal-loader">{{ ico('loader-wish') }}</i> {{ getLanguage('wait', 'util') }}…
</div>
</div>
{% endblock %}
{% endembed %}
{# MODAL -- COUPON RULES #}
{% include "website/includes/modal-coupon-rules.html.twig" %}
{# MODAL -- USER INFO CHECKOUT #}
{% if user %}
{% include 'website/user/userInfoCheckout/user-info-checkout-modal.html.twig' %}
{% endif %}
{% endblock %}
{# INFO ITEMS CART #}
{% block javascripts_page %}
{# --- PRODUCTS INFO --- #}
{% set cartItems = [] %}
{% for item in carts %}
{% set cartItems = cartItems|merge([{
id: item.id,
priceCoupom: item.price|round(2),
priceReal: item.productOffer.priceReal|round(2),
priceDisplay: item.productOffer.priceDisplay|round(2),
}])%}
{% endfor %}
{% set cartInfo = {
cartSubtotalDiff: cartSubtotalDiff|round(2),
cartSubtotal: cartSubtotal|round(2),
cartDisplaySubtotal: cartDisplaySubtotal|round(2),
items: cartItems,
}%}
<textarea id="items-info" readonly disabled>{{ cartInfo|json_encode }}</textarea>
{% endblock %}
{% block javascripts %}
{% include 'website/includes/scripts.html.twig' %}
{% include 'website/includes/websocket.html.twig' %}
{# <script src="{{ cdnFontawesome }}" crossorigin="anonymous"></script> #}
{{ encore_entry_script_tags('app') }}
{# CONFIG -- SCRIPTS #}
{% block config_scripts %}{% endblock %}
{% include 'website/includes/ead-rights-section.html.twig' %}
{% include 'website/includes/sc-activate.html.twig' %}
{% endblock %}