From 8ad09ed49533ad3d8df03b23ee317937638e2376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Thu, 26 Dec 2024 20:44:30 +0100 Subject: [PATCH] no borrar papeles cuando se cambia tipo libro --- .../presupuestoCliente/datosGenerales.js | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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');