diff --git a/common/models/VacancySearch.php b/common/models/VacancySearch.php index 78b6ee3..d567644 100644 --- a/common/models/VacancySearch.php +++ b/common/models/VacancySearch.php @@ -13,6 +13,8 @@ class VacancySearch extends Vacancy { + public $date_add_from; + public $date_add_to; /** * @inheritdoc */ @@ -35,9 +37,25 @@ 'user_name', 'city', 'description', + 'date_add_from', + 'date_add_to', ], 'safe', ], + [ + [ + 'date_add_from', + ], + 'default', + 'value' => date('Y-m-d', 0), + ], + [ + [ + 'date_add_to', + ], + 'default', + 'value' => date('Y-m-d'), + ], ]; } @@ -86,6 +104,13 @@ ]); $query->andFilterWhere([ + 'between', + 'date_add', + $this->date_add_from, + $this->date_add_to, + ]); + + $query->andFilterWhere([ 'like', 'name', $this->name, diff --git a/frontend/views/accounts/vacancy.php b/frontend/views/accounts/vacancy.php index 13f2478..4e819d7 100644 --- a/frontend/views/accounts/vacancy.php +++ b/frontend/views/accounts/vacancy.php @@ -8,6 +8,7 @@ use yii\grid\ActionColumn; use yii\grid\GridView; use yii\helpers\Html; + use yii\jui\DatePicker; $this->title = 'Вакансии'; $this->params[ 'breadcrumbs' ][] = $this->title; @@ -26,6 +27,39 @@ 'label' => 'ID', ], 'name', + [ + 'attribute' => 'date_add', + 'filter' => "
+". + DatePicker::widget([ + 'model' => $searchModel, + 'attribute' => 'date_add_from', + 'language' => 'ru', + 'dateFormat' => 'yyyy-MM-dd', + 'clientOptions' => [ + 'changeYear' => true, + 'changeMonth' => true, + ], + ]). + " + + + +". + DatePicker::widget([ + 'model' => $searchModel, + 'attribute' => 'date_add_to', + 'language' => 'ru', + 'dateFormat' => 'yyyy-MM-dd', + 'clientOptions' => [ + 'changeYear' => true, + 'changeMonth' => true, + ], + ]) + ." +
", + 'format' => 'html', + ], 'view_count', [ 'class' => ActionColumn::className(), -- libgit2 0.21.4