Commit 43abf64ed63c2617518cdee2845e5219a4400264

Authored by Yarik
1 parent 84988426

test

common/models/VacancySearch.php
... ... @@ -13,6 +13,8 @@
13 13 class VacancySearch extends Vacancy
14 14 {
15 15  
  16 + public $date_add_from;
  17 + public $date_add_to;
16 18 /**
17 19 * @inheritdoc
18 20 */
... ... @@ -35,9 +37,25 @@
35 37 'user_name',
36 38 'city',
37 39 'description',
  40 + 'date_add_from',
  41 + 'date_add_to',
38 42 ],
39 43 'safe',
40 44 ],
  45 + [
  46 + [
  47 + 'date_add_from',
  48 + ],
  49 + 'default',
  50 + 'value' => date('Y-m-d', 0),
  51 + ],
  52 + [
  53 + [
  54 + 'date_add_to',
  55 + ],
  56 + 'default',
  57 + 'value' => date('Y-m-d'),
  58 + ],
41 59 ];
42 60 }
43 61  
... ... @@ -86,6 +104,13 @@
86 104 ]);
87 105  
88 106 $query->andFilterWhere([
  107 + 'between',
  108 + 'date_add',
  109 + $this->date_add_from,
  110 + $this->date_add_to,
  111 + ]);
  112 +
  113 + $query->andFilterWhere([
89 114 'like',
90 115 'name',
91 116 $this->name,
... ...
frontend/views/accounts/vacancy.php
... ... @@ -8,6 +8,7 @@
8 8 use yii\grid\ActionColumn;
9 9 use yii\grid\GridView;
10 10 use yii\helpers\Html;
  11 + use yii\jui\DatePicker;
11 12  
12 13 $this->title = 'Вакансии';
13 14 $this->params[ 'breadcrumbs' ][] = $this->title;
... ... @@ -26,6 +27,39 @@
26 27 'label' => 'ID',
27 28 ],
28 29 'name',
  30 + [
  31 + 'attribute' => 'date_add',
  32 + 'filter' => "<div class=\"input-group input-group-xs input-daterange\">
  33 +<span class='field-teamsearch-experience_from_from'>".
  34 + DatePicker::widget([
  35 + 'model' => $searchModel,
  36 + 'attribute' => 'date_add_from',
  37 + 'language' => 'ru',
  38 + 'dateFormat' => 'yyyy-MM-dd',
  39 + 'clientOptions' => [
  40 + 'changeYear' => true,
  41 + 'changeMonth' => true,
  42 + ],
  43 + ]).
  44 + "</span>
  45 +<span class=\"input-group-addon kv-field-separator\">
  46 +<i class=\"glyphicon glyphicon-resize-horizontal\"></i>
  47 +</span>
  48 +<span class='field-teamsearch-experience_from_to'>".
  49 + DatePicker::widget([
  50 + 'model' => $searchModel,
  51 + 'attribute' => 'date_add_to',
  52 + 'language' => 'ru',
  53 + 'dateFormat' => 'yyyy-MM-dd',
  54 + 'clientOptions' => [
  55 + 'changeYear' => true,
  56 + 'changeMonth' => true,
  57 + ],
  58 + ])
  59 + ."</span>
  60 +</div>",
  61 + 'format' => 'html',
  62 + ],
29 63 'view_count',
30 64 [
31 65 'class' => ActionColumn::className(),
... ...