diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index 6fdfd9fa..58abbb68 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -390,6 +390,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController 'solapas_grandes_cubierta' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_cubierta')->value, 'solapas_grandes_sobrecubierta' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_sobrecubierta')->value, 'solapas_grandes_faja' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_faja')->value, + 'lomo_redondo' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_lomo_redondo')->value, ]; $this->viewData['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id; // Cosido tapa blanda JJO diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php index b8ad40ff..74e0986e 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php @@ -229,7 +229,7 @@ = lang('Presupuestos.lomoRedondo') ?>* - diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js index e04244fe..9da3b166 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js @@ -321,6 +321,18 @@ class Comparador { allowClear: false, minimumResultsForSearch: Infinity, }); + + this.lomoRedondo.on('change', function () { + if (!self.cargando && self.lomoRedondo.select2('data').length > 0) { + + if (self.lomoRedondo.select2('data')[0].id == 1) { + $(document).trigger('add-servicio-lineas', 'lomo_redondo'); + } + else { + $(document).trigger('remove-servicio-lineas', 'lomo_redondo'); + } + } + }); this.cabezada.select2({ allowClear: false, minimumResultsForSearch: Infinity, @@ -343,7 +355,7 @@ class Comparador { }); this.papelSobrecubierta.init(); this.gramajeSobrecubierta.init(); - this.papelSobrecubierta.item.on('select2:select', function() { + this.papelSobrecubierta.item.on('select2:select', function () { self.gramajeSobrecubierta.empty() }); this.sobrecubierta.on('change', () => { @@ -391,28 +403,28 @@ 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.item.on('select2:select', function() { + this.papelGuardas.item.on('select2:select', function () { self.gramajeGuardas.empty() }); } - this.papelNegro.item.on('select2:select', function() { - self.gramajeNegro.empty() + this.papelNegro.item.on('select2:select', function () { + self.gramajeNegro.empty() }); - this.papelNegrohq.item.on('select2:select', function() { + this.papelNegrohq.item.on('select2:select', function () { self.gramajeNegrohq.empty() }); - this.papelColor.item.on('select2:select', function(){ + this.papelColor.item.on('select2:select', function () { self.gramajeColor.empty() }); - this.papelColorhq.item.on('select2:select', function() { + this.papelColorhq.item.on('select2:select', function () { self.gramajeColorhq.empty() }); - this.papelCubierta.item.on('select2:select', function() { + this.papelCubierta.item.on('select2:select', function () { self.gramajeCubierta.empty() }); - this.papelFaja.item.on('select2:select', function() { + this.papelFaja.item.on('select2:select', function () { self.gramajeFaja.empty() }); @@ -566,8 +578,8 @@ class Comparador { } } - updateComparador(){ - + updateComparador() { + if (this.paginasColor.val() > 0) { this.paginasColor.trigger('change'); } @@ -579,8 +591,8 @@ class Comparador { } else if (this.paginasNegrohq.val() > 0) { this.paginasNegrohq.trigger('change'); - } - + } + this.paginasCubierta.trigger('change'); if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) { this.carasGuardas.trigger('change'); @@ -1023,7 +1035,7 @@ class Comparador { } } - if (!this.cargando){ + if (!this.cargando) { $('#paginas').trigger('change'); this.updateComparador(); } @@ -1031,7 +1043,7 @@ class Comparador { getDataForComp(uso = 'interior') { - if(this.cargando) + if (this.cargando) return { error: true, data: {} }; let ancho = 0; @@ -1104,7 +1116,7 @@ class Comparador { if (element.getVal() == 0 || element.getVal() == null) { const tipo = element.item.attr('id').split('Gramaje')[1]; - if ($('#compPaginas' + tipo).val() > 0 && !this.cargando) { + if ($('#compPaginas' + tipo).val() > 0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1136,7 +1148,7 @@ class Comparador { } else if (uso == 'cubierta') { - if ((this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) && !this.cargando) { + if ((this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1156,7 +1168,7 @@ class Comparador { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; } - if ((this.gramajeSobrecubierta.getVal() == 0 || this.gramajeSobrecubierta.getVal() == null) && !this.cargando) { + if ((this.gramajeSobrecubierta.getVal() == 0 || this.gramajeSobrecubierta.getVal() == null) && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1168,11 +1180,11 @@ class Comparador { } else if (uso == 'faja') { - if (this.papelFaja.getText() == "" && this.faja.val()>0 && !this.cargando) { + if (this.papelFaja.getText() == "" && this.faja.val() > 0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; } - if (this.gramajeFaja.getText() == "" && this.faja.val()>0 && !this.cargando) { + if (this.gramajeFaja.getText() == "" && this.faja.val() > 0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1185,7 +1197,7 @@ class Comparador { } else if (uso == 'guardas') { - + if ((this.papelGuardas.getVal() == 0 || this.papelGuardas.getVal() == null) && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; @@ -1537,11 +1549,11 @@ class Comparador { let datosComp = {}; datosComp.sobrecubierta = this.getDataForComp('faja'); - if(datosComp.sobrecubierta.error){ + if (datosComp.sobrecubierta.error) { return; } datosComp.sobrecubierta.data['faja'] = 1; // se indica que es faja para el calculo de formas - + datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash; this.comparadorFajaRunning = true; new Ajax('/presupuestoadmin/comparadorexteriores', @@ -1550,7 +1562,7 @@ class Comparador { }, {}, (response) => { - + if (response.data.sobrecubierta && Object.keys(response.data.sobrecubierta).length > 0) { let sorted = Object.values(response.data.sobrecubierta).sort( (p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? @@ -1580,7 +1592,7 @@ class Comparador { self.comparadorFajaRunning = false; } ).post(); - + } catch (e) { console.error(e); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js index 7ac54e12..65b6a01f 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js @@ -164,6 +164,16 @@ class Servicios { const id = $('#solapas_grandes_faja').attr('service-id'); this.ServiciosManipulado.getPresupuestoManipulado(id); } + else if (servicio == 'lomo_redondo'){ + const id = $('#compLomoRedondo').attr('service-id'); + for(let i = 0; i < this.ServiciosManipulado.table.rows().count(); i++){ + var data = this.ServiciosManipulado.table.row(i).data(); + if (data.tarifa_id == id) { + return; + } + }; + this.ServiciosManipulado.getPresupuestoManipulado(id); + } } removeServicio(event, servicio) { @@ -305,6 +315,16 @@ class Servicios { }; this.serviciosAcabado.table.draw(); } + else if (servicio == 'lomo_redondo'){ + const id = $('#compLomoRedondo').attr('service-id'); + for(let i = this.ServiciosManipulado.table.rows().count(); i >= 0; i--){ + var data = this.ServiciosManipulado.table.row(i).data(); + if (data && data.tarifa_id == id) { + this.ServiciosManipulado.table.row(i).remove(); + } + }; + this.ServiciosManipulado.table.draw(); + } } async updateServicios() {
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js index e04244fe..9da3b166 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js @@ -321,6 +321,18 @@ class Comparador { allowClear: false, minimumResultsForSearch: Infinity, }); + + this.lomoRedondo.on('change', function () { + if (!self.cargando && self.lomoRedondo.select2('data').length > 0) { + + if (self.lomoRedondo.select2('data')[0].id == 1) { + $(document).trigger('add-servicio-lineas', 'lomo_redondo'); + } + else { + $(document).trigger('remove-servicio-lineas', 'lomo_redondo'); + } + } + }); this.cabezada.select2({ allowClear: false, minimumResultsForSearch: Infinity, @@ -343,7 +355,7 @@ class Comparador { }); this.papelSobrecubierta.init(); this.gramajeSobrecubierta.init(); - this.papelSobrecubierta.item.on('select2:select', function() { + this.papelSobrecubierta.item.on('select2:select', function () { self.gramajeSobrecubierta.empty() }); this.sobrecubierta.on('change', () => { @@ -391,28 +403,28 @@ 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.item.on('select2:select', function() { + this.papelGuardas.item.on('select2:select', function () { self.gramajeGuardas.empty() }); } - this.papelNegro.item.on('select2:select', function() { - self.gramajeNegro.empty() + this.papelNegro.item.on('select2:select', function () { + self.gramajeNegro.empty() }); - this.papelNegrohq.item.on('select2:select', function() { + this.papelNegrohq.item.on('select2:select', function () { self.gramajeNegrohq.empty() }); - this.papelColor.item.on('select2:select', function(){ + this.papelColor.item.on('select2:select', function () { self.gramajeColor.empty() }); - this.papelColorhq.item.on('select2:select', function() { + this.papelColorhq.item.on('select2:select', function () { self.gramajeColorhq.empty() }); - this.papelCubierta.item.on('select2:select', function() { + this.papelCubierta.item.on('select2:select', function () { self.gramajeCubierta.empty() }); - this.papelFaja.item.on('select2:select', function() { + this.papelFaja.item.on('select2:select', function () { self.gramajeFaja.empty() }); @@ -566,8 +578,8 @@ class Comparador { } } - updateComparador(){ - + updateComparador() { + if (this.paginasColor.val() > 0) { this.paginasColor.trigger('change'); } @@ -579,8 +591,8 @@ class Comparador { } else if (this.paginasNegrohq.val() > 0) { this.paginasNegrohq.trigger('change'); - } - + } + this.paginasCubierta.trigger('change'); if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) { this.carasGuardas.trigger('change'); @@ -1023,7 +1035,7 @@ class Comparador { } } - if (!this.cargando){ + if (!this.cargando) { $('#paginas').trigger('change'); this.updateComparador(); } @@ -1031,7 +1043,7 @@ class Comparador { getDataForComp(uso = 'interior') { - if(this.cargando) + if (this.cargando) return { error: true, data: {} }; let ancho = 0; @@ -1104,7 +1116,7 @@ class Comparador { if (element.getVal() == 0 || element.getVal() == null) { const tipo = element.item.attr('id').split('Gramaje')[1]; - if ($('#compPaginas' + tipo).val() > 0 && !this.cargando) { + if ($('#compPaginas' + tipo).val() > 0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1136,7 +1148,7 @@ class Comparador { } else if (uso == 'cubierta') { - if ((this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) && !this.cargando) { + if ((this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1156,7 +1168,7 @@ class Comparador { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; } - if ((this.gramajeSobrecubierta.getVal() == 0 || this.gramajeSobrecubierta.getVal() == null) && !this.cargando) { + if ((this.gramajeSobrecubierta.getVal() == 0 || this.gramajeSobrecubierta.getVal() == null) && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1168,11 +1180,11 @@ class Comparador { } else if (uso == 'faja') { - if (this.papelFaja.getText() == "" && this.faja.val()>0 && !this.cargando) { + if (this.papelFaja.getText() == "" && this.faja.val() > 0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; } - if (this.gramajeFaja.getText() == "" && this.faja.val()>0 && !this.cargando) { + if (this.gramajeFaja.getText() == "" && this.faja.val() > 0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1185,7 +1197,7 @@ class Comparador { } else if (uso == 'guardas') { - + if ((this.papelGuardas.getVal() == 0 || this.papelGuardas.getVal() == null) && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; @@ -1537,11 +1549,11 @@ class Comparador { let datosComp = {}; datosComp.sobrecubierta = this.getDataForComp('faja'); - if(datosComp.sobrecubierta.error){ + if (datosComp.sobrecubierta.error) { return; } datosComp.sobrecubierta.data['faja'] = 1; // se indica que es faja para el calculo de formas - + datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash; this.comparadorFajaRunning = true; new Ajax('/presupuestoadmin/comparadorexteriores', @@ -1550,7 +1562,7 @@ class Comparador { }, {}, (response) => { - + if (response.data.sobrecubierta && Object.keys(response.data.sobrecubierta).length > 0) { let sorted = Object.values(response.data.sobrecubierta).sort( (p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? @@ -1580,7 +1592,7 @@ class Comparador { self.comparadorFajaRunning = false; } ).post(); - + } catch (e) { console.error(e); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js index 7ac54e12..65b6a01f 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js @@ -164,6 +164,16 @@ class Servicios { const id = $('#solapas_grandes_faja').attr('service-id'); this.ServiciosManipulado.getPresupuestoManipulado(id); } + else if (servicio == 'lomo_redondo'){ + const id = $('#compLomoRedondo').attr('service-id'); + for(let i = 0; i < this.ServiciosManipulado.table.rows().count(); i++){ + var data = this.ServiciosManipulado.table.row(i).data(); + if (data.tarifa_id == id) { + return; + } + }; + this.ServiciosManipulado.getPresupuestoManipulado(id); + } } removeServicio(event, servicio) { @@ -305,6 +315,16 @@ class Servicios { }; this.serviciosAcabado.table.draw(); } + else if (servicio == 'lomo_redondo'){ + const id = $('#compLomoRedondo').attr('service-id'); + for(let i = this.ServiciosManipulado.table.rows().count(); i >= 0; i--){ + var data = this.ServiciosManipulado.table.row(i).data(); + if (data && data.tarifa_id == id) { + this.ServiciosManipulado.table.row(i).remove(); + } + }; + this.ServiciosManipulado.table.draw(); + } } async updateServicios() {