diff --git a/src/app/backend/controllers/CustomersController.php b/src/app/backend/controllers/CustomersController.php index 0884bff..b5824a1 100644 --- a/src/app/backend/controllers/CustomersController.php +++ b/src/app/backend/controllers/CustomersController.php @@ -16,9 +16,14 @@ class CustomersController extends \Phalcon\Mvc\Controller $params = $this->dispatcher->getParams(); $page = !empty( $params['page'] ) ? $params['page'] : 1; - $search = $this->request->getPost('search', 'string', NULL); - if (!empty($search)) { - $data = $this->models->getCustomers()->getDataByName($search); + $search_name = $this->request->getPost('search_name', 'string', NULL); + $search_phone = $this->request->getPost('search_phone', 'int', NULL); + if (!empty($search_name)) { + $data = $this->models->getCustomers()->getDataByName($search_name); + $total = 1; + } + elseif(!empty($search_phone)) { + $data = $this->models->getCustomers()->getDataByPhone($search_phone); $total = 1; } else { diff --git a/src/app/backend/views/customers/index.php b/src/app/backend/views/customers/index.php index 524965f..ae736f7 100644 --- a/src/app/backend/views/customers/index.php +++ b/src/app/backend/views/customers/index.php @@ -13,7 +13,8 @@
Пользователи
Добавить
- + +
diff --git a/src/lib/models/customers.php b/src/lib/models/customers.php index dfcbef5..c41cdea 100644 --- a/src/lib/models/customers.php +++ b/src/lib/models/customers.php @@ -1306,6 +1306,23 @@ class customers extends \db } + public function getDataByPhone($like) { + + return $this->get( + ' + SELECT * FROM + public.customers + WHERE + phone LIKE \'%'.$like.'%\' + ' + , + [ + ], + -1 + ); + + } + } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file -- libgit2 0.21.4