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()
|
public function getSelect2()
|
||||||
{
|
{
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
$searchStr = goSanitize($this->request->getGet('searchTerm'))[0];
|
$query = $this->model->builder()->select(
|
||||||
$reqId = goSanitize($this->request->getGet('id'))[0];
|
[
|
||||||
$reqText = goSanitize($this->request->getGet('text'))[0];
|
"id",
|
||||||
$onlyActiveOnes = false;
|
"nombre as name"
|
||||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
]
|
||||||
$onlyActiveOnes = false;
|
)->where("deleted_at", null);
|
||||||
try{
|
|
||||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
if ($this->request->getGet("q")) {
|
||||||
|
$query->groupStart()
|
||||||
|
->orLike("clientes.nombre", $this->request->getGet("q"))
|
||||||
|
->groupEnd();
|
||||||
}
|
}
|
||||||
catch(Exception $e){
|
|
||||||
$menu = [];
|
return $this->response->setJSON($query->get()->getResultObject());
|
||||||
}
|
// return $this->respond($menu);
|
||||||
|
|
||||||
$menu,
|
|
||||||
return $this->respond($menu);
|
|
||||||
} else {
|
} else {
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user