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() {