falta precio completo del item del carrito y devolver que ya existe el presupuesto en el carro

This commit is contained in:
2025-10-15 20:05:56 +02:00
parent f20dd9068a
commit f26f96a490
4 changed files with 28 additions and 10 deletions

View File

@ -274,13 +274,16 @@ export default class PresupuestoWizard {
$('.add-cart-btn').on('click', async () => {
const success = await this.#guardarPresupuesto();
if (success) {
await $.ajax({
const res = await $.ajax({
url: `/cart/add/${this.opts.presupuestoId}`,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
headers: { 'Content-Type': 'application/json' }
});
// Si el backend devuelve { redirect: "/cart" }
if (res?.redirect) {
window.location.assign(res.redirect); // o replace()
}
}
});
}
@ -843,7 +846,7 @@ export default class PresupuestoWizard {
const errors = xhr.responseJSON;
if (errors && typeof errors === 'object') {
this.interior_alert.find('#form-errors-alert-list').append(`<li>${errors.message}</li>`);
}
console.error("Error al obtener los gramajes de interior: ", xhr.responseText);
});

View File

@ -53,14 +53,15 @@
<form th:action="@{|/cart/${item.cartItemId}/remove|}" method="post" class="d-inline">
<input type="hidden" name="_method" value="delete" />
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
<button type="submit" class="btn btn-sm btn-link text-body p-1 px-2">
<a href="#" class="d-block text-body p-1 px-2"
onclick="this.closest('form').submit(); return false;">
<i class="ri-delete-bin-fill text-muted align-bottom me-1"></i> Eliminar
</button>
</a>
</form>
</div>
</div>
</div>
</div>
</div>
</div>