ya se filtra bien

This commit is contained in:
2024-06-07 16:47:11 +02:00
parent aac17468c3
commit 38abbe22a7
3 changed files with 18 additions and 14 deletions

View File

@ -308,8 +308,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getListaPresupuestosCliente("", $clienteId)->countAllResults(),
$this->model->getListaPresupuestosCliente($search, $clienteId)->countAllResults()
$this->model->getListaPresupuestosCliente([], $clienteId)->countAllResults(),
$this->model->getListaPresupuestosCliente($searchValues, $clienteId)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);

View File

@ -32,16 +32,14 @@ class PresupuestoModel extends \App\Models\BaseModel
const SORTABLE_CLIENTE = [
0 => "t1.id",
1 => "t1.created_at",
1 => "t1.updated_at",
2 => "t7.codigo",
3 => "t2.nombre",
4 => "t3.first_name",
5 => "t1.titulo",
6 => "t5.nombre",
8 => "t1.paginas",
9 => "t1.tirada",
10 => "t1.total_presupuesto",
11 => "t6.estado",
4 => "t1.titulo",
5 => "t1.paginas",
6 => "t1.tirada",
7 => "t1.total_presupuesto",
8 => "t6.id",
];
protected $allowedFields = [

View File

@ -211,7 +211,13 @@ theTable = $('#tableOfPresupuestos').DataTable({
orderable: false,
searchable: false,
targets: [lastColNr]
}
},
<?php if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')): ?>
{
target: 3,
visible: false
}
<?php endif; ?>
],
columns : [
@ -264,9 +270,9 @@ theTable = $('#tableOfPresupuestos').DataTable({
}
},
},
<?php if ($clienteId == 0): ?>
{ 'data': 'cliente' },
<?php endif; ?>
{ 'data': 'cliente'},
{ 'data': 'titulo' },
{ 'data': 'paginas' },
{ 'data': 'tirada' },