mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el selector de cliente
This commit is contained in:
@ -333,21 +333,21 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getGet('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getGet('id'))[0];
|
||||
$reqText = goSanitize($this->request->getGet('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
try{
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null);
|
||||
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("clientes.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
catch(Exception $e){
|
||||
$menu = [];
|
||||
}
|
||||
|
||||
$menu,
|
||||
return $this->respond($menu);
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
// return $this->respond($menu);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user