From d4af79a22daf41f9786002056277121ed5cd22f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 11 Mar 2024 13:47:40 +0100 Subject: [PATCH] =?UTF-8?q?a=C3=B1adido=20orden=20y=20boton=20de=20usar=20?= =?UTF-8?q?tirada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_lineasPresupuestoItems.php | 7 +++++- .../_tiradasAlternativasItems.js | 22 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php index 49105ce8..3229b73a 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php @@ -1047,7 +1047,12 @@ $('.insertarLinea').on("click", function (e) { } servicioGuardas(true) } - + + + update_servicios().then(function(){ + update_tiradas_alternativas() + }) + }); diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js index 3449163d..2358dff4 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js @@ -5,6 +5,7 @@ const lastColNr_tiradasAlt = $('#tableTiradas').find("tr:first th").length - 1; // Función para generar los botones de acción de la tabla de tiradas const actionBtns_tiradasAlt = function (data) { return ` + `; }; @@ -157,7 +158,7 @@ function add_tirada_alternativa(tirada_alt) { } else { var htmlString = ''; - if(!typeIsOk){ + if(typeIsOk){ htmlString = ` `; } - $('#alert-tiradas_alt').html(htmlString); + $('#alert-tiradas_alt').hide().empty().html(htmlString).fadeIn("slow", function(){ + setTimeout(function(){ + $('#alert-tiradas_alt').fadeOut("slow"); + }, 5000); + }); } @@ -212,7 +217,7 @@ function initTableTiradas() { "paging": false, "info": false, "searching": false, - "ordering": false, + "ordering": true, "autoWidth": false, "responsive": true, "columnDefs": [ @@ -238,6 +243,7 @@ function initTableTiradas() { className: 'row-edit dt-center' } ], + order: [[0, 'asc']] }); } @@ -251,6 +257,16 @@ $(document).on('click', '.btn-delete-tirada', function (e) { }) +// Función para usar la tirada alternativa como tirada principal +$(document).on('click', '.comfirm-tirada-alt', function (e) { + + const row = $(this).closest('tr'); + const data = tableTiradas.row(row).data(); + $('#tirada').val(data.tirada); + $('#tirada').trigger('change'); +}) + + // Función para generar el JSON de las lineas de presupuesto para calcular las tiradas function generate_json_tiradas() {