solucionado el problema

This commit is contained in:
2025-02-06 11:16:12 +01:00
parent b096d0469d
commit 82537d9806
2 changed files with 25 additions and 18 deletions

View File

@ -33,14 +33,14 @@ class PresupuestoAdminEdit {
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip'),
()=>{return this.cargandoPresupuesto},
() => { return this.cargandoPresupuesto },
{
checkPaginasPresupuesto: this.checkPaginasPresupuesto,
getDimensionLibro: this.getDimensionLibro,
calcularSolapas: this.calcularSolapas.bind(this),
});
this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'),
() => {return this.cargandoPresupuesto},
() => { return this.cargandoPresupuesto },
{
getDimensionLibro: this.getDimensionLibro,
});
@ -60,7 +60,7 @@ class PresupuestoAdminEdit {
this.guardar = $('#saveForm');
this.calcularPresupuesto = false;
this.configUploadDropzone = {
domElement: '#dropzone-presupuesto-admin-files',
nameId: "presupuesto_id",
@ -209,7 +209,7 @@ class PresupuestoAdminEdit {
}
if (this.datosLibro.tamanioPersonalizado.prop('checked')) {
datos.papel_formato_ancho = this.datosLibro.anchoPersonalizado.val(),
datos.papel_formato_alto = this.datosLibro.altoPersonalizado.val()
datos.papel_formato_alto = this.datosLibro.altoPersonalizado.val()
}
datos.selectedTirada = this.datosLibro.tirada.val();
datos.acabado_cubierta_id = this.datosLibro.acabadoCubierta.getVal();
@ -247,7 +247,7 @@ class PresupuestoAdminEdit {
datos.solapas_sobrecubierta = this.datosLibro.solapasSobrecubierta.is(':checked') ? 1 : 0;
datos.solapas_ancho_sobrecubierta = this.datosLibro.anchoSolapasSobrecubierta.val();
datos.faja_color = this.datosLibro.faja.prop('checked') ? 1: 0;
datos.faja_color = this.datosLibro.faja.prop('checked') ? 1 : 0;
datos.solapas_ancho_faja_color = this.datosLibro.fajaSolapasAncho.val();
datos.alto_faja_color = this.datosLibro.fajaAlto.val();
@ -301,7 +301,7 @@ class PresupuestoAdminEdit {
if (self.cargandoPresupuesto == false) {
self.comparador.updateComparador();
// Ejecutar los pasos de forma secuencial si están habilitados
if (update_lineas) {
$(document).trigger('update-lineas-presupuesto');
@ -335,6 +335,8 @@ class PresupuestoAdminEdit {
const self = this;
this.cargandoPresupuesto = true;
self.comparador.cargando = true;
self.datosLibro.cargando = true;
$('#loader').modal('show');
let id = window.location.href.split("/").pop()
@ -352,11 +354,10 @@ class PresupuestoAdminEdit {
self.POD.val(response.data.POD);
self.calcularPresupuesto = false;
self.comparador.cargando = true;
self.datosGenerales.cargarDatos(response.data.datosGenerales);
self.datosLibro.cargarDatos(response.data.datosLibro);
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
self.servicios.cargar(response.data.servicios);
@ -381,6 +382,10 @@ class PresupuestoAdminEdit {
self.calcularPresupuesto = true;
self.cargandoPresupuesto = false;
self.datosLibro.cargando = false;
self.comparador.cargando = false;
self.comparador.updateComparador();
}
@ -405,6 +410,8 @@ class PresupuestoAdminEdit {
$('#loader').modal('hide');
this.calcularPresupuesto = true;
self.cargandoPresupuesto = false;
self.datosLibro.cargando = false;
self.comparador.cargando = false;
}
).get();
}

View File

@ -1089,7 +1089,7 @@ class Comparador {
for (let element of papeles) {
if (element.getVal() == 0 || element.getVal() == null) {
const tipo = element.item.attr('id').split('Papel')[1];
if ($('#compPaginas' + tipo).val() > 0) {
if ($('#compPaginas' + tipo).val() > 0 && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
return { error: true, data: {} };
}
@ -1099,7 +1099,7 @@ class Comparador {
if (element.getVal() == 0 || element.getVal() == null) {
const tipo = element.item.attr('id').split('Gramaje')[1];
if ($('#compPaginas' + tipo).val() > 0) {
if ($('#compPaginas' + tipo).val() > 0 && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
return { error: true, data: {} };
}
@ -1131,11 +1131,11 @@ class Comparador {
}
else if (uso == 'cubierta') {
if (this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) {
if ((this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
return { error: true, data: {} };
}
if (this.gramajeCubierta.getVal() == 0 || this.gramajeCubierta.getVal() == null) {
if ((this.gramajeCubierta.getVal() == 0 || this.gramajeCubierta.getVal() == null) && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
return { error: true, data: {} };
}
@ -1147,11 +1147,11 @@ class Comparador {
}
else if (uso == 'sobrecubierta') {
if (this.papelSobrecubierta.getVal() == 0 || this.papelSobrecubierta.getVal() == null) {
if ((this.papelSobrecubierta.getVal() == 0 || this.papelSobrecubierta.getVal() == null) && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
return { error: true, data: {} };
}
if (this.gramajeSobrecubierta.getVal() == 0 || this.gramajeSobrecubierta.getVal() == null) {
if ((this.gramajeSobrecubierta.getVal() == 0 || this.gramajeSobrecubierta.getVal() == null) && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
return { error: true, data: {} };
}
@ -1163,11 +1163,11 @@ class Comparador {
}
else if (uso == 'faja') {
if (this.papelFaja.getVal() == 0 || this.papelFaja.getVal() == null) {
if ((this.papelFaja.getVal() == 0 || this.papelFaja.getVal() == null) && this.faja.getVal()>0 && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
return { error: true, data: {} };
}
if (this.gramajeFaja.getVal() == 0 || this.gramajeFaja.getVal() == null) {
if ((this.gramajeFaja.getVal() == 0 || this.gramajeFaja.getVal() == null) && this.faja.getVal()>0 && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
return { error: true, data: {} };
}
@ -1180,11 +1180,11 @@ class Comparador {
}
else if (uso == 'guardas') {
if (this.papelGuardas.getVal() == 0 || this.papelGuardas.getVal() == null) {
if ((this.papelGuardas.getVal() == 0 || this.papelGuardas.getVal() == null) && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
return { error: true, data: {} };
}
if (this.gramajeGuardas.getVal() == 0 || this.gramajeGuardas.getVal() == null) {
if ((this.gramajeGuardas.getVal() == 0 || this.gramajeGuardas.getVal() == null) && !this.cargando) {
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
return { error: true, data: {} };
}