From 2a32bc0b80fa454ef3e7a6ade0882e000124189e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Thu, 6 Feb 2025 00:15:49 +0100 Subject: [PATCH 1/2] se actualiza el comparador despues de cargar para evitar el mensaje de seleccione papel --- .../presupuestoAdmin/presupuestoAdminEdit.js | 4 ++++ .../presupuestoAdmin/sections/comparador.js | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js index 587924d3..656987ba 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js @@ -40,6 +40,7 @@ class PresupuestoAdminEdit { calcularSolapas: this.calcularSolapas.bind(this), }); this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'), + () => {return this.cargandoPresupuesto}, { getDimensionLibro: this.getDimensionLibro, }); @@ -298,6 +299,9 @@ 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'); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js index 8d177c17..1e6316f8 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js @@ -4,10 +4,12 @@ import Ajax from '../../../components/ajax.js'; class Comparador { - constructor(domItem, functions = {}) { + constructor(domItem, cargando, functions = {}) { this.domItem = domItem; + this.cargando = cargando; + this.getDimensionLibro = functions.getDimensionLibro; this.tipo_impresion_id = parseInt($('#tipo_impresion_id').val()); @@ -267,7 +269,6 @@ class Comparador { this.btnInsertarCubierta = $('#insertarCubiertaBtn'); this.btnInsertarFaja = $('#insertarFajaBtn'); - this.cargando = false; this.comparadorPlanaRunning = false; } @@ -473,8 +474,6 @@ class Comparador { cargarDatos(datos) { - this.cargando = true; - this.tipo_impresion.val(datos.tipo_impresion).trigger('change'); this.updateOpcionesComparador(); @@ -544,9 +543,10 @@ class Comparador { this.#computarPaginasColor(datos.posPagColor); } } + } - this.cargando = false; - + updateComparador(){ + if (this.paginasColor.val() > 0) { this.paginasColor.trigger('change'); } @@ -565,7 +565,6 @@ class Comparador { this.carasGuardas.trigger('change'); } this.faja.trigger('change'); - } @@ -1009,6 +1008,9 @@ class Comparador { getDataForComp(uso = 'interior') { + if(this.cargando) + return { error: true, data: {} }; + let ancho = 0; let alto = 0; let papel_generico = {}; From bbe802d2b7a251da54b3eea03b7edd035c262e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Thu, 6 Feb 2025 00:34:53 +0100 Subject: [PATCH 2/2] arreglados buscadores de papeles en presupuesto admin --- .../Presupuestos/Presupuestoadmin.php | 4 +-- .../presupuestoAdmin/sections/comparador.js | 32 +++++++++++++++---- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index aaca3285..b11bfd10 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -1116,7 +1116,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $tirada); if ($this->request->getGet("q")) { $query->groupStart() - ->orLike("lg_papel_generico.nombre", $this->request->getGet("q")) + ->orLike("t1.nombre", $this->request->getGet("q")) ->groupEnd(); } @@ -1180,7 +1180,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $tirada); if ($this->request->getGet("q")) { $query->groupStart() - ->orLike("lg_papel_impresion.gramaje", $this->request->getGet("q")) + ->orLike("t2.gramaje", $this->request->getGet("q")) ->groupEnd(); } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js index 1e6316f8..55c0d25e 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js @@ -340,7 +340,9 @@ class Comparador { }); this.papelSobrecubierta.init(); this.gramajeSobrecubierta.init(); - this.papelSobrecubierta.onChange(() => self.gramajeSobrecubierta.empty()); + this.papelSobrecubierta.item.on('select2:select', function() { + self.gramajeSobrecubierta.empty() + }); this.sobrecubierta.on('change', () => { if (this.sobrecubierta.select2('data')[0].id == 1) { if ($('#solapas_sobrecubierta').prop('checked') == false) { @@ -386,14 +388,30 @@ class Comparador { if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) { this.papelGuardas.init(); this.gramajeGuardas.init(); - this.papelGuardas.onChange(() => self.gramajeGuardas.empty()); + this.papelGuardas.item.on('select2:select', function() { + self.gramajeGuardas.empty() + }); } - this.papelNegro.onChange(() => self.gramajeNegro.empty()); - this.papelNegrohq.onChange(() => self.gramajeNegrohq.empty()); - this.papelColor.onChange(() => self.gramajeColor.empty()); - this.papelColorhq.onChange(() => self.gramajeColorhq.empty()); - this.papelCubierta.onChange(() => self.gramajeCubierta.empty()); + this.papelNegro.item.on('select2:select', function() { + self.gramajeNegro.empty() + }); + this.papelNegrohq.item.on('select2:select', function() { + self.gramajeNegrohq.empty() + }); + this.papelColor.item.on('select2:select', function(){ + self.gramajeColor.empty() + }); + this.papelColorhq.item.on('select2:select', function() { + self.gramajeColorhq.empty() + }); + this.papelCubierta.item.on('select2:select', function() { + self.gramajeCubierta.empty() + }); + + this.papelFaja.item.on('select2:select', function() { + self.gramajeFaja.empty() + }); this.tipo_impresion.select2({