arreglado bug

This commit is contained in:
2023-12-07 17:40:58 +01:00
parent 71d56defac
commit 86e930907d
2 changed files with 218 additions and 60 deletions

View File

@ -447,7 +447,31 @@
}); });
$('#compGramajeNegro').select2({ $('#compGramajeNegro').select2({
allowClear: false, allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
tipo: 'gramaje',
uso: 'bn',
datos: $('#compPapelNegro').select2('data')[0].text.trim() ,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
}); });
$('#compPapelNegrohq').select2({ $('#compPapelNegrohq').select2({
@ -456,6 +480,30 @@
$('#compGramajeNegrohq').select2({ $('#compGramajeNegrohq').select2({
allowClear: false, allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
tipo: 'gramaje',
uso: 'bnhq',
datos: $('#compPapelNegrohq').select2('data')[0].text.trim() ,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
}); });
$('#compPapelColor').select2({ $('#compPapelColor').select2({
@ -468,10 +516,56 @@
$('#compGramajeColor').select2({ $('#compGramajeColor').select2({
allowClear: false, allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
tipo: 'gramaje',
uso: 'color',
datos: $('#compPapelColor').select2('data')[0].text.trim() ,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
}); });
$('#compGramajeColorhq').select2({ $('#compGramajeColorhq').select2({
allowClear: false, allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
tipo: 'gramaje',
uso: 'colorhq',
datos: $('#compPapelColorhq').select2('data')[0].text.trim() ,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
}); });
$('#compPapelCubierta').select2({ $('#compPapelCubierta').select2({
@ -561,6 +655,7 @@
}catch(e){} }catch(e){}
}catch(e){} }catch(e){}
}catch(e){} }catch(e){}
} }
var tableCompIntPlana = new DataTable('#tableCompIntPlana',{ 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(); const dimension = getDimensionLibro();
@ -783,7 +878,7 @@
return false; return false;
} }
function getLineasIntRot(is_hq){ async function getLineasIntRot(is_hq){
const dimension = getDimensionLibro(); const dimension = getDimensionLibro();
@ -976,6 +1071,7 @@
parseInt($(''+ elementos.paginas).val()) > 0 && parseInt($(''+ elementos.paginas).val()) > 0 &&
checkDatosPedidoForComp()) { checkDatosPedidoForComp()) {
getLineasIntPlana(is_color, is_hq).then((result) =>{ getLineasIntPlana(is_color, is_hq).then((result) =>{
// Para rotativa, si es color el papel y el gramaje tiene que ser igual // Para rotativa, si es color el papel y el gramaje tiene que ser igual
if(!is_color) if(!is_color)
@ -1002,7 +1098,9 @@
} }
}); });
} }
}catch(e){} }catch(e){
console.log(e)
}
} }

View File

@ -59,7 +59,17 @@
</div> </div>
</td>`; </td>`;
}; };
// Setup - add a text input to each footer cell
$('#tableOfPresupuestos thead tr')
.clone(true)
.addClass('filters')
.appendTo('#tableOfPresupuestos thead');
theTable = $('#tableOfPresupuestos').DataTable({ theTable = $('#tableOfPresupuestos').DataTable({
orderCellsTop: true,
processing: true, processing: true,
serverSide: true, serverSide: true,
autoWidth: true, autoWidth: true,
@ -114,8 +124,58 @@
} }
}, },
{ 'data': actionBtns } { '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('<input type="text" placeholder="' + title + '" />');
// 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 () { theTable.on( 'draw.dt', function () {