Commit 490cf8620332d2021a23eb241137e909249173d8

Authored by Dima
2 parents 1a9db8d9 1b590868

Merge remote-tracking branch 'origin/master' into master_new

src/app/backend/controllers/CustomersController.php
@@ -18,9 +18,10 @@ class CustomersController extends \Phalcon\Mvc\Controller @@ -18,9 +18,10 @@ class CustomersController extends \Phalcon\Mvc\Controller
18 18
19 $search_name = $this->request->getPost('search_name', 'string', NULL); 19 $search_name = $this->request->getPost('search_name', 'string', NULL);
20 $search_phone = $this->request->getPost('search_phone', 'string', NULL); 20 $search_phone = $this->request->getPost('search_phone', 'string', NULL);
  21 + $search_submit = $this->request->getPost('search_submit', 'string', NULL);
21 $this->session->set('search_name', $search_name); 22 $this->session->set('search_name', $search_name);
22 $this->session->set('search_phone', $search_phone); 23 $this->session->set('search_phone', $search_phone);
23 - if (!empty($search_name) && !empty($search_phone)) { 24 + if (!empty($search_name) && (!empty($search_phone) || $search_phone == '0')) {
24 $data = $this->models->getCustomers()->getDataByNameAndPhone($search_name, $search_phone); 25 $data = $this->models->getCustomers()->getDataByNameAndPhone($search_name, $search_phone);
25 $total = 1; 26 $total = 1;
26 } 27 }
@@ -28,15 +29,19 @@ class CustomersController extends \Phalcon\Mvc\Controller @@ -28,15 +29,19 @@ class CustomersController extends \Phalcon\Mvc\Controller
28 $data = $this->models->getCustomers()->getDataByName($search_name); 29 $data = $this->models->getCustomers()->getDataByName($search_name);
29 $total = 1; 30 $total = 1;
30 } 31 }
31 - elseif(!empty($search_phone)) { 32 + elseif(!empty($search_phone) || $search_phone == '0') {
32 $data = $this->models->getCustomers()->getDataByPhone($search_phone); 33 $data = $this->models->getCustomers()->getDataByPhone($search_phone);
33 $total = 1; 34 $total = 1;
34 } 35 }
35 - else { 36 + elseif (isset($search_submit)) {
36 $this->flash->notice("Параметры поиска не указаны"); 37 $this->flash->notice("Параметры поиска не указаны");
37 $data = $this->models->getCustomers()->getAllData($page); 38 $data = $this->models->getCustomers()->getAllData($page);
38 $total = $this->models->getCustomers()->countData(); 39 $total = $this->models->getCustomers()->countData();
39 } 40 }
  41 + else {
  42 + $data = $this->models->getCustomers()->getAllData($page);
  43 + $total = $this->models->getCustomers()->countData();
  44 + }
40 45
41 if( $total['0']['total'] > \config::get( 'limits/items') ) 46 if( $total['0']['total'] > \config::get( 'limits/items') )
42 { 47 {
src/app/backend/views/customers/index.php
@@ -13,9 +13,9 @@ @@ -13,9 +13,9 @@
13 <div class="table_name header_gradient">Пользователи</div> 13 <div class="table_name header_gradient">Пользователи</div>
14 <div class="table_add_page"><a href="<?= $this->url->get([ 'for' => 'customers_add' ]) ?>" title="Добавить">Добавить</a></div> 14 <div class="table_add_page"><a href="<?= $this->url->get([ 'for' => 'customers_add' ]) ?>" title="Добавить">Добавить</a></div>
15 <form method="post" action="" style="margin:10px;"> 15 <form method="post" action="" style="margin:10px;">
16 - <input type="text" name="search_name" placeholder="поиск по имени" value="<?= $this->session->get('search_name'); ?>" /> 16 + <input type="text" name="search_name" size="50" placeholder="поиск по имени" value="<?= $this->session->get('search_name'); ?>" />
17 <input type="text" name="search_phone" placeholder="поиск по телефону" value="<?= $this->session->get('search_phone'); ?>" /> 17 <input type="text" name="search_phone" placeholder="поиск по телефону" value="<?= $this->session->get('search_phone'); ?>" />
18 - <input type="submit" value="Поиск" /> 18 + <input type="submit" name="search_submit" value="Поиск" />
19 </form> 19 </form>
20 <div class="table_pages_wrapper"> 20 <div class="table_pages_wrapper">
21 21