From 31f7f924488f974a25ab6b06b91cb417c21aba5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Fri, 31 Jan 2025 10:14:47 +0100 Subject: [PATCH 1/5] trabajando en eventos de lineas --- ci4/app/Language/es/Presupuestos.php | 4 +- .../presupuestos/admin/_datosLibroItems.php | 41 ++++ .../admin/_datosPresupuestoClienteItems.php | 212 +++++++++++++--- .../admin/_resumenPresupuestoItems.php | 2 +- .../presupuestoAdmin/presupuestoAdminAdd.js | 1 + .../presupuestoAdmin/presupuestoAdminEdit.js | 83 ++++--- .../presupuestoAdmin/sections/comparador.js | 230 +++++++++++++++++- .../presupuestoAdmin/sections/datosLibro.js | 42 ++-- .../sections/lineasPresupuesto.js | 112 +++++++-- .../sections/tiradasAlternativas.js | 2 +- 10 files changed, 603 insertions(+), 126 deletions(-) diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 18e5f56b..4a8f06c5 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -166,6 +166,7 @@ return [ 'solapasSobrecubierta' => 'Solapas sobrecub.', 'solapasAnchoCubierta' => 'Ancho solapas cub.', 'solapasAnchoSobrecubierta' => 'Ancho solapas sobrecub.', + 'sinImpresion' => 'Sin impresion', 'unaCara' => '1 cara', 'dosCaras' => '2 caras', @@ -387,7 +388,8 @@ return [ 'noInterior' => 'No se hay resultados para el interior', 'noCubiertaSobrecubierta' => 'No se hay resultados para cubierta/sobrecubierta', 'errorPresupuesto' => 'Se ha producido un error al calcular el presupuesto. Póngase en contacto con el administrador', - 'error_sobrecubierta_sin_solapas' => 'Debe seleccionar "sobrecubierta" en los datos del libro para introducir el ancho de solapa' + 'error_sobrecubierta_sin_solapas' => 'Debe seleccionar "sobrecubierta" en los datos del libro para introducir el ancho de solapa', + 'error_faja_sin_solapas' => 'Debe seleccionar "faja" en los datos del libro para introducir el ancho de solapa' ], ]; diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php index d2149259..c8172bbe 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php @@ -162,6 +162,47 @@ + +
+ +
+
+
+
+ + +
+
+
+ +
+
+ + +
+ Entre 50 y 120 mm +
+
+
+
+
+ + +
+ Entre 60 y 120 mm +
+
+
+ +
+
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 eb45cbe1..b8ad40ff 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoClienteItems.php @@ -222,46 +222,46 @@ -
-
+
+
-
- - -
-
- - -
+
+ + +
+
+ + +

@@ -345,13 +345,49 @@ class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
- +

+
+
+

+ +

+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
@@ -799,6 +835,102 @@
+
+
+

+ +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + : + + 0.00
+ +
+ +
+ +
+
+
+
+ diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php index 1ecd5e1f..4eb6c8a2 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php @@ -82,7 +82,7 @@ estado_id == 2): ?>
-
' + + '' + + '' + } + if (d.maquinaTipo == 'inkjet') { value += '' + @@ -1389,6 +1405,22 @@ class LineasPresupuesto { const self = this; const dimension = this.getDimensionLibro(); + if (linea == 'lp_faja') { + if (Object.keys(input_data).length == 0) { + let altoSelected = parseInt($('#' + linea + '_altoFaja').val()); + if(altoSelected == 0 || isNaN(altoSelected) || altoSelected == '' || altoSelected < 50){ + altoSelected = 50; + } + else if(altoSelected > dimension.alto){ + altoSelected = dimension.alto; + } + dimension.alto = altoSelected; + } + else{ + dimension.alto = parseInt($('#faja_alto').val()); + } + } + const dataFromComparador = fromComparador; if (Object.keys(input_data).length == 0) { @@ -1406,7 +1438,7 @@ class LineasPresupuesto { if (linea == 'lp_cubierta') { input_data.paginas = parseInt($('#lp_cubierta_paginas option:selected').val()); } - else if (linea == 'lp_sobrecubierta') { + else if (linea == 'lp_sobrecubierta' || linea == 'lp_faja') { input_data.paginas = 4; } else if (linea == 'lp_guardas') { @@ -1433,6 +1465,7 @@ class LineasPresupuesto { uso = 'cubierta'; break; case 'lp_sobrecubierta': + case 'lp_faja': uso = 'sobrecubierta'; break; case 'lp_guardas': @@ -1453,7 +1486,6 @@ class LineasPresupuesto { hq = 0; } - var datos = { tipo_impresion_id: $('#tipo_impresion_id').val(), type: uso, @@ -1496,6 +1528,11 @@ class LineasPresupuesto { datos.solapas_ancho = $('#solapas_sobrecubierta').is(':checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0; datos.lomo = $('#lomo_sobrecubierta').val(); } + else if (linea == 'lp_faja') { + datos.solapas = 1; + datos.solapas_ancho = parseInt($('#faja_solapas_ancho').val()); + datos.lomo = $('#lomo_sobrecubierta').val(); + } else if (linea == 'lp_guardas') { datos.paginas_impresion = input_data.paginas_impresion; } @@ -1503,7 +1540,7 @@ class LineasPresupuesto { // Si es inkjet, existe este check if ($('#' + linea + '_aFavorFibra').length) { - datos.a_favor_fibra = $('#' + linea + '_aFavorFibra').prop('checked') ? 1: 0; + datos.a_favor_fibra = $('#' + linea + '_aFavorFibra').prop('checked') ? 1 : 0; } if (updatedTipologias && $('#' + linea + '_gotaNegro').length) { @@ -1549,6 +1586,9 @@ class LineasPresupuesto { response.lineas[$i].fields.check_papel_total = 1; response.lineas[$i].fields.check_impresion_total = 1; } + if (linea == 'lp_faja') { + response.lineas[$i].fields.alto_faja = dimension.alto; + } self.rellenarDatosLinea(linea, response.lineas[$i].fields); return true; @@ -1583,7 +1623,7 @@ class LineasPresupuesto { papel_impresion_id: row.papelImpresionId, maquina_id: row.maquinaId, } - if(linea.includes('guardas')) { + if (linea.includes('guardas')) { input_data.paginas_impresion = parseInt($('#compCarasGuardas').select2('data')[0].id); } this.obtenerLinea(linea, fromComparator, false, input_data) @@ -1602,7 +1642,13 @@ class LineasPresupuesto { this.table.row.add(data).draw() currentRow = this.table.row('#' + linea); } - currentRow.child(this.formatRow(currentRow.data())).show(); + + let datosLinea = currentRow.data(); + if(linea == 'lp_faja') { + datosLinea.alto_faja = row.alto_faja; + } + + currentRow.child(this.formatRow(datosLinea)).show(); this.#addEventosLineas(linea, data.maquinaTipo == 'inkjet' ? true : false); @@ -1615,16 +1661,16 @@ class LineasPresupuesto { */ $(document).trigger('update-presupuesto', { - update_lineas : false, - update_servicios : true, + update_lineas: false, + update_servicios: true, update_envios: true, update_resumen: true, update_tiradas_alternativas: true }); - + // Si existe cubierta, hay que actualizar con el valor del lomo - if (linea != 'lp_cubierta' && linea != 'lp_sobrecubierta' && this.table.row('#lp_cubierta').length > 0) { + if (linea != 'lp_cubierta' && linea != 'lp_sobrecubierta' && linea != 'lp_faja' && this.table.row('#lp_cubierta').length > 0) { this.obtenerLinea('lp_cubierta', false, false); } if (mostrar_calculos) { @@ -1666,6 +1712,7 @@ class LineasPresupuesto { uso = 'cubierta'; break; case 'lp_sobrecubierta': + case 'lp_faja': uso = 'sobrecubierta'; break; case 'lp_guardas': @@ -1765,6 +1812,12 @@ class LineasPresupuesto { $('#' + tipoLinea + '_defecto').on("click", () => { this.lp_por_defecto(tipoLinea); }); $('#' + tipoLinea + '_aFavorFibra').on("change", () => { this.change_aFavorFibra(tipoLinea); }); } + + if(tipoLinea == 'lp_faja') { + $('#' + tipoLinea + '_altoFaja').on("change", function (event) { + self.obtenerLinea(tipoLinea, false, false, {}, event); // Pasamos explícitamente 'tipoLinea' + }.bind(this)); + } } @@ -1922,19 +1975,36 @@ class LineasPresupuesto { } } self.table.draw(); - + var rows = $("#tableCompGuardas").DataTable().rows('.selected').data().toArray(); for (const row of rows) { this.rellenarDatosLinea('lp_guardas', row, true); } - + $(document).trigger('add-servicio-lineas', 'plegado_guardas'); } + else if (e.target.id.includes("Faja")) { + + for (let i = self.table.rows().data().length - 1; i >= 0; i--) { + let row = self.table.row(i).data(); // Obtener datos de la fila actual + + if (row.row_id.includes('lp_faja')) { + self.table.row(i).remove(); // Eliminar fila + } + } + self.table.draw(); + + var rows = $("#tableCompFaja").DataTable().rows('.selected').data().toArray(); + for (const row of rows) { + this.rellenarDatosLinea('lp_faja', row, true); + } + } + $(document).trigger('update-presupuesto', { - update_lineas : false, - update_servicios : true, + update_lineas: false, + update_servicios: true, update_envios: true, update_resumen: true, update_tiradas_alternativas: true diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/tiradasAlternativas.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/tiradasAlternativas.js index 897566d1..f2c327ce 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/tiradasAlternativas.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/tiradasAlternativas.js @@ -147,7 +147,7 @@ class TiradasAlernativas { const self = this; const id = window.location.href.split('/').pop(); - const tirada = tiradaExterna === null ? parseInt(this.tirada.val()) : tiradaExterna; + const tirada = tiradaExterna === null || isNaN(tiradaExterna) ? parseInt(this.tirada.val()) : tiradaExterna; const tirada_ejemplo = parseInt($('#tirada').val()); const POD = parseInt($('#POD').val()); From a75ef4eae6909486c5251b26b7b5aa6205fce877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Sat, 1 Feb 2025 10:43:49 +0100 Subject: [PATCH 2/5] guardado faja datos libro --- .../Presupuestos/Presupuestoadmin.php | 7 +++-- .../Presupuestos/PresupuestoEntity.php | 8 +++-- .../Models/Presupuestos/PresupuestoModel.php | 4 ++- ci4/app/Services/PresupuestoService.php | 2 +- .../presupuestos/admin/_datosLibroItems.php | 4 +-- .../admin/_lineasPresupuestoItems.php | 1 + .../presupuestoAdmin/presupuestoAdminEdit.js | 26 +++++++++++----- .../presupuestoAdmin/sections/datosLibro.js | 23 ++++++++++++-- .../sections/lineasPresupuesto.js | 30 +++++++++++++++---- .../presupuestoAdmin/sections/resumen.js | 30 +++++++++---------- 10 files changed, 96 insertions(+), 39 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index b5e98455..a2d6acb0 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -478,6 +478,10 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $data['datosLibro']['solapasSobrecubierta'] = $presupuesto->solapas_sobrecubierta; $data['datosLibro']['solapasCubiertaAncho'] = $presupuesto->solapas_ancho; $data['datosLibro']['solapasSobrecubiertaAncho'] = $presupuesto->solapas_ancho_sobrecubierta; + $data['datosLibro']['fajaColor'] = $presupuesto->faja_color; + $data['datosLibro']['fajaColorSolapasAncho'] = $presupuesto->solapas_ancho_faja_color; + $data['datosLibro']['fajaColorAlto'] = $presupuesto->alto_faja_color; + $modelAcabado = model("App\Models\Tarifas\Acabados\TarifaAcabadoModel"); $data['datosLibro']['acabadoCubierta']['id'] = $presupuesto->acabado_cubierta_id; if ($presupuesto->acabado_cubierta_id == 0) { @@ -497,8 +501,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $data['datosLibro']['marcapaginas'] = $presupuesto->marcapaginas; $data['datosLibro']['retractilado'] = $presupuesto->retractilado; $data['datosLibro']['retractilado5'] = $presupuesto->retractilado5; - $data['datosLibro']['fajaColor'] = $presupuesto->faja_color; - + $data['comparador']['tipo_impresion'] = $presupuesto->comp_tipo_impresion; $data['comparador']['json_data'] = json_decode($presupuesto->comparador_json_data, true); if ($data['comparador']['json_data'] != null) { diff --git a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php index 7d736a94..92eca96c 100755 --- a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php +++ b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php @@ -31,7 +31,6 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity "retractilado" => false, "retractilado5" => false, "guardas" => false, - "faja_color" => false, "recoger_en_taller" => false, "ferro" => false, "ferro_digital" => false, @@ -53,6 +52,9 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity "solapas_ancho" => 0.0, "solapas_sobrecubierta" => false, "solapas_ancho_sobrecubierta" => 0.0, + "faja_color" => false, + "solapas_ancho_faja_color" => 0.0, + "alto_faja_color" => 0.0, "cosido" => false, "sobrecubiertas" => false, "sobrecubiertas_ancho" => 0.0, @@ -121,7 +123,6 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity "retractilado" => "boolean", "retractilado5" => "boolean", "guardas" => "boolean", - "faja_color" => "boolean", "recoger_en_taller" => "boolean", "ferro" => "boolean", "ferro_digital" => "boolean", @@ -137,6 +138,9 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity "solapas_ancho" => "float", "solapas_sobrecubierta" => "boolean", "solapas_ancho_sobrecubierta" => "float", + "faja_color" => "boolean", + "solapas_ancho_faja_color" => "float", + "alto_faja_color" => "float", "cosido" => "boolean", "sobrecubiertas" => "boolean", "sobrecubiertas_ancho" => "float", diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index 4a80cd50..f515e833 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -54,7 +54,6 @@ class PresupuestoModel extends \App\Models\BaseModel "retractilado", "retractilado5", "guardas", - "faja_color", "recoger_en_taller", "ferro", "ferro_digital", @@ -76,6 +75,9 @@ class PresupuestoModel extends \App\Models\BaseModel "solapas_ancho", "solapas_sobrecubierta", "solapas_ancho_sobrecubierta", + "solapas_ancho_faja_color", + "faja_color", + "alto_faja_color", "cosido", "sobrecubiertas", "sobrecubiertas_ancho", diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index 255b2cad..b508d9f2 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -945,7 +945,7 @@ class PresupuestoService extends BaseService $alto_total += (7 + 2 * self::SANGRE_FORMAS); } // Tapa dura (espiral y wire-0) - if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7) { + else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7) { // Sólo se le añade los 20mm de sangre por cada lado $alto_total += (2 * self::SANGRE_FORMAS_CUBIERTA); } diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php index c8172bbe..8a479ee5 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosLibroItems.php @@ -182,7 +182,7 @@ * + step="1" class="form-control" min="50" value="50">
Entre 50 y 120 mm
@@ -194,7 +194,7 @@ * + maxLength="8" step="1" min="60" class="form-control" value="60">
Entre 60 y 120 mm
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.php index cda116b4..22da692e 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.php @@ -60,6 +60,7 @@ +
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js index 35ec8dab..57f1d357 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js @@ -34,6 +34,7 @@ class PresupuestoAdminEdit { { checkPaginasPresupuesto: this.checkPaginasPresupuesto, getDimensionLibro: this.getDimensionLibro, + calcularSolapas: this.calcularSolapas.bind(this) }); this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'), { @@ -198,15 +199,15 @@ class PresupuestoAdminEdit { ...datos, ...{ paginas: this.datosLibro.paginas.val(), tirada: this.datosLibro.tirada.val(), - papel_formato_id: this.datosLibro.tamanio.item.hasClass('d-none') ? 0 : this.datosLibro.tamanio.getVal(), - papel_formato_personalizado: this.datosLibro.tamanio.item.hasClass('d-none') ? 1 : 0, + papel_formato_id: this.datosLibro.tamanioPersonalizado.prop('checked') ? 0 : this.datosLibro.tamanio.getVal(), + papel_formato_personalizado: this.datosLibro.tamanioPersonalizado.prop('checked') ? 1 : 0, merma: this.datosLibro.merma.val(), merma_cubierta: this.datosLibro.mermaCubierta.val() } } - if (datos.papel_formato_personalizado) { + if (this.datosLibro.tamanioPersonalizado.prop('checked')) { datos.papel_formato_ancho = this.datosLibro.anchoPersonalizado.val(), - datos.papel_formato_alto = this.datosLibro.altoPersonalizado.val() + datos.papel_formato_alto = this.datosLibro.altoPersonalizado.val() } datos.selectedTirada = this.datosLibro.tirada.val(); datos.acabado_cubierta_id = this.datosLibro.acabadoCubierta.getVal(); @@ -244,6 +245,10 @@ class PresupuestoAdminEdit { datos.solapas_sobrecubierta = this.datosLibro.solapasSobrecubierta.is(':checked') ? 1 : 0; datos.solapas_ancho_sobrecubierta = this.datosLibro.anchoSolapasSobrecubierta.val(); + datos.faja_color = this.datosLibro.faja.prop('checked') ? 1: 0; + datos.solapas_ancho_faja_color = this.datosLibro.fajaSolapasAncho.val(); + datos.alto_faja_color = this.datosLibro.fajaAlto.val(); + datos.entrega_taller = this.envios.recogerTaller.is(':checked') ? 1 : 0; if (parseInt(this.cosido.val())) { @@ -377,6 +382,11 @@ class PresupuestoAdminEdit { }, 0); this.calcularSolapas(); + if ($('#faja_alto').length > 0 && $('#faja_alto').attr('max') != this.getDimensionLibro().alto) { + $('#faja_alto').attr('max', this.getDimensionLibro().alto); + $('#faja_alto').trigger('change'); + $('#faja_alto').closest('.mb-1').find('.form-text').text('Entre 50 y ' + this.getDimensionLibro().alto + ' mm'); + } // Funciones para detectar cambios en el formulario this.#checkChangesPresupuesto(); @@ -470,10 +480,10 @@ class PresupuestoAdminEdit { $('#solapas_ancho_sobrecubierta').trigger('change'); $('#solapas_ancho_sobrecubierta').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm'); } - if ($('#solapas_ancho_faja').length > 0 && $('#solapas_ancho_faja').attr('max') != maxSolapas) { - $('#solapas_ancho_faja').attr('max', maxSolapas); - $('#solapas_ancho_faja').trigger('change'); - $('#solapas_ancho_faja').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm'); + if ($('#faja_solapas_ancho').length > 0 && $('#faja_solapas_ancho').attr('max') != maxSolapas) { + $('#faja_solapas_ancho').attr('max', maxSolapas); + $('#faja_solapas_ancho').trigger('change'); + $('#faja_solapas_ancho').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm'); } } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js index e34d08fe..183556d9 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js @@ -9,6 +9,7 @@ class DatosLibro { this.checkPaginasPresupuesto = functions.checkPaginasPresupuesto; this.getDimensionLibro = functions.getDimensionLibro; + this.calcularSolapas = functions.calcularSolapas; this.csrf_token = getToken(); this.csrf_hash = $('#mainContainer').find('input[name="' + this.csrf_token + '"]').val(); @@ -101,8 +102,10 @@ class DatosLibro { this.paginas.on('change', this.changePaginas.bind(this)); this.tirada.on('change', this.changeTirada.bind(this)); - this.anchoSolapasCubierta.on('focusout', this.checkSolapaAncho.bind(this)); - this.anchoSolapasSobrecubierta.on('focusout', this.checkSolapaAncho.bind(this)); + this.anchoSolapasCubierta.on('focusout', this.checkMinMaxInput.bind(this)); + this.anchoSolapasSobrecubierta.on('focusout', this.checkMinMaxInput.bind(this)); + this.fajaSolapasAncho.on('focusout', this.checkMinMaxInput.bind(this)); + this.fajaAlto.on('focusout', this.checkMinMaxInput.bind(this)); this.faja.on('change', this.changeFaja.bind(this)); } @@ -120,7 +123,7 @@ class DatosLibro { } } - checkSolapaAncho(event) { + checkMinMaxInput(event) { const el = event.target; if (el.value != "") { @@ -200,6 +203,13 @@ class DatosLibro { this.checkPaginasPresupuesto(); + this.calcularSolapas(); + if ($('#faja_alto').length > 0 && $('#faja_alto').attr('max') != this.getDimensionLibro().alto) { + $('#faja_alto').attr('max', this.getDimensionLibro().alto); + $('#faja_alto').trigger('change'); + $('#faja_alto').closest('.mb-1').find('.form-text').text('Entre 50 y ' + this.getDimensionLibro().alto + ' mm'); + } + $(document).trigger('update-presupuesto', { update_lineas: true, update_servicios: true, @@ -500,6 +510,13 @@ class DatosLibro { $('#div_solapas_ancho_sobrecubierta').addClass('d-none'); } + this.faja.prop('checked', datos.fajaColor); + if(datos.fajaColor){ + this.div_faja.removeClass('d-none'); + this.fajaAlto.val(datos.fajaColorAlto).trigger('change'); + this.fajaSolapasAncho.val(datos.fajaColorSolapasAncho).trigger('change'); + } + this.acabadoCubierta.setOption(datos.acabadoCubierta.id, datos.acabadoCubierta.text); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js index 167d85b9..09fb7842 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js @@ -862,6 +862,25 @@ class LineasPresupuesto { this.#addEventosLineas('lp_sobrecubierta', false); break + case 'lp_faja': + var hayLinea = false + for (let number = 0; number < dataRows.length; number++) { + if (dataRows[number].row_id == 'lp_faja') { + hayLinea = true; + continue; + } + } + + if (hayLinea) { + popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto'); + break; + } + + var data = this.#processRowData({ tipo_maquina: 'toner' }, 'lp_faja', 'lp-faja'); + this.table.row.add(data).draw(); + this.#addEventosLineas('lp_faja', false); + break + case 'lp_guardas': var hayLinea = false for (let number = 0; number < dataRows.length; number++) { @@ -1408,15 +1427,15 @@ class LineasPresupuesto { if (linea == 'lp_faja') { if (Object.keys(input_data).length == 0) { let altoSelected = parseInt($('#' + linea + '_altoFaja').val()); - if(altoSelected == 0 || isNaN(altoSelected) || altoSelected == '' || altoSelected < 50){ + if (altoSelected == 0 || isNaN(altoSelected) || altoSelected == '' || altoSelected < 50) { altoSelected = 50; } - else if(altoSelected > dimension.alto){ + else if (altoSelected > dimension.alto) { altoSelected = dimension.alto; } dimension.alto = altoSelected; } - else{ + else { dimension.alto = parseInt($('#faja_alto').val()); } } @@ -1644,7 +1663,7 @@ class LineasPresupuesto { } let datosLinea = currentRow.data(); - if(linea == 'lp_faja') { + if (linea == 'lp_faja') { datosLinea.alto_faja = row.alto_faja; } @@ -1701,6 +1720,7 @@ class LineasPresupuesto { case 'lp_guardas': case 'lp_cubierta': case 'lp_sobrecubierta': + case 'lp_faja': tipo = 'colorhq'; break default: @@ -1813,7 +1833,7 @@ class LineasPresupuesto { $('#' + tipoLinea + '_aFavorFibra').on("change", () => { this.change_aFavorFibra(tipoLinea); }); } - if(tipoLinea == 'lp_faja') { + if (tipoLinea == 'lp_faja') { $('#' + tipoLinea + '_altoFaja').on("change", function (event) { self.obtenerLinea(tipoLinea, false, false, {}, event); // Pasamos explícitamente 'tipoLinea' }.bind(this)); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js index b76dc98e..b62fcbd8 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js @@ -311,29 +311,29 @@ class Resumen { getData(){ let data = { - 'total_coste_papel': $('#totalCostePapel').attr('val').replace('€', ''), - 'total_margen_papel': $('#margenPapel').attr('val').replace('€', ''), + 'total_coste_papel': $('#totalCostePapel').text().replace('€', ''), + 'total_margen_papel': $('#margenPapel').text().replace('€', ''), 'total_margenPercent_papel': $('#porcentajeMargenPapel').text().replace('%', ''), - 'total_coste_impresion': $('#totalCosteImpresion').attr('val').replace('€', ''), - 'total_margen_impresion': $('#margenImpresion').attr('val').replace('€', ''), + 'total_coste_impresion': $('#totalCosteImpresion').text().replace('€', ''), + 'total_margen_impresion': $('#margenImpresion').text().replace('€', ''), 'total_margenPercent_impresion': $('#porcentajeMargenImpresion').text().replace('%', ''), - 'total_coste_servicios': $('#totalServicios').attr('val').replace('€', ''), - 'total_margen_servicios': $('#margenServicios').attr('val').replace('€', ''), + 'total_coste_servicios': $('#totalServicios').text().replace('€', ''), + 'total_margen_servicios': $('#margenServicios').text().replace('€', ''), 'total_margenPercent_servicios': $('#porcentajeMargenServicios').text().replace('%', ''), - 'total_coste_envios': $('#totalEnvios').attr('val').replace('€', ''), - 'total_margen_envios': $('#margenEnvios').attr('val').replace('€', ''), + 'total_coste_envios': $('#totalEnvios').text().replace('€', ''), + 'total_margen_envios': $('#margenEnvios').text().replace('€', ''), - 'total_costes': $('#totalCostes').attr('val').replace('€', ''), - 'total_margenes': $('#totalMargenes').attr('val').replace('€', ''), + 'total_costes': $('#totalCostes').text().replace('€', ''), + 'total_margenes': $('#totalMargenes').text().replace('€', ''), - 'total_antes_descuento': $('#totalAntesDescuento').attr('val').replace('€', ''), - 'total_descuento': $('#descuentoTotal').attr('val').replace('€', ''), + 'total_antes_descuento': $('#totalAntesDescuento').text().replace('€', ''), + 'total_descuento': $('#descuentoTotal').text().replace('€', ''), 'total_descuentoPercent': $('#total_descuentoPercent').val().replace('€', ''), - 'total_presupuesto': $('#totalDespuesDecuento').attr('val').replace('€', ''), - 'total_precio_unidad': $('#precioUnidadPresupuesto').attr('val').replace('€', ''), + 'total_presupuesto': $('#totalDespuesDecuento').text().replace('€', ''), + 'total_precio_unidad': $('#precioUnidadPresupuesto').text().replace('€', ''), 'total_factor': $('#factor').text().replace(/,/g, '.'), 'total_factor_ponderado': $('#factor_ponderado').text().replace(/,/g, '.'), @@ -341,7 +341,7 @@ class Resumen { if($('#confirmar_presupuesto').prop('checked')){ data.confirmar = '1'; - data.total_aceptado = $('#totalDespuesDecuento').attr('val').replace('€', ''); + data.total_aceptado = $('#totalDespuesDecuento').text().replace('€', ''); } return data; From e17e72f46de1f8beb5eefab23f09e72d8438d7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Sat, 1 Feb 2025 13:28:38 +0100 Subject: [PATCH 3/5] terminada faja en presu admin a falta de preview --- .../Presupuestos/Presupuestoadmin.php | 6 ++- ci4/app/Services/PresupuestoService.php | 36 +++++++++++------- .../assets/js/safekat/components/preview.js | 10 ++--- .../presupuestoAdmin/sections/comparador.js | 21 ++++++++++ .../sections/lineasPresupuesto.js | 4 +- .../img/safekat/presupuestos/icon_faja.png | Bin 0 -> 6300 bytes 6 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 httpdocs/themes/vuexy/img/safekat/presupuestos/icon_faja.png diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index a2d6acb0..d3b2986e 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -666,7 +666,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $gramaje = $sobrecubierta['gramaje']; $paginas_color = $sobrecubierta['datosPedido']['paginas'] ?? 0; $tipo_impresion_id = $sobrecubierta['tipo_impresion_id']; - $uso = $sobrecubierta['uso']; + $faja = intval($sobrecubierta['faja'] ?? 0); + $uso = $faja==1? 'faja' : $sobrecubierta['uso']; + $data = array( 'cliente_id' => $cliente_id, @@ -960,7 +962,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $resourceData = PresupuestoService::obtenerComparadorRotativa($input_data); - } else if ($type == 'cubierta' || $type == 'sobrecubierta') { + } else if ($type == 'cubierta' || $type == 'sobrecubierta' || $type == 'faja') { $datosPedido->solapas = $reqData['solapas']; $datosPedido->solapas_ancho = $reqData['solapas_ancho']; diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index b508d9f2..24d404a3 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -83,8 +83,13 @@ class PresupuestoService extends BaseService $parametrosInkjet->rotativa_cg = $datosTipologias[0]->cg; } + $uso_tarifa = $uso; + if($uso == 'guardas') + $uso_tarifa = 'interior'; + else if ($uso == 'faja') + $uso_tarifa = 'sobrecubierta'; $tarifamodel = new \App\Models\Configuracion\MaquinasTarifasImpresionModel(); - $datos_tarifa = $tarifamodel->getTarifa($maquina->maquina_id, ($uso == 'guardas') ? 'interior' : $uso, $tipo); + $datos_tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso_tarifa, $tipo); if (count($datos_tarifa) > 0) { $tarifaId = $datos_tarifa[0]; $tarifa = $datos_tarifa[1]; @@ -128,7 +133,7 @@ class PresupuestoService extends BaseService $clientePreciosModel = new \App\Models\Clientes\ClientePreciosModel(); $config = (object) [ - "tipo" => ($uso == 'guardas') ? 'interior' : $uso, + "tipo" => $uso_tarifa, "tipo_maquina" => $maquina->is_inkjet ? 'inkjet' : 'toner', "tipo_impresion" => $tipo ]; @@ -334,8 +339,8 @@ class PresupuestoService extends BaseService if ($uso != 'rotativa') { - $ancho_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta') ? $datosPedido->anchoExteriores : $datosPedido->ancho; - $alto_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta') ? $datosPedido->altoExteriores : $datosPedido->alto; + $ancho_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta' || $uso == 'faja') ? $datosPedido->anchoExteriores : $datosPedido->ancho; + $alto_calculo = ($uso == 'cubierta' || $uso == 'sobrecubierta' || $uso == 'faja') ? $datosPedido->altoExteriores : $datosPedido->alto; $formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $ancho_calculo, $alto_calculo, $datosPedido->isCosido, $forzar_a_favor_fibra); $response['fields'] = $formas; } @@ -366,10 +371,12 @@ class PresupuestoService extends BaseService $margen_click = $tarifa * ($tarifa_margen / 100.0); //interior (bn o color) - if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0) { + if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0 || $uso == 'faja') { // precio papel - $pliegos_libro = ceil(($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value']); - if ($pliegos_libro < 1) + $pliegos_libro = ($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value']; + if($uso != 'faja') + $pliegos_libro = ceil($pliegos_libro); + if ($uso != 'faja' && $pliegos_libro < 1) // faja pueden entrar más de una forma $pliegos_libro = 1; $pliegos_pedido = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma); $precio_libro = $pliegos_libro * ($precio_pliego_impresion + $margen_pliego_impresion); @@ -693,7 +700,7 @@ class PresupuestoService extends BaseService $h2_temp = 0; // El ancho si es cosido es el doble - if ($uso != 'cubierta' && $uso != 'sobrecubierta') { + if ($uso != 'cubierta' && $uso != 'sobrecubierta' && $uso != 'faja') { $anchoForCalculo = $isCosido ? $ancho * 2 : $ancho; } else { $anchoForCalculo = $ancho; @@ -931,7 +938,7 @@ class PresupuestoService extends BaseService if ($datosPedido) { $alto_total = floatval($datosPedido->alto); $sangre_cubierta = self::SANGRE_FORMAS_CUBIERTA; - if ($datosPedido->alto >= 297) { + if ($datosPedido->alto >= 267) { $sangre_cubierta = 10; } // Tapa dura (cosido y fresado) @@ -1761,7 +1768,8 @@ class PresupuestoService extends BaseService $tipo = $isColor ? ($isHq ? 'colorhq' : 'color') : ($isHq ? 'negrohq' : 'negro'); - $opciones_papel = PresupuestoService::get_opciones_papel($uso, $isColor); + $uso_papel = $uso == 'faja' ? 'sobrecubierta': $uso; + $opciones_papel = PresupuestoService::get_opciones_papel($uso_papel, $isColor); // Se obtienen los papeles disponibles $papelimpresionmodel = new PapelImpresionModel(); @@ -1779,7 +1787,7 @@ class PresupuestoService extends BaseService $maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto( is_rotativa: 0, tarifa_tipo: $tipo, - uso_tarifa: ($uso == 'guardas') ? 'interior' : $uso, + uso_tarifa: ($uso == 'guardas') ? 'interior' : $uso_papel, tirada: $datosPedido->tirada + $datosPedido->merma, papel_impresion_id: $papel->id, )->orderBy("t1.id", "asc")->get()->getResultObject(); @@ -1787,10 +1795,10 @@ class PresupuestoService extends BaseService // Se recorren las máquinas y se calcula el coste de linea por cada una foreach ($maquinas as $maquina) { - if ($uso == 'cubierta' || $uso == 'sobrecubierta') { + if ($uso == 'cubierta' || $uso == 'sobrecubierta' || $uso == 'faja') { - $datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso, $tipo_impresion_id, $datosPedido, $maquina->maquina_id, $lomoRedondo); - $datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso, $tipo_impresion_id, $datosPedido); + $datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso_papel, $tipo_impresion_id, $datosPedido, $maquina->maquina_id, $lomoRedondo); + $datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso_papel, $tipo_impresion_id, $datosPedido); } $data['uso'] = $uso; diff --git a/httpdocs/assets/js/safekat/components/preview.js b/httpdocs/assets/js/safekat/components/preview.js index 543f68ef..bcd53382 100644 --- a/httpdocs/assets/js/safekat/components/preview.js +++ b/httpdocs/assets/js/safekat/components/preview.js @@ -148,7 +148,7 @@ class previewFormas { let anchoPliegue = parseFloat(7); // mm let altoPliegue = parseFloat(7); // mm let sangre = parseFloat(20); // mm - if (this.isTapaDura && (this.ancho() >= 210 || this.alto() >= 297)) { + if (this.isTapaDura && (this.ancho() >= 210 || this.alto() >= 267)) { sangre = parseFloat(10); // mm } this.pvObj.anchoForma = ((2 * this.pvObj.anchoLibro) + (2 * anchoPliegue) + (2 * sangre) + this.pvObj.lomoLibro); @@ -201,7 +201,7 @@ class previewFormas { $(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + rowData.papel); $(pvName + '_pi').attr("href", $(pvName + '_pi').attr('sk-url') + rowData.papel_impresion_id); $(pvName + '_mi').attr("href", $(pvName + '_mi').attr('sk-url') + rowData.maquina_id); - $('#pv_ec_lomo').text(this.pvObj.lomoLibro); + $('#pv_ec_lomo').text(parseFloat(this.pvObj.lomoLibro).toFixed(1)); break; case 'rot_bn': @@ -482,7 +482,7 @@ class previewFormas { altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px } else { anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px + altoSangrado = (anchoSangrado * 0.6 > 650) ? 650 : anchoSangrado * 0.6; // px } altoLibro = altoSangrado * 0.97; @@ -497,7 +497,7 @@ class previewFormas { altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px } else { anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px + altoSangrado = (anchoSangrado * 0.6 > 650) ? 650 : anchoSangrado * 0.6; // px } altoLibro = altoSangrado * 0.95; anchoLibro = anchoSangrado * 0.28; @@ -676,7 +676,7 @@ class previewFormas { let styleCotas = { size: 12, family: 'Public Sans' }; let sangradoTexto = "Sangrado 20 mm"; let sangradoValor = parseFloat(20); // mm - if (this.ancho >= 210 || this.alto >= 297) { + if (this.ancho >= 210 || this.alto >= 267) { sangradoValor = parseFloat(10); // mm sangradoTexto = "Sangrado 10 mm"; } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js index c9fffc26..b541b546 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js @@ -530,6 +530,11 @@ class Comparador { this.papelGuardas.setOption(datos.json_data.guardas.papel_id, datos.json_data.guardas.papel_nombre); this.gramajeGuardas.setOption(datos.json_data.guardas.gramaje, datos.json_data.guardas.gramaje); } + if (datos.json_data.faja) { + this.faja.val(1).trigger('change'); + this.papelFaja.setOption(datos.json_data.faja.papel_id, datos.json_data.faja.papel_nombre); + this.gramajeFaja.setOption(datos.json_data.faja.gramaje, datos.json_data.faja.gramaje); + } if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) { this.lomoRedondo.val(datos.lomoRedondo ? 1 : 0).trigger('change'); @@ -1504,6 +1509,7 @@ class Comparador { let datosComp = {}; datosComp.sobrecubierta = this.getDataForComp('faja'); + datosComp.sobrecubierta.data['faja'] = 1; // se indica que es faja para el calculo de formas datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash; @@ -1862,6 +1868,21 @@ class Comparador { } + if (parseInt($('#compFaja').val()) == 1) { + let faja_obj = {}; + try { + faja_obj = { + "faja": { + 'papel_id': $('#compPapelFaja').select2('data')[0].id, + 'gramaje': $('#compGramajeFaja').select2('data')[0].text.trim(), + }, + } + } + catch (e) { + } + $.extend(data, faja_obj); + } + const data_str = JSON.stringify(data) $('#comparador_json_data').val(data_str) } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js index 09fb7842..48c754b2 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js @@ -1484,9 +1484,11 @@ class LineasPresupuesto { uso = 'cubierta'; break; case 'lp_sobrecubierta': - case 'lp_faja': uso = 'sobrecubierta'; break; + case 'lp_faja': + uso = 'faja'; + break; case 'lp_guardas': uso = 'guardas'; break; diff --git a/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_faja.png b/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_faja.png new file mode 100644 index 0000000000000000000000000000000000000000..bd2572caaa5bc5201db4f0de5ae5dae90202a486 GIT binary patch literal 6300 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 Date: Sat, 1 Feb 2025 18:31:31 +0100 Subject: [PATCH 4/5] guardado de linea faja --- .../Presupuestos/Presupuestoadmin.php | 3 + ci4/app/Language/es/Presupuestos.php | 1 + .../form/presupuestos/admin/_previewItems.php | 150 ++++++++++-------- .../sections/lineasPresupuesto.js | 8 +- .../sections/previewFormasAdmin.js | 7 + 5 files changed, 99 insertions(+), 70 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php index d3b2986e..91b2b751 100644 --- a/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoadmin.php @@ -1623,6 +1623,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController $modelPapel = new PapelGenericoModel(); foreach ($lineas as $linea) { $linea->papel_generico = (new PapelGenericoModel())->find($linea->papel_id)->nombre; + if($linea->tipo == 'lp_faja'){ + $linea->alto_faja = $presupuestoEntity->alto_faja_color; + } } $input_data = []; diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 4a8f06c5..0bdac190 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -283,6 +283,7 @@ return [ 'previewMaquinaRotativa' => 'Configuración del papel: Rotativa', 'previewCubierta' => 'Configuración del papel: Cubierta', 'previewSobrecubierta' => 'Configuración del papel: Sobrecubierta', + 'previewFaja' => 'Configuración del papel: Faja', 'previewPapelGenerico' => 'Papel Genérico', 'previewPapelCompra' => 'Papel de Compra', 'previewAreaImpresion' => 'Área de Impresión', diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php index 28f57423..8f6f7cc5 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php @@ -934,6 +934,87 @@ +
+
+
+
+ + + +
+ + +
+
+
+
TBD
+ +
+
TBD
+ +
+
TBD
+ +
+
TBDxTBD
+ +
+
TBDxTBD
+ +
+
TBDxTBD
+ +
+
TBD
+ +
+
TBD
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+
+
+ @@ -942,72 +1023,3 @@ - - - -section("additionalInlineJs") ?> -/* - -$('#tab-pv-bn').on( "click", function() { - -previewInteriorPlana('bn', , ); - -} ); - -$('#tab-pv-bnhq').on( "click", function() { - -previewInteriorPlana('bnhq', , ); - -} ); - -$('#tab-pv-color').on( "click", function() { - -previewInteriorPlana('color', , ); - -} ); - -$('#tab-pv-colorhq').on( "click", function() { - - -previewInteriorPlana('colorhq', , ); - -} ); - -$('#tab-pv-rot-bn').on( "click", function() { - -previewRotativa('rot_bn', , ); - -} ); - -$('#tab-pv-rot-color').on( "click", function() { - -previewRotativa('rot_color', , ); - -} ); - -$('#tab-pv-guardas').on( "click", function() { - -previewInteriorPlana('guardas', , ); - -} ); - -$('#tab-pv-cubierta').on( "click", function() { - -previewInteriorPlana('cubierta', , ); - -} ); - -$('#tab-pv-esquema-cubierta').on( "click", function() { - -previewEsquemaCubierta('ec', , ); - -} ); - -$('#tab-pv-sobrecubierta').on( "click", function() { - -previewInteriorPlana('sobrecubierta', , ); - -} ); -*/ - -endSection() ?> \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js index 48c754b2..41121d9f 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js @@ -980,7 +980,7 @@ class LineasPresupuesto { 'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2), - 'numeroPliegos': isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(0), + 'numeroPliegos': isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2), 'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(0), 'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6), 'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2), @@ -1062,6 +1062,10 @@ class LineasPresupuesto { data.alto_click = row.alto_click } + if (rowId == 'lp_faja'){ + data.alto_faja = row.alto_faja; + } + return data } @@ -2031,6 +2035,8 @@ class LineasPresupuesto { update_resumen: true, update_tiradas_alternativas: true }); + + showBreadCrumbSaveButton(true); } } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js index ff202546..1b24a85d 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js @@ -80,6 +80,13 @@ class PreviewFormasAdmin{ self.preview.previewInteriorPlana('sobrecubierta', self.isCosido, self.tipoTapa.includes("dura")?1:0); } ); + + $('#tab-pv-faja').on( "click", function() { + + self.preview.setData(self.data); + self.preview.previewInteriorPlana('sobrecubierta', self.isCosido, self.tipoTapa.includes("dura")?1:0); + + } ); } } From 5984f53bad7459f130b04b391195cda6865ab1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Sat, 1 Feb 2025 19:11:05 +0100 Subject: [PATCH 5/5] terminada faja en admin --- ci4/app/Language/es/Presupuestos.php | 1 + .../form/presupuestos/admin/_previewItems.php | 14 +++++++++- .../assets/js/safekat/components/preview.js | 26 ++++++++++++++++--- .../sections/lineasPresupuesto.js | 2 +- .../sections/previewFormasAdmin.js | 2 +- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 0bdac190..cc5f99b8 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -277,6 +277,7 @@ return [ 'previewConfiguracionGuardas' => 'Configuración de guardas', 'previewConfiguracionCubierta' => 'Configuración de cubierta', 'previewConfiguracionSobrecubierta' => 'Configuración de sobrecubierta', + 'previewConfiguracionFaja' => 'Configuración de faja', 'previewEsquemaCubierta' => 'Esquema de cubierta', 'previewConfiguracionEsquemaCubierta' => 'Configuración esquema de cubierta', 'previewMaquinaPlana' => 'Configuración del papel: Plana', diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php index 8f6f7cc5..b691a92b 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_previewItems.php @@ -133,6 +133,18 @@ +
@@ -1004,7 +1016,7 @@
-
+
diff --git a/httpdocs/assets/js/safekat/components/preview.js b/httpdocs/assets/js/safekat/components/preview.js index bcd53382..9aa9dec2 100644 --- a/httpdocs/assets/js/safekat/components/preview.js +++ b/httpdocs/assets/js/safekat/components/preview.js @@ -74,6 +74,7 @@ class previewFormas { case 'rot_color': case 'guardas': case 'sobrecubierta': + case 'faja': if (lineaPresupuestoId === lpName) { rowData = this.data(); } @@ -107,7 +108,7 @@ class previewFormas { anchoMaquina: parseFloat(rowData.maquina_ancho), altoImpresion: parseFloat(rowData.maquina_impresion_alto), anchoImpresion: parseFloat(rowData.maquina_impresion_ancho), - altoLibro: this.alto(), + altoLibro: lpName=='faja'? parseFloat(rowData.alto_faja).toFixed(0):this.alto(), anchoLibro: this.ancho(), offsetSolapa: 0 }; @@ -186,10 +187,10 @@ class previewFormas { let anchoPliegue = parseFloat(7); // mm let altoPliegue = parseFloat(7); // mm this.pvObj.anchoForma = ((2 * this.pvObj.anchoLibro) + (2 * anchoPliegue) + (2 * (anchoSolapaSobrecubierta + this.pvObj.offsetSolapa)) + (2 * sangre) + this.pvObj.lomoLibroSobrecubierta); - this.pvObj.altoForma += altoPliegue + (2 * sangre); + this.pvObj.altoForma += altoPliegue + parseFloat(2 * sangre); } else { this.pvObj.anchoForma = ((2 * this.pvObj.anchoLibro) + (2 * (anchoSolapaSobrecubierta + this.pvObj.offsetSolapa)) + (2 * sangre) + this.pvObj.lomoLibroSobrecubierta); - this.pvObj.altoForma += (2 * sangre); + this.pvObj.altoForma += parseFloat(2 * sangre); } // Update labels @@ -197,6 +198,25 @@ class previewFormas { anchoSolapaSobrecubierta != 0 ? $('.pv-solapas').show() : $('.pv-solapas').hide(); $(pvName + '_forma').text(this.pvObj.anchoForma + "x" + this.pvObj.altoForma); break; + + case 'faja': + let sangreFaja = parseFloat(5); // mm + let anchoSolapaFaja = $('#faja').is(':checked') ? parseFloat($('#faja_solapas_ancho').val()) : parseFloat(0); // mm + if (_isTapaDura) { + let anchoPliegue = parseFloat(7); // mm + let altoPliegue = parseFloat(7); // mm + this.pvObj.anchoForma = ((2 * this.pvObj.anchoLibro) + (2 * anchoPliegue) + (2 * (anchoSolapaFaja + this.pvObj.offsetSolapa)) + (2 * sangreFaja) + this.pvObj.lomoLibroSobrecubierta); + this.pvObj.altoForma += altoPliegue + parseFloat(2 * sangreFaja); + } else { + this.pvObj.anchoForma = ((2 * this.pvObj.anchoLibro) + (2 * (anchoSolapaFaja + this.pvObj.offsetSolapa)) + (2 * sangreFaja) + this.pvObj.lomoLibroSobrecubierta); + this.pvObj.altoForma = parseFloat(this.pvObj.altoForma) + parseFloat(2 * sangreFaja); + } + + // Update labels + $(pvName + '_solapas').text(anchoSolapaFaja); + anchoSolapaFaja != 0 ? $('.pv-solapas').show() : $('.pv-solapas').hide(); + $(pvName + '_forma').text(this.pvObj.anchoForma + "x" + this.pvObj.altoForma); + break; case 'ec': $(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + rowData.papel); $(pvName + '_pi').attr("href", $(pvName + '_pi').attr('sk-url') + rowData.papel_impresion_id); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js index 41121d9f..47765b9b 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js @@ -653,7 +653,7 @@ class LineasPresupuesto { const lpName = this.data().row_id.replace('lp_', ''); const tabName = lpName.replace('_', '-'); - if (['bn', 'bnhq', 'color', 'colorhq', 'rot_bn', 'rot_color', 'guardas', 'cubierta', 'sobrecubierta'].includes(lpName)) { + if (['bn', 'bnhq', 'color', 'colorhq', 'rot_bn', 'rot_color', 'guardas', 'cubierta', 'sobrecubierta', 'faja'].includes(lpName)) { $(`#tab-pv-${tabName}`).show(); if (lpName === 'cubierta') { $(`#tab-pv-${tabName}`).show(); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js index 1b24a85d..6f452df3 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/previewFormasAdmin.js @@ -84,7 +84,7 @@ class PreviewFormasAdmin{ $('#tab-pv-faja').on( "click", function() { self.preview.setData(self.data); - self.preview.previewInteriorPlana('sobrecubierta', self.isCosido, self.tipoTapa.includes("dura")?1:0); + self.preview.previewInteriorPlana('faja', self.isCosido, self.tipoTapa.includes("dura")?1:0); } ); }