mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Resuelto el problema del add filtrando crear el datatable cuando es un edit solamente
This commit is contained in:
@ -14,9 +14,15 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.nombre",
|
||||
1 => "t1.papel_generico_id",
|
||||
2 => "t1.gramaje",
|
||||
3 => "t2.nombre",
|
||||
1 => "t2.nombre",
|
||||
2 => "t1.bn",
|
||||
3 => "t1.gramaje",
|
||||
4 => "t1.color",
|
||||
5 => "t1.cubierta",
|
||||
6 => "t1.sobrecubierta",
|
||||
7 => "t1.rotativa",
|
||||
8 => "t1.isActivo",
|
||||
|
||||
|
||||
/*1 => "t1.id",
|
||||
2 => "t1.papel_generico_id",
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
<?php if($papelImpresion->rotativa == true): ?>
|
||||
|
||||
<?php if(str_contains($formAction,'edit') && $papelImpresion->rotativa == true): ?>
|
||||
<div class="accordion mt-3" id="accordionTipologias">
|
||||
<?php else: ?>
|
||||
<div class="accordion mt-3" id="accordionTipologias" style="display:none">
|
||||
@ -64,9 +64,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="accordion mt-3" id="accordionMaquinas">
|
||||
<div class="card accordion-item">
|
||||
@ -213,47 +211,50 @@
|
||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
||||
</div>`;
|
||||
};
|
||||
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
|
||||
theTable = $('#tableOfPapelimpresiontipologias').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5],
|
||||
pageLength: 5,
|
||||
lengthChange: false,
|
||||
searching: false,
|
||||
//paging: false,
|
||||
info: false,
|
||||
"dom": 'lrt',
|
||||
stateSave: true,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfPapelesImpresion') ?>',
|
||||
data: {
|
||||
id_PI: id,
|
||||
|
||||
theTable = $('#tableOfPapelimpresiontipologias').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5],
|
||||
pageLength: 5,
|
||||
lengthChange: false,
|
||||
searching: false,
|
||||
//paging: false,
|
||||
info: false,
|
||||
"dom": 'lrt',
|
||||
stateSave: true,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns : [
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'negro' },
|
||||
{ 'data': 'cyan' },
|
||||
{ 'data': 'magenta' },
|
||||
{ 'data': 'amarillo' },
|
||||
{ 'data': 'gota_negro' },
|
||||
{ 'data': 'gota_color' },
|
||||
{ data: actionBtns}
|
||||
]
|
||||
});
|
||||
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfPapelesImpresion') ?>',
|
||||
data: {
|
||||
id_PI: id,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns : [
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'negro' },
|
||||
{ 'data': 'cyan' },
|
||||
{ 'data': 'magenta' },
|
||||
{ 'data': 'amarillo' },
|
||||
{ 'data': 'gota_negro' },
|
||||
{ 'data': 'gota_color' },
|
||||
{ data: actionBtns}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// Add new tipología
|
||||
$('#newTipologia').on("click", function(e) {
|
||||
if ($('#tableOfPapelimpresiontipologias').DataTable().data().count() >= 3){
|
||||
@ -456,11 +457,11 @@
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
icon: 'success',
|
||||
title: data.msg ?? jqXHR.statusText,
|
||||
});
|
||||
|
||||
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [3, 4, 5, 6, 7, lastColNr] //JJO añadidas bool cols
|
||||
targets: [lastColNr] //JJO añadidas bool cols
|
||||
}
|
||||
],
|
||||
columns : [
|
||||
|
||||
Reference in New Issue
Block a user