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( return $this->respond(Collection::datatable(
$resourceData, $resourceData,
$this->model->getListaPresupuestosCliente("", $clienteId)->countAllResults(), $this->model->getListaPresupuestosCliente([], $clienteId)->countAllResults(),
$this->model->getListaPresupuestosCliente($search, $clienteId)->countAllResults() $this->model->getListaPresupuestosCliente($searchValues, $clienteId)->countAllResults()
)); ));
} else { } else {
return $this->failUnauthorized('Invalid request', 403); return $this->failUnauthorized('Invalid request', 403);

View File

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

View File

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