cargando carrito desde backend

This commit is contained in:
2025-10-29 23:30:33 +01:00
parent ae2904aa71
commit feff9ee94a
23 changed files with 848 additions and 183 deletions

View File

@ -10,26 +10,28 @@
<div th:if="${items.isEmpty()}">
<div class="alert alert-info" role="alert" th:text="#{cart.empty}"></div>
</div>
<div th:if="${errorMessage}" class="alert alert-danger " role="alert" th:text="${errorMessage}"></div>
<div class="alert alert-danger alert-shipment d-none" role="alert"
th:text="#{cart.shipping.errors.fillAddressesItems}"></div>
<form id="cartForm" th:action="${'/cart/update/' + cartId}" method="POST" class="col-xl-8 col-12">
<form id="cartForm" th:action="${'/cart/update/' + cart.id}" method="POST" class="col-xl-8 col-12">
<input type="hidden" name="id" th:value="${cartId}" />
<input type="hidden" name="id" th:value="${cart.id}" />
<div class="card">
<div class="card-body">
<p th:text="#{cart.shipping.info}"></p>
<div
class="form-check form-switch form-switch-custom form-switch-presupuesto mb-3 d-flex align-items-center">
<input type="checkbox" class="form-check-input datos-generales-data me-2" id="onlyOneShipment"
name="only_one_shipment" checked />
th:field="${cart.onlyOneShipment}"/>
<label for="onlyOneShipment" class="form-label d-flex align-items-center mb-0">
<span th:text="#{cart.shipping.onlyOneShipment}" class="me-2"></span>
</label>
</div>
<button type="button" class="btn btn-secondary" id="addOrderAddress"
<button type="button" th:class="${'btn btn-secondary' + (!cart.onlyOneShipment or mainDir?.size > 0 ? ' d-none' : '')}" id="addOrderAddress"
th:text="#{cart.shipping.add}">Añadir dirección</button>
<div id="shippingAddressesContainer" class="shipping-order-address d-flex flex-wrap gap-3 mt-4"></div>

View File

@ -8,7 +8,7 @@
<input type="hidden" class="item-tirada" th:value="${item.tirada}" />
<div class="step-arrow-nav mt-n3 mx-n3 mb-3">
<ul class="nav nav-pills nav-justified custom-nav nav-product" style="display: none;" role="tablist">
<ul th:class="${'nav nav-pills nav-justified custom-nav nav-product' + (cart.onlyOneShipment ? ' d-none' : '')}" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link fs-15 active" th:id="${'pills-details-' + item.cartItemId + '-tab'}"
th:data-bs-target="${'#pills-details-' + item.cartItemId}" type="button" role="tab"

View File

@ -7,6 +7,7 @@
<input type="hidden" class="direccion-cp" th:value="${direccion.cp}" />
<input type="hidden" class="direccion-pais-code3" th:value="${direccion.pais.code3}" />
<input type="hidden" class="item-tirada" th:value="${unidades != null ? unidades : ''}" />
<input type="hidden" class="is-palets" th:value="${isPalets != null ? isPalets : ''}" />
<div class="row g-3 align-items-start flex-nowrap">
<div class="col">
@ -17,17 +18,24 @@
<span class="text-muted fw-normal d-block text-break"
th:text="#{'direcciones.telefono'} + ': ' + ${direccion.telefono}"></span>
</div>
<div th:if="${unidades != null}" class="col-auto ms-auto text-end">
<span id="units-text" class="mb-2 fw-semibold d-block text-muted text-uppercase" th:if="${unidades == 1}"
th:text="|${unidades} #{cart.shipping.ud}|"></span>
<div class="col-auto ms-auto text-end">
<div th:if="${unidades != null}">
<span id="units-text" class="mb-2 fw-semibold d-block text-muted text-uppercase" th:if="${unidades == 1}"
th:text="|${unidades} #{cart.shipping.ud}|"></span>
<!-- plural -->
<span id="units-text" class="mb-2 fw-semibold d-block text-muted text-uppercase" th:unless="${unidades == 1}"
th:text="|${unidades} #{cart.shipping.uds}|"></span>
<!-- plural -->
<span id="units-text" class="mb-2 fw-semibold d-block text-muted text-uppercase" th:unless="${unidades == 1}"
th:text="|${unidades} #{cart.shipping.uds}|"></span>
</div>
<div th:if="${isPalets != null and isPalets==1}">
<i class="icon-shipment las la-pallet la-3x text-muted"></i>
</div>
<div th:if="${isPalets == null or isPalets == 0}">
<i class="icon-shipment las la-box la-3x text-muted"></i>
</div>
</div>
</div>
<div
class="d-flex flex-wrap align-items-center gap-2 py-1 bg-light rounded-bottom border-top mt-auto actions-row">
<div class="d-flex flex-wrap align-items-center gap-2 py-1 bg-light rounded-bottom border-top mt-auto actions-row">
<a href="javascript:void(0)" class="d-block text-body p-1 px-2 btn-delete-direccion"
data-id="${this._esc(d.id ?? '')}">
<i class="ri-delete-bin-fill text-muted align-bottom me-1"></i>

View File

@ -0,0 +1,7 @@
<form id="tpv" th:action="${action}" method="POST">
<input type="hidden" name="Ds_SignatureVersion" th:value="${signatureVersion}" />
<input type="hidden" name="Ds_MerchantParameters" th:value="${merchantParameters}" />
<input type="hidden" name="Ds_Signature" th:value="${signature}" />
<noscript><button type="submit">Pagar</button></noscript>
</form>
<script>document.getElementById('tpv').submit();</script>