{% extends 'base.webhosting.html.twig' %}
{% block title %}{{ 'cart'|trans }} {{ 'lang.webhosting'|trans }}{% endblock %}
{% block body %}
<div id="output_delete_domain"></div>
<div id="output_delete_webhosting"></div>
<div class="container">
<div class="row justify-content-center">
<div class="col-8">
<h2 class="py-2"><i
class="fa-solid fa-cart-shopping"></i> {{ 'cart'|trans }} {{ 'lang.webhosting'|trans }}</h2>
<div class="card p-4 rounded-5">
{% if cart_product_webhosting.productWebhosting.id is defined and cart_domains_webhosting %}
{% set total_domain = 0 %}
{% for domain in cart_domains_webhosting %}
{% set total_domain = total_domain + domain['price'] %}
{% endfor %}
{% include 'cart_webhosting/_partials/domain.html.twig' %}
{% set product_price = cart_product_webhosting.productWebhosting.packagePrice %}
{% include 'cart_webhosting/_partials/product.html.twig' %}
{% else %}
{{ 'txtNoWebhosting'|trans }}
{% endif %}
{% if cart_product_webhosting.productWebhosting.id is defined and cart_domains_webhosting %}
{% set total = total_domain + product_price %}
<div class="row size-16">
<hr>
<div class="col-md-6 mb-2">
<span class="text-danger">{{ advice|default('') }}</span><br>
{{ btn_webhosting|default('') }}
</div>
{% set vatPrice = vat_value * total %}
{% set totalPriceGross = vat_value * total + total %}
<div class="col-md-6 mb-2">
<div class="row">
<div class="col">
<span class="float-end">
{{ total|number_format(2,",",".") }} € / {{ 'perMonth'|trans }}
</span>
</div>
</div>
<div class="row">
<div class="col">
<span class="float-end">
{{ 'totalVat'|trans }} {{ vat_value * 100 }}%: {{ vatPrice|number_format(2,",",".") }} €
</span>
</div>
</div>
<div class="row">
<div class="col">
<span class="float-end">
{{ 'totalPriceGross'|trans }}:
<strong>{{ totalPriceGross|number_format(2,",",".") }} €</strong>
</span>
</div>
</div>
</div>
</div>
{% if app.user %}
<div class="row">
<div class="col mb-2">
<a href="{{ path('app_client_payment_new', {'webhosting': 1}) }}"
class="btn btn-success w-100">{{ 'goToPayment'|trans }}</a>
</div>
</div>
{% else %}
<div class="row">
<div class="col mb-2">
<a href="{{ path('app_register', {'webhosting': 1}) }}"
class="btn btn-success w-100">{{ 'forwartToRegisterClient'|trans }}</a>
</div>
</div>
<div class="row">
<div class="col mb-2">
<h6 class="text-center">{{ 'txtOr'|trans }}</h6>
</div>
</div>
<div class="row">
<div class="col mb-2">
<a href="{{ path('app_login', {'webhosting': 1}) }}"
class="btn btn-success w-100">{{ 'forwartToLogin'|trans }}</a>
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
<script>
function removeDomain(id) {
$('#output_delete_domain').load('{{ path('app_cart_webhosting_remove_domain') }}?id=' + id, function () {
window.location.reload();
})
}
function removeWebhosting(id) {
$('#output_delete_webhosting').load('{{ path('app_cart_webhosting_remove_webhosting') }}', function () {
window.location.reload();
})
}
</script>
{% endblock %}