diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js index b90bcee3..7f4e6f5e 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js @@ -74,6 +74,8 @@ class DatosGenerales { this.rl_retractilado = $("#rl_retractilado"); this.rl_retractilado5 = $("#rl_retractilado5"); + this.cargando = false; + this.initValidation(); } @@ -534,6 +536,8 @@ class DatosGenerales { cargarDatos(datos) { + this.cargando = true; + this.titulo.val(datos.titulo); this.autor.val(datos.autor); this.isbn.val(datos.isbn); @@ -600,6 +604,8 @@ class DatosGenerales { this.retractilado5.prop('checked', datos.retractilado5); this.ivaReducido.val(datos.ivaReducido ? 1 : 0).trigger('change'); + + this.cargando = false; } getCliente() { @@ -736,8 +742,6 @@ class DatosGenerales { this.checkPaginasMultiplo4(); // Para recalcular el presupuesto - $('#divGramajeInterior').empty(); - $('#divGramajeInteriorColor').empty(); element.trigger('change'); } @@ -782,6 +786,7 @@ class DatosGenerales { this.formValidation.revalidateField('paginas'); // Se configura dependiento si hay color o no + const lastLayoutColor = $('#negroEstandar').hasClass('d-none'); if (paginasColor == 0) { this.#handleInteriorLayout('negro'); @@ -789,6 +794,13 @@ class DatosGenerales { this.divPosPaginasColor.addClass('d-none'); this.posPaginasColor.val(""); this.pagColorConsecutivas.prop('checked', false); + + if(lastLayoutColor && !this.cargando){ + + $('#divPapelInterior').empty(); + $('#divGramajeInterior').empty(); + $('#negroEstandar').trigger('click'); + } } else { if (this.papelDiferente.is(":checked")) @@ -797,6 +809,13 @@ class DatosGenerales { this.#handleInteriorLayout('color'); this.divPaginasColorConsecutivas.removeClass('d-none'); this.divPosPaginasColor.removeClass('d-none'); + + if(!lastLayoutColor && !this.cargando){ + + $('#divPapelInterior').empty(); + $('#divGramajeInterior').empty(); + $('#colorEstandar').trigger('click'); + } } $('.calcular-lomo').trigger('change');