Merge branch 'fix/requiere_papel_comparador' into 'main'

Fix/requiere papel comparador

See merge request jjimenez/safekat!523
This commit is contained in:
2025-02-05 23:35:20 +00:00
3 changed files with 40 additions and 16 deletions

View File

@ -1116,7 +1116,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
$tirada); $tirada);
if ($this->request->getGet("q")) { if ($this->request->getGet("q")) {
$query->groupStart() $query->groupStart()
->orLike("lg_papel_generico.nombre", $this->request->getGet("q")) ->orLike("t1.nombre", $this->request->getGet("q"))
->groupEnd(); ->groupEnd();
} }
@ -1180,7 +1180,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
$tirada); $tirada);
if ($this->request->getGet("q")) { if ($this->request->getGet("q")) {
$query->groupStart() $query->groupStart()
->orLike("lg_papel_impresion.gramaje", $this->request->getGet("q")) ->orLike("t2.gramaje", $this->request->getGet("q"))
->groupEnd(); ->groupEnd();
} }

View File

@ -40,6 +40,7 @@ class PresupuestoAdminEdit {
calcularSolapas: this.calcularSolapas.bind(this), calcularSolapas: this.calcularSolapas.bind(this),
}); });
this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'), this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'),
() => {return this.cargandoPresupuesto},
{ {
getDimensionLibro: this.getDimensionLibro, getDimensionLibro: this.getDimensionLibro,
}); });
@ -298,6 +299,9 @@ class PresupuestoAdminEdit {
}; };
if (self.cargandoPresupuesto == false) { if (self.cargandoPresupuesto == false) {
self.comparador.updateComparador();
// Ejecutar los pasos de forma secuencial si están habilitados // Ejecutar los pasos de forma secuencial si están habilitados
if (update_lineas) { if (update_lineas) {
$(document).trigger('update-lineas-presupuesto'); $(document).trigger('update-lineas-presupuesto');

View File

@ -4,10 +4,12 @@ import Ajax from '../../../components/ajax.js';
class Comparador { class Comparador {
constructor(domItem, functions = {}) { constructor(domItem, cargando, functions = {}) {
this.domItem = domItem; this.domItem = domItem;
this.cargando = cargando;
this.getDimensionLibro = functions.getDimensionLibro; this.getDimensionLibro = functions.getDimensionLibro;
this.tipo_impresion_id = parseInt($('#tipo_impresion_id').val()); this.tipo_impresion_id = parseInt($('#tipo_impresion_id').val());
@ -267,7 +269,6 @@ class Comparador {
this.btnInsertarCubierta = $('#insertarCubiertaBtn'); this.btnInsertarCubierta = $('#insertarCubiertaBtn');
this.btnInsertarFaja = $('#insertarFajaBtn'); this.btnInsertarFaja = $('#insertarFajaBtn');
this.cargando = false;
this.comparadorPlanaRunning = false; this.comparadorPlanaRunning = false;
} }
@ -339,7 +340,9 @@ class Comparador {
}); });
this.papelSobrecubierta.init(); this.papelSobrecubierta.init();
this.gramajeSobrecubierta.init(); this.gramajeSobrecubierta.init();
this.papelSobrecubierta.onChange(() => self.gramajeSobrecubierta.empty()); this.papelSobrecubierta.item.on('select2:select', function() {
self.gramajeSobrecubierta.empty()
});
this.sobrecubierta.on('change', () => { this.sobrecubierta.on('change', () => {
if (this.sobrecubierta.select2('data')[0].id == 1) { if (this.sobrecubierta.select2('data')[0].id == 1) {
if ($('#solapas_sobrecubierta').prop('checked') == false) { if ($('#solapas_sobrecubierta').prop('checked') == false) {
@ -385,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) { 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.papelGuardas.init();
this.gramajeGuardas.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.papelNegro.item.on('select2:select', function() {
this.papelNegrohq.onChange(() => self.gramajeNegrohq.empty()); self.gramajeNegro.empty()
this.papelColor.onChange(() => self.gramajeColor.empty()); });
this.papelColorhq.onChange(() => self.gramajeColorhq.empty()); this.papelNegrohq.item.on('select2:select', function() {
this.papelCubierta.onChange(() => self.gramajeCubierta.empty()); 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({ this.tipo_impresion.select2({
@ -473,8 +492,6 @@ class Comparador {
cargarDatos(datos) { cargarDatos(datos) {
this.cargando = true;
this.tipo_impresion.val(datos.tipo_impresion).trigger('change'); this.tipo_impresion.val(datos.tipo_impresion).trigger('change');
this.updateOpcionesComparador(); this.updateOpcionesComparador();
@ -544,9 +561,10 @@ class Comparador {
this.#computarPaginasColor(datos.posPagColor); this.#computarPaginasColor(datos.posPagColor);
} }
} }
}
this.cargando = false; updateComparador(){
if (this.paginasColor.val() > 0) { if (this.paginasColor.val() > 0) {
this.paginasColor.trigger('change'); this.paginasColor.trigger('change');
} }
@ -565,7 +583,6 @@ class Comparador {
this.carasGuardas.trigger('change'); this.carasGuardas.trigger('change');
} }
this.faja.trigger('change'); this.faja.trigger('change');
} }
@ -1009,6 +1026,9 @@ class Comparador {
getDataForComp(uso = 'interior') { getDataForComp(uso = 'interior') {
if(this.cargando)
return { error: true, data: {} };
let ancho = 0; let ancho = 0;
let alto = 0; let alto = 0;
let papel_generico = {}; let papel_generico = {};