Commit ce4a4468117285cf58ac3713e1aa246559ba0c81
1 parent
492ed7f7
test
Showing
9 changed files
with
64 additions
and
34 deletions
Show diff stats
common/models/ProjectSearch.php
| ... | ... | @@ -91,7 +91,7 @@ |
| 91 | 91 | */ |
| 92 | 92 | public function search($params) |
| 93 | 93 | { |
| 94 | - $query = Project::find(); | |
| 94 | + $query = Project::find()->with('comments'); | |
| 95 | 95 | |
| 96 | 96 | // add conditions that should always apply here |
| 97 | 97 | |
| ... | ... | @@ -133,7 +133,6 @@ |
| 133 | 133 | 'view_count' => $this->view_count, |
| 134 | 134 | 'payment_variant' => $this->payment_variant, |
| 135 | 135 | 'deadline' => $this->deadline, |
| 136 | - 'contractual' => $this->contractual, | |
| 137 | 136 | ]); |
| 138 | 137 | |
| 139 | 138 | $query->andFilterWhere([ |
| ... | ... | @@ -153,23 +152,18 @@ |
| 153 | 152 | |
| 154 | 153 | $query->andFilterWhere([ |
| 155 | 154 | 'like', |
| 156 | - 'name', | |
| 157 | - $this->name, | |
| 155 | + 'LOWER(name)', | |
| 156 | + mb_strtolower($this->name), | |
| 158 | 157 | ]) |
| 159 | 158 | ->andFilterWhere([ |
| 160 | 159 | 'like', |
| 161 | - 'link', | |
| 162 | - $this->link, | |
| 163 | - ]) | |
| 164 | - ->andFilterWhere([ | |
| 165 | - 'like', | |
| 166 | 160 | 'budget', |
| 167 | 161 | $this->budget, |
| 168 | 162 | ]) |
| 169 | 163 | ->andFilterWhere([ |
| 170 | 164 | 'like', |
| 171 | - 'city', | |
| 172 | - $this->city, | |
| 165 | + 'LOWER(city)', | |
| 166 | + mb_strtolower($this->city), | |
| 173 | 167 | ]) |
| 174 | 168 | ->andFilterWhere([ |
| 175 | 169 | 'like', |
| ... | ... | @@ -197,6 +191,12 @@ |
| 197 | 191 | $query->andWhere(['not', ['contractual' => 1]]); |
| 198 | 192 | } |
| 199 | 193 | |
| 194 | + if($this->contractual == 1) { | |
| 195 | + $query->andWhere(['contractual' => 1]); | |
| 196 | + } elseif($this->contractual == 2) { | |
| 197 | + $query->andWhere(['not', ['contractual' => 1]]); | |
| 198 | + } | |
| 199 | + | |
| 200 | 200 | return $dataProvider; |
| 201 | 201 | } |
| 202 | 202 | } | ... | ... |
common/models/Team.php
common/models/TenderSearch.php
| ... | ... | @@ -117,7 +117,8 @@ |
| 117 | 117 | { |
| 118 | 118 | $query = Project::find() |
| 119 | 119 | ->joinWith('projectSpecializations') |
| 120 | - ->joinWith('projectPayments'); | |
| 120 | + ->joinWith('projectPayments') | |
| 121 | + ->andWhere([ 'hidden' => 0 ]); | |
| 121 | 122 | |
| 122 | 123 | $dataProvider = new ActiveDataProvider([ |
| 123 | 124 | 'query' => $query, | ... | ... |
frontend/controllers/AccountsController.php
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | 'portfolio-delete' => [ 'POST' ], |
| 71 | 71 | 'projects-delete' => [ 'POST' ], |
| 72 | 72 | 'blog-delete' => [ 'POST' ], |
| 73 | - 'gallery-cover' => [ 'POST' ], | |
| 73 | + 'gallery-cover' => [ 'POST' ], | |
| 74 | 74 | ], |
| 75 | 75 | ], |
| 76 | 76 | ]; |
| ... | ... | @@ -970,14 +970,9 @@ |
| 970 | 970 | ->column(); |
| 971 | 971 | $post = \Yii::$app->request->post(); |
| 972 | 972 | if($team->load($post) && $team->save()) { |
| 973 | - return $this->render('_team_form', [ | |
| 974 | - 'team' => $team, | |
| 975 | - 'department' => $department, | |
| 976 | - 'country' => $country, | |
| 973 | + return $this->redirect([ | |
| 974 | + 'team', | |
| 977 | 975 | ]); |
| 978 | - // return $this->redirect([ | |
| 979 | - // 'team', | |
| 980 | - // ]); | |
| 981 | 976 | } else { |
| 982 | 977 | return $this->render('_team_form', [ |
| 983 | 978 | 'team' => $team, |
| ... | ... | @@ -1179,13 +1174,15 @@ |
| 1179 | 1174 | } |
| 1180 | 1175 | } |
| 1181 | 1176 | |
| 1182 | - | |
| 1183 | 1177 | public function actionGalleryCover() |
| 1184 | 1178 | { |
| 1185 | 1179 | $gallery_id = Yii::$app->request->post('gallery_id'); |
| 1186 | 1180 | |
| 1187 | - $cover = Gallery::find()->select('cover')->where(['gallery_id'=>$gallery_id])->column(); | |
| 1188 | - die($cover[0]); | |
| 1181 | + $cover = Gallery::find() | |
| 1182 | + ->select('cover') | |
| 1183 | + ->where([ 'gallery_id' => $gallery_id ]) | |
| 1184 | + ->column(); | |
| 1185 | + die( $cover[ 0 ] ); | |
| 1189 | 1186 | |
| 1190 | 1187 | } |
| 1191 | 1188 | ... | ... |
frontend/controllers/TenderController.php
| ... | ... | @@ -52,6 +52,8 @@ |
| 52 | 52 | 'class' => \yii\filters\VerbFilter::className(), |
| 53 | 53 | 'actions' => [ |
| 54 | 54 | 'change-state' => [ 'post' ], |
| 55 | + 'offer-form' => [ 'post' ], | |
| 56 | + 'offer' => [ 'post' ], | |
| 55 | 57 | ], |
| 56 | 58 | ], |
| 57 | 59 | 'access' => [ |
| ... | ... | @@ -68,8 +70,9 @@ |
| 68 | 70 | } |
| 69 | 71 | |
| 70 | 72 | /** |
| 71 | - * Displays homepage. | |
| 72 | - * @return mixed | |
| 73 | + * Redirect to search page. | |
| 74 | + * | |
| 75 | + * @return string | |
| 73 | 76 | */ |
| 74 | 77 | public function actionIndex() |
| 75 | 78 | { |
| ... | ... | @@ -78,7 +81,13 @@ |
| 78 | 81 | |
| 79 | 82 | public function actionView($tender_id) |
| 80 | 83 | { |
| 84 | + /** | |
| 85 | + * @var Project $model | |
| 86 | + */ | |
| 81 | 87 | $model = Project::findOne($tender_id); |
| 88 | + if(!empty($model)) { | |
| 89 | + $model->updateCounters(['view_count' => 1]); | |
| 90 | + } | |
| 82 | 91 | |
| 83 | 92 | return $this->render('view', [ |
| 84 | 93 | 'model' => $model, |
| ... | ... | @@ -160,8 +169,8 @@ |
| 160 | 169 | $projects = $user->getProjects() |
| 161 | 170 | ->with('parent') |
| 162 | 171 | ->all(); |
| 163 | - if(empty($projects)) { | |
| 164 | - return ['error' => 'У Вас еще нету проектов']; | |
| 172 | + if(empty( $projects )) { | |
| 173 | + return [ 'error' => 'У Вас еще нету проектов' ]; | |
| 165 | 174 | } |
| 166 | 175 | return [ |
| 167 | 176 | 'message' => $this->renderAjax('forms-modal-offer', [ | ... | ... |
frontend/views/accounts/_projects_form.php
| ... | ... | @@ -248,7 +248,7 @@ |
| 248 | 248 | |
| 249 | 249 | <div class="input-blocks-wrapper"> |
| 250 | 250 | <div class="input-blocks admin-project-list admin-currency-second"> |
| 251 | - <?= $form->field($project, 'hidden')->checkbox() ?> | |
| 251 | + <?= $form->field($project, 'hidden')->checkbox()->hint('Проект, снятый с тендера, будет добавлен в Архив (не доступен в поиске, но доступен по ссылке)') ?> | |
| 252 | 252 | </div> |
| 253 | 253 | </div> |
| 254 | 254 | ... | ... |
frontend/views/accounts/projects.php
| ... | ... | @@ -71,12 +71,21 @@ |
| 71 | 71 | */ |
| 72 | 72 | if($model->contractual) { |
| 73 | 73 | return 'Договорной'; |
| 74 | + } elseif(empty($model->budget)) { | |
| 75 | + return 'Не задано'; | |
| 74 | 76 | } else { |
| 75 | 77 | return $model->budget; |
| 76 | 78 | } |
| 77 | 79 | }, |
| 78 | 80 | 'label' => $searchModel->getAttributeLabel('budget').' +/- 10%', |
| 79 | 81 | ], |
| 82 | + [ | |
| 83 | + 'attribute' => 'contractual', | |
| 84 | + 'filter' => Html::activeDropDownList($searchModel, 'contractual', [1 => 'Только договорные', 2 => 'Без договорных'], ['prompt' => 'Все']), | |
| 85 | + 'value' => function($model) { | |
| 86 | + return \Yii::$app->formatter->asBoolean($model->contractual); | |
| 87 | + } | |
| 88 | + ], | |
| 80 | 89 | 'city', |
| 81 | 90 | [ |
| 82 | 91 | 'attribute' => 'specializationString', |
| ... | ... | @@ -84,7 +93,7 @@ |
| 84 | 93 | 'view_count', |
| 85 | 94 | [ |
| 86 | 95 | 'value' => function($model, $key, $index, $column) { |
| 87 | - return 0; | |
| 96 | + return count($model->comments); | |
| 88 | 97 | }, |
| 89 | 98 | 'label' => 'Отклики', |
| 90 | 99 | ], | ... | ... |
frontend/views/company/_company_list_view.php
| 1 | 1 | <?php |
| 2 | + /** | |
| 3 | + * @var Team $model | |
| 4 | + */ | |
| 5 | + use common\models\Team; | |
| 2 | 6 | use yii\helpers\Html; |
| 3 | - use yii\helpers\Url; | |
| 4 | - | |
| 5 | 7 | ?> |
| 6 | 8 | <div class="command-block-wrapper"> |
| 7 | 9 | <div class="command-block-wr-two"> |
| ... | ... | @@ -14,7 +16,17 @@ |
| 14 | 16 | } |
| 15 | 17 | ?> |
| 16 | 18 | </div> |
| 17 | - <div class="command-block-name"><?= $model->user ?></div> | |
| 19 | + <div class="command-block-name"> | |
| 20 | + <?php | |
| 21 | + if(!empty($model->firstname)) { | |
| 22 | + echo "<p>{$model->firstname}</p>"; | |
| 23 | + } | |
| 24 | + ?> | |
| 25 | + <?php | |
| 26 | + if(!empty($model->firstname)) { | |
| 27 | + echo "<p>{$model->lastname}</p>"; | |
| 28 | + } | |
| 29 | + ?> | |
| 18 | 30 | <?php |
| 19 | 31 | if(!empty( $model->department->name )) { |
| 20 | 32 | ?> | ... | ... |
frontend/views/search/_projects_list_view.php
| ... | ... | @@ -16,8 +16,10 @@ use yii\helpers\Url; |
| 16 | 16 | <span></span> |
| 17 | 17 | Бюджет: |
| 18 | 18 | <?php |
| 19 | - if(empty($model->contractual)) { | |
| 19 | + if(empty($model->contractual) && !empty($model->budget)) { | |
| 20 | 20 | echo $model->budget.' '.$model->budgetCurrency->label; |
| 21 | + } elseif(empty($model->budget)) { | |
| 22 | + echo "Не задано"; | |
| 21 | 23 | } else { |
| 22 | 24 | echo "Договорной"; |
| 23 | 25 | } | ... | ... |