mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Arreglando filtrado
This commit is contained in:
@ -245,13 +245,15 @@ class Pedido extends \App\Controllers\BaseResourceController
|
|||||||
$estado = $reqData['estado'] ?? 'todos';
|
$estado = $reqData['estado'] ?? 'todos';
|
||||||
if($estado == 'todos') $estado = '';
|
if($estado == 'todos') $estado = '';
|
||||||
|
|
||||||
|
$searchValues = get_filter_datatables_columns($reqData);
|
||||||
|
|
||||||
$model_linea = model('\App\Models\Pedidos\PedidoLineaModel');
|
$model_linea = model('\App\Models\Pedidos\PedidoLineaModel');
|
||||||
$resourceData = $model_linea->getResource($search, $estado)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
$resourceData = $model_linea->getResource($searchValues, $estado)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||||
|
|
||||||
return $this->respond(Collection::datatable(
|
return $this->respond(Collection::datatable(
|
||||||
$resourceData,
|
$resourceData,
|
||||||
$model_linea->getResource("", $estado)->countAllResults(),
|
$model_linea->getResource("", $estado)->countAllResults(),
|
||||||
$model_linea->getResource($search, $estado)->countAllResults()
|
$model_linea->getResource($searchValues, $estado)->countAllResults()
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class Buscador extends \App\Controllers\BaseResourceController
|
|||||||
return $this->respond(Collection::datatable(
|
return $this->respond(Collection::datatable(
|
||||||
$resourceData,
|
$resourceData,
|
||||||
$this->model->getResource("")->countAllResults(),
|
$this->model->getResource("")->countAllResults(),
|
||||||
$this->model->getResource($search)->countAllResults()
|
$this->model->getResource($searchValues)->countAllResults()
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th><?= lang('Pedidos.id') ?></th>
|
<th><?= lang('Pedidos.id') ?></th>
|
||||||
<th><?= lang('Pedidos.fecha') ?></th>
|
<th><?= lang('Pedidos.fecha') ?></th>
|
||||||
<th><?= lang('Pedidos.fecha_entrega') ?></th>
|
<th class='noFilter'><?= lang('Pedidos.fecha_entrega') ?></th>
|
||||||
<th><?= lang('Pedidos.cliente') ?></th>
|
<th><?= lang('Pedidos.cliente') ?></th>
|
||||||
<th><?= lang('Pedidos.comercial') ?></th>
|
<th><?= lang('Pedidos.comercial') ?></th>
|
||||||
<th><?= lang('Pedidos.titulo') ?></th>
|
<th><?= lang('Pedidos.titulo') ?></th>
|
||||||
@ -125,10 +125,13 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
theTable = $('#tableOfPedidos').DataTable({
|
theTable = $('#tableOfPedidos').DataTable({
|
||||||
|
orderCellsTop: true,
|
||||||
|
fixedHeader: true,
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
autoWidth: true,
|
autoWidth: true,
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
searching: true,
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||||
pageLength: 50,
|
pageLength: 50,
|
||||||
@ -141,7 +144,7 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
|||||||
pageSize: 'A4'
|
pageSize: 'A4'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
stateSave: true,
|
stateSave: false,
|
||||||
order: [[0, 'asc']],
|
order: [[0, 'asc']],
|
||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
@ -158,7 +161,7 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
|||||||
columnDefs: [
|
columnDefs: [
|
||||||
{
|
{
|
||||||
orderable: false,
|
orderable: false,
|
||||||
searchable: false,
|
searchable: true,
|
||||||
targets: [lastColNr]
|
targets: [lastColNr]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -209,14 +212,14 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
theTable.on( 'draw.dt', function () {
|
theTable.on( 'draw.dt', function () {
|
||||||
const boolCols = [];
|
//const boolCols = [];
|
||||||
const dateCols = [1];
|
const dateCols = [1];
|
||||||
const priceCols = [10];
|
const priceCols = [10];
|
||||||
for (let coln of boolCols) {
|
/*for (let coln of boolCols) {
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
for (let coln of dateCols) {
|
for (let coln of dateCols) {
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user