falta funcionalidad tabla pivote. al pulsar isRotativa hay que añadir un dialog. actualizar tabla papeles con tarifas

This commit is contained in:
Jaime Jiménez
2023-06-30 13:22:25 +02:00
parent d356974178
commit 14b69b52ae
3 changed files with 135 additions and 9 deletions

View File

@ -277,6 +277,52 @@
});
editor2 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfMaquinasPapelImpresion') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfMaquinaspapelesimpresion",
fields: [
{
"name": "maquina_id",
"type": "hidden"
},{
"name": "papel_generico_id",
"type": "hidden"
},{
"name": "active",
},
]
} );
editor2.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['maquina_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['maquina_id'] = id;
}
}
});
editor2.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
/*editor2.on( 'submitSuccess', function ( e, json, data, action ) {
theTable2.clearPipeline();
theTable2.draw();
});*/
var theTable = $('#tableOfMaquinastarifasimpresion').DataTable( {
serverSide: true,
processing: true,
@ -361,7 +407,7 @@
lengthChange: true,
searching: true,
paging: true,
info: false,
info: true,
dom: "lftp",
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfMaquinasPapelesImpresion') ?>',
@ -369,17 +415,20 @@
d.id_maquina = id;
d.isRotativa = isRotativa.watch;
},
/*{
id_maquina: id,
//tarifas: [{'uso':'interior', 'tipo':'negro'}],
isRotativa: isRotativa.watch,
},*/
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{ 'data': 'active'},
{ 'data': 'active',
render: function (data, type, row) {
if (type === 'display') {
return '<input type="checkbox" class="editor-active">';
}
return data;
},
className: 'dt-body-center'
},
{ 'data': 'papel_generico'},
{ 'data': 'papel_impresion'},
{ 'data': 'gramaje'},
@ -389,9 +438,19 @@
{ 'data': 'sobrecubierta'},
{ 'data': 'rotativa'}
],
rowCallback: function (row, data) {
// Set the checked state of the checkbox in the table
$('input.editor-active', row).prop('checked', data.active == 1);
},
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
}
},
columnDefs: [
{
searchable: false,
targets: [0,3,4,5,6,7,8]
}
],
} );