diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/importador/viewImportadorPresupuestos.php b/ci4/app/Views/themes/vuexy/form/presupuestos/importador/viewImportadorPresupuestos.php index 2d79f7e7..14945aba 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/importador/viewImportadorPresupuestos.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/importador/viewImportadorPresupuestos.php @@ -117,8 +117,8 @@
-
@@ -129,7 +129,7 @@
- @@ -162,13 +162,16 @@ - - + @@ -184,13 +187,15 @@ - - + @@ -233,13 +238,15 @@ - + @@ -264,14 +271,16 @@ - + @@ -299,7 +308,7 @@ @@ -314,7 +323,7 @@ @@ -369,7 +378,8 @@
-
@@ -389,7 +399,7 @@ endSection() ?> section('css') ?> - + endSection() ?> section('additionalExternalJs') ?> diff --git a/httpdocs/assets/js/safekat/pages/importadorPresupuestos/importador.js b/httpdocs/assets/js/safekat/pages/importadorPresupuestos/importador.js index 5b76c33f..f629f293 100644 --- a/httpdocs/assets/js/safekat/pages/importadorPresupuestos/importador.js +++ b/httpdocs/assets/js/safekat/pages/importadorPresupuestos/importador.js @@ -18,7 +18,18 @@ class Importador { alto: () => this.getDimensionLibro().alto, sopalas: 0, lomo: 0, - tipo: () => $('#hq').val() ? 'negrohq' : 'negro', + tipo: () => $('#isHq').val() ? 'negrohq' : 'negro', + }); + this.compGramajeNegro = new ClassSelect($('#compGramajeNegro'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + { + tipo_impresion: () => this.encuadernacion.getVal(), + papel_generico: () => this.compPapelNegroSelected.getVal(), + tirada: () => $('#tirada').val(), + ancho: () => this.getDimensionLibro().ancho, + alto: () => this.getDimensionLibro().alto, + sopalas: 0, + lomo: 0, + tipo: () => $('#isHq').val() ? 'negrohq' : 'negro', }); this.compPapelColorSelected = new ClassSelect($("#compPapelColorSelected"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, { @@ -28,7 +39,18 @@ class Importador { alto: () => this.getDimensionLibro().alto, sopalas: 0, lomo: 0, - tipo: () => $('#hq').val() ? 'colorhq' : 'color', + tipo: () => $('#isHq').val() ? 'colorhq' : 'color', + }); + this.compGramajeColor = new ClassSelect($('#compGramajeColor'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + { + tipo_impresion: () => this.encuadernacion.getVal(), + papel_generico: () => this.compPapelColorSelected.getVal(), + tirada: () => $('#tirada').val(), + ancho: () => this.getDimensionLibro().ancho, + alto: () => this.getDimensionLibro().alto, + sopalas: 0, + lomo: 0, + tipo: () => $('#isHq').val() ? 'colorhq' : 'color', }); this.compPapelCubiertaSelected = new ClassSelect($("#compPapelCubiertaSelected"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, { @@ -41,6 +63,17 @@ class Importador { tipo: 'colorhq', uso: 'cubierta', }); + this.compGramajeCubierta = new ClassSelect($('#compGramajeCubierta'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + { + tipo_impresion: () => this.encuadernacion.getVal(), + papel_generico: () => this.compPapelCubiertaSelected.getVal(), + tirada: () => $('#tirada').val(), + ancho: () => this.getDimensionLibro().ancho, + alto: () => this.getDimensionLibro().alto, + sopalas: () => $('#compSolapasCubierta').val(), + lomo: 0, + tipo: 'colorhq', + }); this.compSobrecubiertaSelected = new ClassSelect($("#compPapelSobrecubiertaSelected"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false, { tipo_impresion: this.encuadernacion.getVal(), @@ -52,6 +85,17 @@ class Importador { tipo: 'colorhq', uso: 'sobrecubierta', }); + this.compGramajeSobrecubierta = new ClassSelect($('#compGramajeSobrecubierta'), '/presupuestoadmin/papelgramaje', 'Seleccione un gramaje', false, + { + tipo_impresion: () => this.encuadernacion.getVal(), + papel_generico: () => this.compPapelCubiertaSelected.getVal(), + tirada: () => $('#tirada').val(), + ancho: () => this.getDimensionLibro().ancho, + alto: () => this.getDimensionLibro().alto, + sopalas: () => $('#compSolapasSobrecubierta').val(), + lomo: 0, + tipo: 'colorhq', + }); this.acabadoCubierta = new ClassSelect($("#compAcabadoCubiertaSelected"), '/serviciosacabados/getacabados', @@ -89,9 +133,13 @@ class Importador { this.encuadernacion.init(); this.compPapelNegroSelected.init(); + this.compGramajeNegro.init(); this.compPapelColorSelected.init(); + this.compGramajeColor.init(); this.compPapelCubiertaSelected.init(); + this.compGramajeCubierta.init(); this.compSobrecubiertaSelected.init(); + this.compGramajeSobrecubierta.init(); this.acabadoCubierta.init(); this.acabadosSobrecubierta.init(); @@ -124,6 +172,12 @@ class Importador { }); this.makeImport.on('click', this.importPresupuesto.bind(this)); + + $(document).on('change', '.warning-change', function () { + $(this).addClass('bg-warning'); + let select2Container = $(this).next('.select2').find('.select2-selection'); + select2Container.addClass('bg-warning'); + }); } importPresupuesto() { @@ -139,7 +193,7 @@ class Importador { const urlObj = new URL(window.location.href); Swal.fire({ title: 'Atención!', - text: 'Esto es una importación básica, por favor revisa los datos para comprobar que no hay errores. ' + + text: 'Esto es una importación básica, por favor revisa los datos para comprobar que no hay errores. ' + 'Tenga en cuenta que no todos los servicios se pueden importar.', icon: 'warning', showCancelButton: false, @@ -197,25 +251,25 @@ class Importador { data.papel_formato_alto = $('#papelFormatoAlto').val(); data.encuadernacion = this.encuadernacion.getVal(); - data.isHq = $('#hq').val(); + data.isHq = $('#isHq').val(); data.paginas_bn = $('#compPaginasNegro').val(); data.papel_bn = this.compPapelNegroSelected.getVal(); - data.gramaje_bn = $('#compGramajeNegro').val(); + data.gramaje_bn = this.compGramajeNegro.getVal(); data.paginas_color = $('#compPaginasColor').val(); data.papel_color = this.compPapelColorSelected.getVal(); - data.gramaje_color = $('#compGramajeColor').val(); + data.gramaje_color = this.compGramajeColor.getVal(); data.paginas_cubierta = $('#compCarasCubierta').val(); data.papel_cubierta = this.compPapelCubiertaSelected.getVal(); - data.gramaje_cubierta = $('#compGramajeCubierta').val(); + data.gramaje_cubierta = this.compGramajeCubierta.getVal(); data.solapas_cubierta = $('#compSolapasCubierta').val(); data.acabado_cubierta = this.acabadoCubierta.getVal(); data.sobrecubierta = $('#compSobrecubierta').val(); data.papel_sobrecubierta = this.compSobrecubiertaSelected.getVal(); - data.gramaje_sobrecubierta = $('#compGramajeSobrecubierta').val(); + data.gramaje_sobrecubierta = this.compGramajeSobrecubierta.getVal(); data.solapas_sobrecubierta = $('#compSolapasSobrecubierta').val(); data.acabado_sobrecubierta = this.acabadosSobrecubierta.getVal(); @@ -249,6 +303,7 @@ class Importador { if (response.success) { this.fillInitialData(response.data); + $('.bg-warning').removeClass('bg-warning'); } }, (error) => { @@ -303,35 +358,39 @@ class Importador { if (data.lineas) { if (data.lineas.isHq) { - $('#hq').val(data.lineas.hq); + $('#isHq').val(data.lineas.isHq); + } + else { + $('#isHq').val(0); } if (data.lineas.bn && data.lineas.bn.paginas) { $('#compPaginasNegro').val(data.lineas.bn.paginas); $('#compPapelNegroOrigen').val(data.lineas.bn.papel_nombre); - $('#compGramajeNegro').val(parseFloat(data.lineas.bn.gramaje).toFixed(0)); + this.compGramajeNegro.setOption(parseFloat(data.lineas.bn.gramaje).toFixed(0), parseFloat(data.lineas.bn.gramaje).toFixed(0)); this.compPapelNegroSelected.item.prop('disabled', false); this.compPapelNegroSelected.setOption(data.lineas.bn.new_papel_id, data.lineas.bn.new_papel_nombre); } else { $('#compPaginasNegro').val(0); $('#compPapelNegroOrigen').val(""); - $('#compGramajeNegro').val(""); + this.compGramajeNegro.empty(); this.compPapelNegroSelected.empty(); this.compPapelNegroSelected.item.prop('disabled', true); + this.compGramajeNegro.item.prop('disabled', true); } if (data.lineas.color && data.lineas.color.paginas) { $('#compPaginasColor').val(data.lineas.color.paginas); $('#compPapelColorOrigen').val(data.lineas.color.papel_nombre); - $('#compGramajeColor').val(parseFloat(data.lineas.color.gramaje).toFixed(0)); + this.compGramajeColor.setOption(parseFloat(data.lineas.color.gramaje).toFixed(0), parseFloat(data.lineas.color.gramaje).toFixed(0)); this.compPapelColorSelected.item.prop('disabled', false); this.compPapelColorSelected.setOption(data.lineas.color.new_papel_id, data.lineas.color.new_papel_nombre); } else { $('#compPaginasColor').val(0); $('#compPapelColorOrigen').val(""); - $('#compGramajeColor').val(""); + this.compGramajeColor.empty(); this.compPapelColorSelected.empty(); this.compPapelColorSelected.item.prop('disabled', true); } @@ -339,7 +398,7 @@ class Importador { if (data.lineas.cubierta && data.lineas.cubierta.paginas) { $('#compPaginasCubierta').val(data.lineas.cubierta.paginas); $('#compPapelCubiertaOrigen').val(data.lineas.cubierta.papel_nombre); - $('#compGramajeCubierta').val(parseFloat(data.lineas.cubierta.gramaje).toFixed(0)); + this.compGramajeCubierta.setOption(parseFloat(data.lineas.cubierta.gramaje).toFixed(0), parseFloat(data.lineas.cubierta.gramaje).toFixed(0)); $('#compSolapasCubierta').val(parseFloat(data.lineas.cubierta.solapas).toFixed(0)); this.compPapelCubiertaSelected.item.prop('disabled', false); this.compPapelCubiertaSelected.setOption(data.lineas.cubierta.new_papel_id, data.lineas.cubierta.new_papel_nombre); @@ -347,7 +406,7 @@ class Importador { else { $('#compPaginasCubierta').val(0); $('#compPapelCubiertaOrigen').val(""); - $('#compGramajeCubierta').val(""); + this.compGramajeCubierta.empty(); $('#compSolapasCubierta').val(""); this.compPapelCubiertaSelected.empty(); this.compPapelCubiertaSelected.item.prop('disabled', true); @@ -356,7 +415,7 @@ class Importador { if (data.lineas.sobrecubierta && data.lineas.sobrecubierta.paginas) { $('#compSobrecubierta').val(1); $('#compPapelSobrecubiertaOrigen').val(data.lineas.sobrecubierta.papel_nombre); - $('#compGramajeSobrecubierta').val(parseFloat(data.lineas.sobrecubierta.gramaje).toFixed(0)); + this.compGramajeSobrecubierta.setOption(parseFloat(data.lineas.sobrecubierta.gramaje).toFixed(0), parseFloat(data.lineas.sobrecubierta.gramaje).toFixed(0)); $('#compSolapasSobrecubierta').val(parseFloat(data.lineas.sobrecubierta.solapas).toFixed(0)); this.compSobrecubiertaSelected.item.prop('disabled', false); this.compSobrecubiertaSelected.setOption(data.lineas.sobrecubierta.new_papel_id, data.lineas.sobrecubierta.new_papel_nombre); @@ -364,7 +423,7 @@ class Importador { else { $('#compSobrecubierta').val(0); $('#compPapelSobrecubiertaOrigen').val(""); - $('#compGramajeSobrecubierta').val(""); + this.compGramajeSobrecubierta.empty(); $('#compSolapasSobrecubierta').val(""); this.compSobrecubiertaSelected.empty(); this.compSobrecubiertaSelected.item.prop('disabled', true);