mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadido editar a la lista de maquinas y papeles que salen en papeles y maquinas respect.
This commit is contained in:
@ -87,6 +87,7 @@
|
||||
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
||||
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
|
||||
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -105,6 +106,17 @@
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
const lastColNr2 = $('#tableOfPapelesImpresion').find("tr:first th").length - 1;
|
||||
const actionBtns2 = function(data) {
|
||||
return `
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit2 mx-2" data-id="${data.papel_impresion_id}"></i></a>
|
||||
`;
|
||||
};
|
||||
|
||||
$(document).on('click', '.btn-edit2', function(e) {
|
||||
window.open(`/configuracion/papelesimpresion/edit/${$(this).attr('data-id')}`);
|
||||
});
|
||||
|
||||
function watch(j) {
|
||||
return new Proxy(JSON.parse ('{"watch":' + j + '}'), {
|
||||
set: function(target, property, value) {
|
||||
@ -467,7 +479,16 @@
|
||||
{ 'data': 'color'},
|
||||
{ 'data': 'cubierta'},
|
||||
{ 'data': 'sobrecubierta'},
|
||||
{ 'data': 'rotativa'}
|
||||
{ 'data': 'rotativa'},
|
||||
{ data: actionBtns2,
|
||||
className: 'row-edit dt-center'}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr2]
|
||||
}
|
||||
],
|
||||
rowCallback: function (row, data) {
|
||||
// Set the checked state of the checkbox in the table
|
||||
|
||||
@ -1,107 +0,0 @@
|
||||
const lastColNr = $('#tableOfPapelesgenericos').find("tr:first th").length - 1;
|
||||
const actionBtns = function(data) {
|
||||
return `<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
|
||||
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
|
||||
</div>
|
||||
</td>`;
|
||||
};
|
||||
theTable = $('#tableOfPapelesgenericos').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
"dom": 'lfBrtip', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
|
||||
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
|
||||
"buttons": [
|
||||
'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('dataTableOfPapelesGenericos') ?>',
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr]
|
||||
}
|
||||
],
|
||||
columns : [
|
||||
{ 'data': 'nombre' },
|
||||
{ 'data': 'code' },
|
||||
{ 'data': 'code_ot' },
|
||||
{ 'data': 'show_in_client' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
//window.location.href = `<?= route_to('papelGenericoList') ?>/edit/${$(this).attr('data-id')}`;
|
||||
window.location.href = `/configuracion/papelesgenericos/edit/${$(this).attr('data-id')}`;
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('PapelGenerico.papel generico'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
const dataId = $(this).data('id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
//url: `<?= route_to('papelGenericoList') ?>/${dataId}`,
|
||||
//method: 'DELETE',
|
||||
url: `/configuracion/papelesgenericos/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: data.msg ?? jqXHR.statusText,
|
||||
});
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: jqXHR.responseJSON.messages.error,
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -94,6 +94,7 @@
|
||||
<th><?= lang('Maquinas.alto') ?></th>
|
||||
<th><?= lang('Maquinas.anchoImpresion') ?></th>
|
||||
<th><?= lang('Maquinas.altoImpresion') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -165,6 +166,13 @@
|
||||
`;
|
||||
};
|
||||
|
||||
const lastColNr2 = $('#tableOfMaquinas').find("tr:first th").length - 1;
|
||||
const actionBtns2 = function(data) {
|
||||
return `
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit2 mx-2" data-id="${data.maquina_id}"></i></a>
|
||||
`;
|
||||
};
|
||||
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
|
||||
tipoTypes = [
|
||||
@ -351,6 +359,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('click', '.btn-edit2', function(e) {
|
||||
window.open(`/configuracion/maquinas/edit/${$(this).attr('data-id')}`);
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#papelGenericoId').select2({
|
||||
@ -424,6 +436,15 @@
|
||||
{ 'data': 'alto'},
|
||||
{ 'data': 'anchoimpresion'},
|
||||
{ 'data': 'altoimpresion'},
|
||||
{ data: actionBtns2,
|
||||
className: 'row-edit dt-center'}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr2]
|
||||
}
|
||||
],
|
||||
rowCallback: function (row, data) {
|
||||
// Set the checked state of the checkbox in the table
|
||||
|
||||
Reference in New Issue
Block a user