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({
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({
@ -456,6 +480,30 @@
$('#compGramajeNegrohq').select2({
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({
@ -468,10 +516,56 @@
$('#compGramajeColor').select2({
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({
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({
@ -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)
}
}

View File

@ -59,63 +59,123 @@
</div>
</td>`;
};
// 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/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfCosidotapablanda') ?>',
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 '<?= lang('Presupuestos.presupuestoEstadoBorrador') ?>';
else if(data=='aceptado')
return '<?= lang('Presupuestos.presupuestoEstadoAceptado') ?>';
}
},
{ '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/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfCosidotapablanda') ?>',
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 '<?= lang('Presupuestos.presupuestoEstadoBorrador') ?>';
else if(data=='aceptado')
return '<?= lang('Presupuestos.presupuestoEstadoAceptado') ?>';
}
},
{ '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 () {