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);
});