From 86e930907d8e6b36faf06a16c55980477f6e2df9 Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Thu, 7 Dec 2023 17:40:58 +0100 Subject: [PATCH] arreglado bug --- .../_datosPresupuestoClienteItems.php | 106 ++++++++++- .../viewCosidotapablandaList.php | 172 ++++++++++++------ 2 files changed, 218 insertions(+), 60 deletions(-) diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php index dcc22285..3442a4d1 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php @@ -447,7 +447,31 @@ }); $('#compGramajeNegro').select2({ + allowClear: false, + minimumResultsForSearch: Infinity, + ajax: { + url: '', + type: 'post', + dataType: 'json', + + data: function (params) { + return { + tipo: 'gramaje', + uso: 'bn', + datos: $('#compPapelNegro').select2('data')[0].text.trim() , + : v + }; + }, + delay: 60, + processResults: function (response) { + yeniden(response.); + return { + results: response.menu + }; + }, + cache: true + } }); $('#compPapelNegrohq').select2({ @@ -456,6 +480,30 @@ $('#compGramajeNegrohq').select2({ allowClear: false, + minimumResultsForSearch: Infinity, + ajax: { + url: '', + type: 'post', + dataType: 'json', + + data: function (params) { + return { + tipo: 'gramaje', + uso: 'bnhq', + datos: $('#compPapelNegrohq').select2('data')[0].text.trim() , + : v + }; + }, + delay: 60, + processResults: function (response) { + yeniden(response.); + return { + results: response.menu + }; + }, + cache: true + } + }); $('#compPapelColor').select2({ @@ -468,10 +516,56 @@ $('#compGramajeColor').select2({ allowClear: false, + minimumResultsForSearch: Infinity, + ajax: { + url: '', + type: 'post', + dataType: 'json', + + data: function (params) { + return { + tipo: 'gramaje', + uso: 'color', + datos: $('#compPapelColor').select2('data')[0].text.trim() , + : v + }; + }, + delay: 60, + processResults: function (response) { + yeniden(response.); + return { + results: response.menu + }; + }, + cache: true + } }); $('#compGramajeColorhq').select2({ allowClear: false, + minimumResultsForSearch: Infinity, + ajax: { + url: '', + type: 'post', + dataType: 'json', + + data: function (params) { + return { + tipo: 'gramaje', + uso: 'colorhq', + datos: $('#compPapelColorhq').select2('data')[0].text.trim() , + : v + }; + }, + delay: 60, + processResults: function (response) { + yeniden(response.); + return { + results: response.menu + }; + }, + cache: true + } }); $('#compPapelCubierta').select2({ @@ -561,6 +655,7 @@ }catch(e){} }catch(e){} }catch(e){} + } var tableCompIntPlana = new DataTable('#tableCompIntPlana',{ @@ -734,7 +829,7 @@ - function getLineasIntPlana(is_color, is_hq){ + async function getLineasIntPlana(is_color, is_hq){ const dimension = getDimensionLibro(); @@ -783,13 +878,13 @@ return false; } - function getLineasIntRot(is_hq){ + async function getLineasIntRot(is_hq){ const dimension = getDimensionLibro(); // Rotativa solo negro o color (no hq) if ( is_hq==false){ - + if(checkInputsForRotativa()){ let datos = { @@ -976,6 +1071,7 @@ parseInt($(''+ elementos.paginas).val()) > 0 && checkDatosPedidoForComp()) { + getLineasIntPlana(is_color, is_hq).then((result) =>{ // Para rotativa, si es color el papel y el gramaje tiene que ser igual if(!is_color) @@ -1002,7 +1098,9 @@ } }); } - }catch(e){} + }catch(e){ + console.log(e) + } } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaList.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaList.php index ea91cb8f..5ef811b7 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaList.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaList.php @@ -59,63 +59,123 @@ `; }; + + + // Setup - add a text input to each footer cell + $('#tableOfPresupuestos thead tr') + .clone(true) + .addClass('filters') + .appendTo('#tableOfPresupuestos thead'); + + theTable = $('#tableOfPresupuestos').DataTable({ - processing: true, - serverSide: true, - autoWidth: true, - responsive: true, - scrollX: true, - lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ], - pageLength: 50, - lengthChange: true, - "dom": 'lfBrtip', - "buttons": [ - 'colvis', 'copy', 'csv', 'excel', 'print', { - extend: 'pdfHtml5', - orientation: 'landscape', - pageSize: 'A4' - } - ], - stateSave: true, - order: [[1, 'asc']], - language: { - url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" - }, - ajax : $.fn.dataTable.pipeline( { - url: '', - method: 'POST', - headers: {'X-Requested-With': 'XMLHttpRequest'}, - async: true, - }), - columnDefs: [ - { - orderable: false, - searchable: false, - targets: [lastColNr] - } - ], - columns : [ - { 'data': 'id' }, - { 'data': 'fecha' }, - { 'data': 'cliente' }, - { 'data': 'comercial' }, - { 'data': 'titulo' }, - { 'data': 'pais' }, - { 'data': 'inc_rei' }, - { 'data': 'paginas' }, - { 'data': 'tirada' }, - { 'data': 'total_presupuesto' }, - { 'data': 'estado' , - 'render': function ( data, type, row, meta ) { - if(data=='borrador') - return ''; - else if(data=='aceptado') - return ''; - } - }, - { 'data': actionBtns } - ] -}); + orderCellsTop: true, + processing: true, + serverSide: true, + autoWidth: true, + responsive: true, + scrollX: true, + lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ], + pageLength: 50, + lengthChange: true, + "dom": 'lfBrtip', + "buttons": [ + 'colvis', 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + } + ], + stateSave: true, + order: [[1, 'asc']], + language: { + url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" + }, + ajax : $.fn.dataTable.pipeline( { + url: '', + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columnDefs: [ + { + orderable: false, + searchable: false, + targets: [lastColNr] + } + ], + columns : [ + { 'data': 'id' }, + { 'data': 'fecha' }, + { 'data': 'cliente' }, + { 'data': 'comercial' }, + { 'data': 'titulo' }, + { 'data': 'pais' }, + { 'data': 'inc_rei' }, + { 'data': 'paginas' }, + { 'data': 'tirada' }, + { 'data': 'total_presupuesto' }, + { 'data': 'estado' , + 'render': function ( data, type, row, meta ) { + if(data=='borrador') + return ''; + else if(data=='aceptado') + return ''; + } + }, + { 'data': actionBtns } + ], + initComplete: function () { + var api = this.api(); + $("#tableOfPresupuestos").DataTable().columns.adjust(); + + // For each column + api + .columns() + .eq(0) + .each(function (colIdx) { + // Set the header cell to contain the input element + var cell = $('.filters th').eq( + $(api.column(colIdx).header()).index() + ); + var title = $(cell).text(); + $(cell).html(''); + + // On every keypress in this input + $( + 'input', + $('.filters th').eq($(api.column(colIdx).header()).index()) + ) + .off('keyup change') + .on('change', function (e) { + // Get the search value + $(this).attr('title', $(this).val()); + var regexr = '({search})'; //$(this).parents('th').find('select').val(); + + var cursorPosition = this.selectionStart; + // Search the column for that value + api + .column(colIdx) + .search( + this.value != '' + ? regexr.replace('{search}', '(((' + this.value + ')))') + : '', + this.value != '', + this.value == '' + ) + .draw(); + }) + .on('keyup', function (e) { + e.stopPropagation(); + + $(this).trigger('change'); + $(this) + .focus()[0] + .setSelectionRange(cursorPosition, cursorPosition); + }); + }); + }, + }); theTable.on( 'draw.dt', function () {