diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php index 9d051314..e1bf226b 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php @@ -87,6 +87,7 @@ + @@ -105,6 +106,17 @@ section("additionalInlineJs") ?> + const lastColNr2 = $('#tableOfPapelesImpresion').find("tr:first th").length - 1; + const actionBtns2 = function(data) { + return ` + + `; + }; + + $(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 diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/format.js b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/format.js deleted file mode 100644 index 98639cf7..00000000 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/format.js +++ /dev/null @@ -1,107 +0,0 @@ -const lastColNr = $('#tableOfPapelesgenericos').find("tr:first th").length - 1; -const actionBtns = function(data) { - return ` -
- - -
- `; -}; -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/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': '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' ? '' : ''; - }); - } - -}); - -$(document).on('click', '.btn-edit', function(e) { - //window.location.href = `/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: '', - text: '', - icon: 'warning', - showCancelButton: true, - confirmButtonColor: '#3085d6', - confirmButtonText: '', - cancelButtonText: '', - cancelButtonColor: '#d33' - }) - .then((result) => { - const dataId = $(this).data('id'); - const row = $(this).closest('tr'); - if (result.value) { - $.ajax({ - //url: `/${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, - }); - }) - } - }); -}); \ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php index af59dc8d..0694fcee 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php @@ -94,6 +94,7 @@ + @@ -165,6 +166,13 @@ `; }; + const lastColNr2 = $('#tableOfMaquinas').find("tr:first th").length - 1; + const actionBtns2 = function(data) { + return ` + + `; + }; + 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