arreglado problema con las guardas y solicitudes comparador

This commit is contained in:
2025-02-06 19:36:48 +01:00
parent 6cc9045eb4
commit 09683d9be5
2 changed files with 36 additions and 10 deletions

View File

@ -270,6 +270,9 @@ class Comparador {
this.btnInsertarFaja = $('#insertarFajaBtn');
this.comparadorPlanaRunning = false;
this.comparadorExterioresRunning = false;
this.comparadorGuardasRunning = false;
this.comparadorFajaRunning = false;
}
init() {
@ -541,7 +544,7 @@ class Comparador {
this.gramajeSobrecubierta.setOption(datos.json_data.sobrecubierta.gramaje, datos.json_data.sobrecubierta.gramaje);
}
if (datos.json_data.guardas) {
this.carasGuardas.val(datos.json_data.guardas.paginas).trigger('change');
this.carasGuardas.val(datos.json_data.guardas.paginas_impresion).trigger('change');
this.papelGuardas.setOption(datos.json_data.guardas.papel_id, datos.json_data.guardas.papel_nombre);
this.gramajeGuardas.setOption(datos.json_data.guardas.gramaje, datos.json_data.guardas.gramaje);
}
@ -1180,6 +1183,7 @@ class Comparador {
}
else if (uso == 'guardas') {
if ((this.papelGuardas.getVal() == 0 || this.papelGuardas.getVal() == null) && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
return { error: true, data: {} };
@ -1426,7 +1430,7 @@ class Comparador {
const self = this;
if (this.cargando) {
if (this.cargando && this.comparadorExterioresRunning) {
return
}
@ -1457,6 +1461,7 @@ class Comparador {
if (Object.keys(datosComp.sobrecubierta).length > 0) {
datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash;
}
this.comparadorExterioresRunning = true;
new Ajax('/presupuestoadmin/comparadorexteriores',
{
cubierta: datosComp.cubierta.data,
@ -1499,14 +1504,17 @@ class Comparador {
$('#title_cubierta').html(window.language.Presupuestos.compCubiertaSobrecubierta);
self.btnInsertarCubierta.addClass('d-none');
}
self.comparadorExterioresRunning = false;
},
(error) => {
console.log(error);
self.comparadorExterioresRunning = false;
}
).post();
} catch (e) {
console.log(e)
console.log(e);
self.comparadorExterioresRunning = false;
}
}
@ -1517,7 +1525,7 @@ class Comparador {
const self = this;
if (this.cargando) {
if (this.cargando && this.comparadorFajaRunning) {
return
}
@ -1533,7 +1541,7 @@ class Comparador {
datosComp.sobrecubierta.data['faja'] = 1; // se indica que es faja para el calculo de formas
datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash;
this.comparadorFajaRunning = true;
new Ajax('/presupuestoadmin/comparadorexteriores',
{
sobrecubierta: datosComp.sobrecubierta.data
@ -1563,15 +1571,18 @@ class Comparador {
$('#title_faja').html(window.language.Presupuestos.faja);
self.btnInsertarFaja.addClass('d-none');
}
self.comparadorFajaRunning = false;
},
(error) => {
console.log(error);
self.comparadorFajaRunning = false;
}
).post();
} catch (e) {
console.log(e)
console.log(e);
self.comparadorFajaRunning = false;
}
}
@ -1581,7 +1592,7 @@ class Comparador {
const self = this;
if (this.cargando) {
if (this.cargando && this.comparadorGuardasRunning) {
return
}
@ -1596,7 +1607,7 @@ class Comparador {
}
datosComp.data[this.csrf_token] = this.csrf_hash;
this.comparadorGuardasRunning = true;
new Ajax('/presupuestoadmin/comparadorguardas',
datosComp.data,
{},
@ -1624,14 +1635,17 @@ class Comparador {
$('#title_guardas').html(window.language.Presupuestos.Guardas);
self.btnInsertarGuardas.addClass('d-none');
}
self.comparadorGuardasRunning = false;
},
(error) => {
console.log(error);
self.comparadorGuardasRunning = false;
}
).post();
} catch (e) {
console.log(e)
console.log(e);
self.comparadorGuardasRunning = false;
}
}