Commit e4a014b8984be64f35fa8989694833914b5a7eb9
1 parent
df1b36d6
test
Showing
5 changed files
with
113 additions
and
101 deletions
Show diff stats
common/models/TeamSearch.php
| ... | ... | @@ -202,31 +202,31 @@ |
| 202 | 202 | ]) |
| 203 | 203 | ->andFilterWhere([ |
| 204 | 204 | 'like', |
| 205 | - 'country_id', | |
| 206 | - $this->country_id, | |
| 205 | + 'LOWER(country_id)', | |
| 206 | + mb_strtolower($this->country_id), | |
| 207 | 207 | ]) |
| 208 | 208 | ->andFilterWhere([ |
| 209 | 209 | 'or', |
| 210 | 210 | [ |
| 211 | 211 | 'like', |
| 212 | - 'lastname', | |
| 213 | - $this->user, | |
| 212 | + 'LOWER(lastname)', | |
| 213 | + mb_strtolower($this->user), | |
| 214 | 214 | ], |
| 215 | 215 | [ |
| 216 | 216 | 'like', |
| 217 | - 'firstname', | |
| 218 | - $this->user, | |
| 217 | + 'LOWER(firstname)', | |
| 218 | + mb_strtolower($this->user), | |
| 219 | 219 | ], |
| 220 | 220 | [ |
| 221 | 221 | 'like', |
| 222 | - 'middlename', | |
| 223 | - $this->user, | |
| 222 | + 'LOWER(middlename)', | |
| 223 | + mb_strtolower($this->user), | |
| 224 | 224 | ], |
| 225 | 225 | ]) |
| 226 | 226 | ->andFilterWhere([ |
| 227 | 227 | 'like', |
| 228 | - 'department.name', | |
| 229 | - $this->department, | |
| 228 | + 'LOWER(department.name)', | |
| 229 | + mb_strtolower($this->department), | |
| 230 | 230 | ]); |
| 231 | 231 | |
| 232 | 232 | return $dataProvider; | ... | ... |
frontend/controllers/AccountsController.php
| ... | ... | @@ -183,7 +183,7 @@ |
| 183 | 183 | $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); |
| 184 | 184 | } |
| 185 | 185 | if(!empty( \Yii::$app->request->post() )) { |
| 186 | - if(!empty(Yii::$app->request->post('Fields'))) { | |
| 186 | + if(!empty( Yii::$app->request->post('Fields') )) { | |
| 187 | 187 | Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); |
| 188 | 188 | } |
| 189 | 189 | $user_info->load(\Yii::$app->request->post()); |
| ... | ... | @@ -519,7 +519,7 @@ |
| 519 | 519 | $portfolio->save(); |
| 520 | 520 | $portfolio->unlinkAll('specializations', true); |
| 521 | 521 | foreach($portfolio->specializationInput as $one_specialization) { |
| 522 | - $portfolio->link('specializations', Specialization::findOne($one_specialization)); | |
| 522 | + $portfolio->link('specializations', Specialization::findOne($one_specialization)); | |
| 523 | 523 | } |
| 524 | 524 | return $this->redirect('portfolio'); |
| 525 | 525 | } |
| ... | ... | @@ -843,10 +843,19 @@ |
| 843 | 843 | { |
| 844 | 844 | $searchModel = new TeamSearch(); |
| 845 | 845 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
| 846 | + $departments = Department::find() | |
| 847 | + ->select([ | |
| 848 | + 'name', | |
| 849 | + 'department_id', | |
| 850 | + ]) | |
| 851 | + ->indexBy('department_id') | |
| 852 | + ->asArray() | |
| 853 | + ->column(); | |
| 846 | 854 | |
| 847 | 855 | return $this->render('team', [ |
| 848 | 856 | 'searchModel' => $searchModel, |
| 849 | 857 | 'dataProvider' => $dataProvider, |
| 858 | + 'departments' => $departments, | |
| 850 | 859 | ]); |
| 851 | 860 | } |
| 852 | 861 | |
| ... | ... | @@ -873,8 +882,7 @@ |
| 873 | 882 | $post = \Yii::$app->request->post(); |
| 874 | 883 | if($team->load($post) && $team->save()) { |
| 875 | 884 | return $this->redirect([ |
| 876 | - 'team-update', | |
| 877 | - 'id' => $team->team_id, | |
| 885 | + 'team', | |
| 878 | 886 | ]); |
| 879 | 887 | } else { |
| 880 | 888 | return $this->render('_team_form', [ |
| ... | ... | @@ -918,8 +926,7 @@ |
| 918 | 926 | $post = \Yii::$app->request->post(); |
| 919 | 927 | if($team->load($post) && $team->save()) { |
| 920 | 928 | return $this->redirect([ |
| 921 | - 'team-update', | |
| 922 | - 'id' => $team->team_id, | |
| 929 | + 'team', | |
| 923 | 930 | ]); |
| 924 | 931 | } else { |
| 925 | 932 | return $this->render('_team_form', [ |
| ... | ... | @@ -991,7 +998,7 @@ |
| 991 | 998 | if(!empty( $post )) { |
| 992 | 999 | $vacancy->load($post); |
| 993 | 1000 | $vacancy->validate(); |
| 994 | - if(empty($vacancy->specializationInput)) { | |
| 1001 | + if(empty( $vacancy->specializationInput )) { | |
| 995 | 1002 | $vacancy->addError('specializationInput', 'Cannot be blank'); |
| 996 | 1003 | } else { |
| 997 | 1004 | $vacancy->clearErrors('specializationInput'); |
| ... | ... | @@ -1055,7 +1062,7 @@ |
| 1055 | 1062 | if(!empty( $post )) { |
| 1056 | 1063 | $vacancy->load($post); |
| 1057 | 1064 | $vacancy->validate(); |
| 1058 | - if(empty($vacancy->specializationInput)) { | |
| 1065 | + if(empty( $vacancy->specializationInput )) { | |
| 1059 | 1066 | $vacancy->addError('specializationInput', 'Cannot be blank'); |
| 1060 | 1067 | } else { |
| 1061 | 1068 | $vacancy->clearErrors('specializationInput'); | ... | ... |
frontend/views/accounts/_portfolio_form.php
| ... | ... | @@ -5,15 +5,15 @@ |
| 5 | 5 | */ |
| 6 | 6 | use common\models\Option; |
| 7 | 7 | use common\models\Portfolio; |
| 8 | -use common\models\Specialization; | |
| 9 | -use common\widgets\ImageUploader; | |
| 8 | + use common\models\Specialization; | |
| 9 | + use common\widgets\ImageUploader; | |
| 10 | 10 | use mihaildev\ckeditor\CKEditor; |
| 11 | -use yii\helpers\ArrayHelper; | |
| 12 | -use yii\helpers\Html; | |
| 11 | + use yii\helpers\ArrayHelper; | |
| 12 | + use yii\helpers\Html; | |
| 13 | 13 | use yii\widgets\ActiveForm; |
| 14 | 14 | use \common\widgets\MultiLangForm; |
| 15 | -use kartik\select2\Select2; | |
| 16 | -use yii\web\JsExpression; | |
| 15 | + use kartik\select2\Select2; | |
| 16 | + use yii\web\JsExpression; | |
| 17 | 17 | |
| 18 | 18 | $this->title = 'Портфолио'; |
| 19 | 19 | $this->params[ 'breadcrumbs' ][] = $this->title; |
| ... | ... | @@ -24,7 +24,7 @@ use yii\web\JsExpression; |
| 24 | 24 | $form = ActiveForm::begin(); |
| 25 | 25 | ?> |
| 26 | 26 | <div class="input-blocks-wrapper full-blocks data-block"> |
| 27 | - <?= !empty($portfolio->date_add) ? "Дата создания: $portfolio->date_add" :""?> | |
| 27 | + <?= !empty( $portfolio->date_add ) ? "Дата создания: $portfolio->date_add" : "" ?> | |
| 28 | 28 | |
| 29 | 29 | </div> |
| 30 | 30 | <div class="style"> |
| ... | ... | @@ -32,14 +32,14 @@ use yii\web\JsExpression; |
| 32 | 32 | <div class="input-blocks-wrapper"> |
| 33 | 33 | <div class="input-blocks"> |
| 34 | 34 | <?= $form->field($portfolio, 'name') |
| 35 | - ->textInput (['class'=> 'custom-input-2 fix-input-2']); ?> | |
| 35 | + ->textInput([ 'class' => 'custom-input-2 fix-input-2' ]); ?> | |
| 36 | 36 | </div> |
| 37 | 37 | </div> |
| 38 | 38 | |
| 39 | 39 | <div class="input-blocks-wrapper"> |
| 40 | 40 | <div class="input-blocks"> |
| 41 | 41 | <?= $form->field($portfolio, 'link') |
| 42 | - ->textInput (['class'=> 'custom-input-2 fix-input-2']); ?> | |
| 42 | + ->textInput([ 'class' => 'custom-input-2 fix-input-2' ]); ?> | |
| 43 | 43 | </div> |
| 44 | 44 | </div> |
| 45 | 45 | |
| ... | ... | @@ -62,13 +62,13 @@ use yii\web\JsExpression; |
| 62 | 62 | <?= $form->field($portfolio, "specializationInput[{$child_second->specialization_id}]", [ |
| 63 | 63 | 'template' => '{input}{label}{hint}{error}', |
| 64 | 64 | ]) |
| 65 | - ->label('<span></span>' . $child_second->specialization_name) | |
| 66 | - ->checkbox([ | |
| 67 | - 'value' => $child_second->specialization_id, | |
| 68 | - 'label' => NULL, | |
| 69 | - 'uncheck' => NULL, | |
| 70 | - 'class' => 'custom-check', | |
| 71 | - ], false) ?> | |
| 65 | + ->label('<span></span>' . $child_second->specialization_name) | |
| 66 | + ->checkbox([ | |
| 67 | + 'value' => $child_second->specialization_id, | |
| 68 | + 'label' => NULL, | |
| 69 | + 'uncheck' => NULL, | |
| 70 | + 'class' => 'custom-check', | |
| 71 | + ], false) ?> | |
| 72 | 72 | </a> |
| 73 | 73 | </li> |
| 74 | 74 | <?php endif; ?> |
| ... | ... | @@ -85,65 +85,60 @@ use yii\web\JsExpression; |
| 85 | 85 | </div> |
| 86 | 86 | |
| 87 | 87 | |
| 88 | - | |
| 89 | 88 | <div class="input-blocks-wrapper admin-avatar portfolio-foto-admin hidden-foto foto-portfolio-adm"> |
| 90 | 89 | <div class="gen-admin-title">Фото главное</div> |
| 91 | 90 | <div class="not-file-txt-adm">Файл не выбран</div> |
| 92 | 91 | <?= ImageUploader::widget([ |
| 93 | - 'model'=> $portfolio, | |
| 94 | - 'field'=>'cover', | |
| 95 | - 'width'=>210, | |
| 96 | - 'height'=>150, | |
| 97 | - 'multi'=>false, | |
| 98 | - 'gallery' =>$portfolio->cover, | |
| 99 | - 'name' => 'Загрузить' | |
| 100 | - ]); | |
| 101 | - ?> | |
| 92 | + 'model' => $portfolio, | |
| 93 | + 'field' => 'cover', | |
| 94 | + 'width' => 210, | |
| 95 | + 'height' => 150, | |
| 96 | + 'multi' => false, | |
| 97 | + 'gallery' => $portfolio->cover, | |
| 98 | + 'name' => 'Загрузить', | |
| 99 | + ]); ?> | |
| 102 | 100 | <div class="not-file-mb-adm">До 3 Мб файл</div> |
| 103 | 101 | </div> |
| 104 | 102 | |
| 105 | 103 | <div class="input-blocks-wrapper"> |
| 106 | 104 | <div class="input-blocks"> |
| 107 | - <?= | |
| 108 | - $form->field($portfolio, 'city')->widget(Select2::classname(), [ | |
| 109 | - 'options' => ['class' => 'Выбор города ...'], | |
| 110 | - 'pluginOptions' => [ | |
| 111 | - 'allowClear' => true, | |
| 112 | - 'minimumInputLength' => 3, | |
| 113 | - 'ajax' => [ | |
| 114 | - 'url' => \yii\helpers\Url::to(['site/city']), | |
| 115 | - 'dataType' => 'json', | |
| 116 | - 'data' => new JsExpression('function(params) { return {q:params.term}; }') | |
| 117 | - ], | |
| 118 | - 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), | |
| 119 | - 'templateResult' => new JsExpression('function(city) { return city.text; }'), | |
| 120 | - 'templateSelection' => new JsExpression('function (city) { return city.text; }'), | |
| 121 | - ], | |
| 122 | - ]); | |
| 123 | - ?> | |
| 105 | + <?= $form->field($portfolio, 'city') | |
| 106 | + ->widget(Select2::classname(), [ | |
| 107 | + 'options' => [ 'class' => 'Выбор города ...' ], | |
| 108 | + 'pluginOptions' => [ | |
| 109 | + 'allowClear' => true, | |
| 110 | + 'minimumInputLength' => 3, | |
| 111 | + 'ajax' => [ | |
| 112 | + 'url' => \yii\helpers\Url::to([ 'site/city' ]), | |
| 113 | + 'dataType' => 'json', | |
| 114 | + 'data' => new JsExpression('function(params) { return {q:params.term}; }'), | |
| 115 | + ], | |
| 116 | + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), | |
| 117 | + 'templateResult' => new JsExpression('function(city) { return city.text; }'), | |
| 118 | + 'templateSelection' => new JsExpression('function (city) { return city.text; }'), | |
| 119 | + ], | |
| 120 | + ]); ?> | |
| 124 | 121 | |
| 125 | 122 | </div> |
| 126 | 123 | |
| 127 | 124 | <div class="input-blocks street-input"> |
| 128 | - <?= $form->field ($portfolio, 'street', ['options' => ['class' => 'form-group company_info']]) | |
| 129 | - ->label ('Улица') | |
| 130 | - ->textInput (['class'=> 'custom-input-2']); | |
| 131 | - ?> | |
| 125 | + <?= $form->field($portfolio, 'street', [ 'options' => [ 'class' => 'form-group company_info' ] ]) | |
| 126 | + ->label('Улица') | |
| 127 | + ->textInput([ 'class' => 'custom-input-2' ]); ?> | |
| 132 | 128 | </div> |
| 133 | 129 | |
| 134 | 130 | <div class="input-blocks home-input"> |
| 135 | - <?= $form->field ($portfolio, 'house', ['options' => ['class' => 'form-group company_info']]) | |
| 136 | - ->label ('Дом') | |
| 137 | - ->textInput (['class'=> 'custom-input-2']); | |
| 138 | - ?> | |
| 131 | + <?= $form->field($portfolio, 'house', [ 'options' => [ 'class' => 'form-group company_info' ] ]) | |
| 132 | + ->label('Дом') | |
| 133 | + ->textInput([ 'class' => 'custom-input-2' ]); ?> | |
| 139 | 134 | </div> |
| 140 | 135 | </div> |
| 141 | 136 | |
| 142 | 137 | |
| 143 | - | |
| 144 | 138 | <div class="input-blocks-wrapper full-blocks admin-editor-bl"> |
| 145 | 139 | <div class="input-blocks"> |
| 146 | - <?= $form->field($portfolio, 'description')->widget(CKEditor::className()) ?> | |
| 140 | + <?= $form->field($portfolio, 'description') | |
| 141 | + ->widget(CKEditor::className()) ?> | |
| 147 | 142 | </div> |
| 148 | 143 | </div> |
| 149 | 144 | |
| ... | ... | @@ -151,21 +146,21 @@ use yii\web\JsExpression; |
| 151 | 146 | |
| 152 | 147 | <div class="input-blocks-wrapper"> |
| 153 | 148 | <div class="admin-save-btn skills-save-btn admin-add-remove-wr style"> |
| 154 | - <?= Html::submitButton($portfolio->isNewRecord?'Добавить':'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?> | |
| 149 | + <?= Html::submitButton($portfolio->isNewRecord ? 'Добавить' : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?> | |
| 155 | 150 | <div class="admin-remove-note"> |
| 156 | 151 | <?php |
| 157 | - if(!$portfolio->isNewRecord) { | |
| 158 | - echo Html::a('Удалить', [ | |
| 159 | - 'accounts/portfolio-delete', | |
| 160 | - 'id' => $portfolio->portfolio_id, | |
| 161 | - ], [ | |
| 162 | - 'title' => 'Удалить', | |
| 163 | - 'aria-label' => 'Удалить', | |
| 164 | - 'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?', | |
| 165 | - 'data-method' => 'post', | |
| 166 | - 'data-pjax' => 0, | |
| 167 | - ]); | |
| 168 | - } | |
| 152 | + if(!$portfolio->isNewRecord) { | |
| 153 | + echo Html::a('Удалить', [ | |
| 154 | + 'accounts/portfolio-delete', | |
| 155 | + 'id' => $portfolio->portfolio_id, | |
| 156 | + ], [ | |
| 157 | + 'title' => 'Удалить', | |
| 158 | + 'aria-label' => 'Удалить', | |
| 159 | + 'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?', | |
| 160 | + 'data-method' => 'post', | |
| 161 | + 'data-pjax' => 0, | |
| 162 | + ]); | |
| 163 | + } | |
| 169 | 164 | ?> |
| 170 | 165 | </div> |
| 171 | 166 | |
| ... | ... | @@ -178,7 +173,10 @@ use yii\web\JsExpression; |
| 178 | 173 | $form->end(); |
| 179 | 174 | ?> |
| 180 | 175 | <script> |
| 181 | - $(document).ready(function(){ | |
| 176 | + $(document).ready( | |
| 177 | + function() | |
| 178 | + { | |
| 182 | 179 | |
| 183 | - }) | |
| 180 | + } | |
| 181 | + ) | |
| 184 | 182 | </script> | ... | ... |
frontend/views/accounts/team.php
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | /** |
| 3 | 3 | * @var TeamSearch $searchModel |
| 4 | 4 | * @var ActiveDataProvider $dataProvider |
| 5 | + * @var string[] $departments | |
| 5 | 6 | */ |
| 6 | 7 | use common\models\TeamSearch; |
| 7 | 8 | use yii\data\ActiveDataProvider; |
| ... | ... | @@ -19,7 +20,7 @@ |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | <?= GridView::widget([ |
| 22 | - 'options' => ['class'=>'style admin-all-pages-wr'], | |
| 23 | + 'options' => [ 'class' => 'style admin-all-pages-wr' ], | |
| 23 | 24 | 'dataProvider' => $dataProvider, |
| 24 | 25 | 'filterModel' => $searchModel, |
| 25 | 26 | 'columns' => [ |
| ... | ... | @@ -44,7 +45,9 @@ |
| 44 | 45 | 'attribute' => 'department', |
| 45 | 46 | 'value' => 'department.name', |
| 46 | 47 | 'label' => 'Отдел компании', |
| 48 | + 'filter' => $departments, | |
| 47 | 49 | ], |
| 50 | + 'position', | |
| 48 | 51 | [ |
| 49 | 52 | 'attribute' => 'experience_from', |
| 50 | 53 | 'value' => function($model, $key, $index, $column) { |
| ... | ... | @@ -53,40 +56,43 @@ |
| 53 | 56 | 'label' => 'Опыт, лет', |
| 54 | 57 | 'filter' => "<div class=\"input-group input-group-xs input-daterange\"> |
| 55 | 58 | <span class='field-teamsearch-experience_from_from'> |
| 56 | -<input type='number' id='teamsearch-experience_from_from' class='form-control' name='TeamSearch[experience_from_from]' value='" . \Yii::$app->request->get('TeamSearch')['experience_from_from'] . "' min='0' max='" . \Yii::$app->request->get('TeamSearch')['experience_from_to'] . "'> | |
| 59 | +<input type='number' id='teamsearch-experience_from_from' class='form-control' name='TeamSearch[experience_from_from]' value='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_from' ] . "' min='0' max='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_to' ] . "'> | |
| 57 | 60 | </span> |
| 58 | 61 | <span class=\"input-group-addon kv-field-separator\"> |
| 59 | 62 | <i class=\"glyphicon glyphicon-resize-horizontal\"></i> |
| 60 | 63 | </span> |
| 61 | 64 | <span class='field-teamsearch-experience_from_to'> |
| 62 | -<input type='number' id='teamsearch-experience_from_to' class='form-control' name='TeamSearch[experience_from_to]' value='" . \Yii::$app->request->get('TeamSearch')['experience_from_to'] . "' min='" . \Yii::$app->request->get('TeamSearch')['experience_from_from'] . "' max='100'> | |
| 65 | +<input type='number' id='teamsearch-experience_from_to' class='form-control' name='TeamSearch[experience_from_to]' value='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_to' ] . "' min='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_from' ] . "' max='100'> | |
| 63 | 66 | </span> |
| 64 | 67 | </div>", |
| 65 | 68 | ], |
| 66 | - 'position', | |
| 67 | 69 | 'country_id', |
| 68 | 70 | |
| 69 | 71 | [ |
| 70 | - 'class' => 'yii\grid\ActionColumn', | |
| 71 | - 'buttons' => [ | |
| 72 | + 'class' => 'yii\grid\ActionColumn', | |
| 73 | + 'buttons' => [ | |
| 72 | 74 | 'update' => function($url, $model, $key) { |
| 73 | 75 | return Html::a('<img src="/images/ico_pencil.png" alt="">', [ |
| 74 | - 'team-update', 'id' => $model->team_id | |
| 75 | - ],[ | |
| 76 | - 'title' => 'Редактировать', | |
| 76 | + 'team-update', | |
| 77 | + 'id' => $model->team_id, | |
| 78 | + ], [ | |
| 79 | + 'title' => 'Редактировать', | |
| 77 | 80 | ]); |
| 78 | 81 | }, |
| 79 | 82 | 'delete' => function($url, $model, $key) { |
| 80 | - return Html::a('<img src="/images/delete-ico.png" alt="">', ['team-delete', 'id' => $model->team_id], [ | |
| 81 | - 'title' => 'Удалить', | |
| 82 | - 'aria-label' => 'Удалить', | |
| 83 | + return Html::a('<img src="/images/delete-ico.png" alt="">', [ | |
| 84 | + 'team-delete', | |
| 85 | + 'id' => $model->team_id, | |
| 86 | + ], [ | |
| 87 | + 'title' => 'Удалить', | |
| 88 | + 'aria-label' => 'Удалить', | |
| 83 | 89 | 'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?', |
| 84 | - 'data-method' => 'post', | |
| 85 | - 'data-pjax' => '0', | |
| 90 | + 'data-method' => 'post', | |
| 91 | + 'data-pjax' => '0', | |
| 86 | 92 | ]); |
| 87 | 93 | }, |
| 88 | 94 | ], |
| 89 | - 'template' => '{update} {delete}' | |
| 95 | + 'template' => '{update} {delete}', | |
| 90 | 96 | ], |
| 91 | 97 | ], |
| 92 | 98 | ]); ?> | ... | ... |