From ed5f73db2578ae98277ed2ff6d6d688ed42936ac Mon Sep 17 00:00:00 2001 From: imnavajas Date: Tue, 22 Apr 2025 09:06:11 +0200 Subject: [PATCH] Refactoring --- .../catalogo/_configuracionLibroFormItems.php | 86 +++++++++---------- .../form/catalogo/viewCatalogoLibrosForm.php | 2 - .../js/safekat/pages/catalogo/catalogo.js | 46 +++++----- 3 files changed, 64 insertions(+), 70 deletions(-) diff --git a/ci4/app/Views/themes/vuexy/form/catalogo/_configuracionLibroFormItems.php b/ci4/app/Views/themes/vuexy/form/catalogo/_configuracionLibroFormItems.php index 38856b25..f5eccff7 100644 --- a/ci4/app/Views/themes/vuexy/form/catalogo/_configuracionLibroFormItems.php +++ b/ci4/app/Views/themes/vuexy/form/catalogo/_configuracionLibroFormItems.php @@ -31,24 +31,20 @@
- @@ -103,19 +99,19 @@
-
+

-
-
- +
- colorPapelName)): ?>
- @@ -182,8 +178,8 @@

- @@ -193,8 +189,8 @@
- cubiertaPapelName)): ?>
-
-
- @@ -239,7 +235,7 @@

-
- sobrecubiertaPapelName)): ?>
-
- +
- diff --git a/ci4/app/Views/themes/vuexy/form/catalogo/viewCatalogoLibrosForm.php b/ci4/app/Views/themes/vuexy/form/catalogo/viewCatalogoLibrosForm.php index 74b01fa2..c4720ae4 100644 --- a/ci4/app/Views/themes/vuexy/form/catalogo/viewCatalogoLibrosForm.php +++ b/ci4/app/Views/themes/vuexy/form/catalogo/viewCatalogoLibrosForm.php @@ -39,12 +39,10 @@ section('css') ?> - endSection() ?> section("additionalExternalJs") ?> - endSection() ?> \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/catalogo/catalogo.js b/httpdocs/assets/js/safekat/pages/catalogo/catalogo.js index 932d8053..8110d9d0 100644 --- a/httpdocs/assets/js/safekat/pages/catalogo/catalogo.js +++ b/httpdocs/assets/js/safekat/pages/catalogo/catalogo.js @@ -14,7 +14,7 @@ class Catalogo { this.encuadernacion = new ClassSelect($("#encuadernacion"), '/importador/getencuadernacion', "Seleccione una encuadernación"); - this.compPapelNegro = new ClassSelect($("#compPapelNegro"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, + this.compPapelNegro = new ClassSelect($("#negro_papel_id"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, { tipo_impresion: () => this.encuadernacion.getVal(), @@ -37,7 +37,7 @@ class Catalogo { tipo: () => this.tipo_impresion.val().includes('hq') ? 'negrohq' : 'negro', }); - this.compGramajeNegro = new ClassSelect($('#compGramajeNegro'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + this.compGramajeNegro = new ClassSelect($('#negro_gramaje'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, { tipo_impresion: () => this.encuadernacion.getVal(), papel_generico: () => this.compPapelNegro.getVal(), @@ -49,7 +49,7 @@ class Catalogo { tipo: () => this.tipo_impresion.val().includes('hq') ? 'negrohq' : 'negro', }); - this.compPapelColor = new ClassSelect($("#compPapelColor"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, + this.compPapelColor = new ClassSelect($("#color_papel_id"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, { tipo_impresion: () => this.encuadernacion.getVal(), tirada: () => this.tirada_no_pod, @@ -60,7 +60,7 @@ class Catalogo { tipo: () => this.tipo_impresion.val().includes('hq') ? 'colorhq' : 'color', }); - this.compGramajeColor = new ClassSelect($('#compGramajeColor'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + this.compGramajeColor = new ClassSelect($('#color_gramaje'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, { tipo_impresion: () => this.encuadernacion.getVal(), papel_generico: () => this.compPapelColor.getVal(), @@ -72,29 +72,29 @@ class Catalogo { tipo: () => this.tipo_impresion.val().includes('hq') ? 'colorhq' : 'color', }); - this.compPapelCubierta = new ClassSelect($("#compPapelCubierta"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, + this.compPapelCubierta = new ClassSelect($("#cubierta_papel_id"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, { tipo_impresion: this.encuadernacion.getVal(), tirada: () => this.tirada_no_pod, ancho: () => this.getDimensionLibro().ancho, alto: () => this.getDimensionLibro().alto, - sopalas: () => $('#compSolapasCubierta').val(), + sopalas: () => $('#cubierta_solapas_ancho').val(), lomo: () => 0, tipo: 'colorhq', uso: 'cubierta', }); - this.compGramajeCubierta = new ClassSelect($('#compGramajeCubierta'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + this.compGramajeCubierta = new ClassSelect($('#cubierta_gramaje'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, { tipo_impresion: () => this.encuadernacion.getVal(), papel_generico: () => this.compPapelCubierta.getVal(), tirada: () => this.tirada_no_pod, ancho: () => this.getDimensionLibro().ancho, alto: () => this.getDimensionLibro().alto, - sopalas: () => $('#compSolapasCubierta').val(), + sopalas: () => $('#cubierta_solapas_ancho').val(), lomo: 0, tipo: 'colorhq', }); - this.compPapelSobrecubierta = new ClassSelect($("#compPapelSobrecubierta"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, + this.compPapelSobrecubierta = new ClassSelect($("#sobrecubierta_papel_id"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, { tipo_impresion: this.encuadernacion.getVal(), tirada: () => this.tirada_no_pod, @@ -105,7 +105,7 @@ class Catalogo { tipo: 'colorhq', uso: 'sobrecubierta', }); - this.compGramajeSobrecubierta = new ClassSelect($('#compGramajeSobrecubierta'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + this.compGramajeSobrecubierta = new ClassSelect($('#sobrecubierta_gramaje'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, { tipo_impresion: () => this.encuadernacion.getVal(), papel_generico: () => this.compPapelSobrecubierta.getVal(), @@ -117,25 +117,25 @@ class Catalogo { tipo: 'colorhq', }); - this.acabadoCubierta = new ClassSelect($("#compAcabadoCubierta"), + this.acabadoCubierta = new ClassSelect($("#cubierta_acabado_id"), '/serviciosacabados/getacabados', - '', + 'Seleccione acabado', false, { "cubierta": 1 } ); - this.acabadosSobrecubierta = new ClassSelect($("#compAcabadoSobrecubierta"), + this.acabadosSobrecubierta = new ClassSelect($("#sobrecubierta_acabado_id"), '/serviciosacabados/getacabados', - '', + 'Seleccione acabado', false, { "sobrecubierta": 1 } ); - this.sobrecubiertaItems = $('.comp_sobrecubierta_items'); - this.compPaginasSobrecubierta = $('#compSobrecubierta'); + this.sobrecubiertaItems = $('.sobrecubierta_items'); + this.paginasSobrecubierta = $('#sobrecubierta_paginas'); } @@ -151,7 +151,7 @@ class Catalogo { this.cliente.init(); this.tipo_impresion.select2(); this.caras_cubierta.select2(); - this.compPaginasSobrecubierta.select2(); + this.paginasSobrecubierta.select2(); this.encuadernacion.init(); @@ -184,7 +184,7 @@ class Catalogo { this.tipo_impresion.on("change", this.updateOpcionesComparador.bind(this)); // Al cambiar el selector de paginas de sobrecubierta - this.compPaginasSobrecubierta.on('change', this.toggleSobrecubiertaFields.bind(this)); + this.paginasSobrecubierta.on('change', this.toggleSobrecubiertaFields.bind(this)); this.updateOpcionesComparador(); @@ -198,12 +198,12 @@ class Catalogo { updateOpcionesComparador() { - $('.comp_negro_items').off('change'); - $('.comp_color_items').off('change'); + $('.negro_items').off('change'); + $('.color_items').off('change'); const selValue = this.tipo_impresion.val(); - const elements_negro = $('.comp-negro-selected'); - const elements_color = $('.comp-color-selected'); + const elements_negro = $('.negro-selected'); + const elements_color = $('.color-selected'); if (selValue.includes('color')) { Array.from(elements_color).forEach(element => { @@ -229,7 +229,7 @@ class Catalogo { } toggleSobrecubiertaFields() { - if (this.compPaginasSobrecubierta.val() === '1') { + if (this.paginasSobrecubierta.val() === '1') { this.sobrecubiertaItems.prop('disabled', false).trigger('change.select2'); } else { this.sobrecubiertaItems.prop('disabled', true).trigger('change.select2');