Commit 2261f70a33734498dc47cc81dc9979964526f82b
1 parent
ad6304d6
test
Showing
10 changed files
with
772 additions
and
38 deletions
Show diff stats
common/models/TenderSearch.php
| @@ -193,41 +193,127 @@ | @@ -193,41 +193,127 @@ | ||
| 193 | 'project_payment.payment_id' => $this->payment, | 193 | 'project_payment.payment_id' => $this->payment, |
| 194 | ]); | 194 | ]); |
| 195 | 195 | ||
| 196 | - if(!empty( $this->contractual )) { | 196 | + $currencies = Currency::find() |
| 197 | + ->select([ | ||
| 198 | + 'rate', | ||
| 199 | + 'currency_id', | ||
| 200 | + ]) | ||
| 201 | + ->asArray() | ||
| 202 | + ->indexBy('currency_id') | ||
| 203 | + ->column(); | ||
| 204 | + | ||
| 205 | + if(empty( $this->contractual )) { | ||
| 197 | $query->andWhere([ | 206 | $query->andWhere([ |
| 198 | - 'contractual' => $this->contractual, | 207 | + 'not', |
| 208 | + [ 'contractual' => 1 ], | ||
| 199 | ]); | 209 | ]); |
| 200 | - } else { | ||
| 201 | - $currencies = Currency::find() | ||
| 202 | - ->select([ | ||
| 203 | - 'rate', | ||
| 204 | - 'currency_id', | ||
| 205 | - ]) | ||
| 206 | - ->asArray() | ||
| 207 | - ->indexBy('currency_id') | ||
| 208 | - ->column(); | ||
| 209 | - | ||
| 210 | - if(!empty($this->budget_from) && !empty($this->budget_to)) { | 210 | + if(!empty( $this->budget_from ) && !empty( $this->budget_to )) { |
| 211 | $query->andFilterWhere([ | 211 | $query->andFilterWhere([ |
| 212 | 'between', | 212 | 'between', |
| 213 | 'total_budget', | 213 | 'total_budget', |
| 214 | $this->budget_from * $currencies[ $this->budget_currency ], | 214 | $this->budget_from * $currencies[ $this->budget_currency ], |
| 215 | $this->budget_to * $currencies[ $this->budget_currency ], | 215 | $this->budget_to * $currencies[ $this->budget_currency ], |
| 216 | ]); | 216 | ]); |
| 217 | - } elseif(!empty($this->budget_from)) { | 217 | + } elseif(!empty( $this->budget_from )) { |
| 218 | $query->andFilterWhere([ | 218 | $query->andFilterWhere([ |
| 219 | '>=', | 219 | '>=', |
| 220 | 'total_budget', | 220 | 'total_budget', |
| 221 | $this->budget_from * $currencies[ $this->budget_currency ], | 221 | $this->budget_from * $currencies[ $this->budget_currency ], |
| 222 | ]); | 222 | ]); |
| 223 | - } elseif(!empty($this->budget_to)) { | 223 | + } elseif(!empty( $this->budget_to )) { |
| 224 | $query->andFilterWhere([ | 224 | $query->andFilterWhere([ |
| 225 | '<=', | 225 | '<=', |
| 226 | 'total_budget', | 226 | 'total_budget', |
| 227 | $this->budget_to * $currencies[ $this->budget_currency ], | 227 | $this->budget_to * $currencies[ $this->budget_currency ], |
| 228 | ]); | 228 | ]); |
| 229 | } | 229 | } |
| 230 | - | 230 | + } else { |
| 231 | + if(!empty( $this->budget_from ) && !empty( $this->budget_to )) { | ||
| 232 | + $query->andWhere([ | ||
| 233 | + 'or', | ||
| 234 | + [ | ||
| 235 | + 'and', | ||
| 236 | + [ | ||
| 237 | + 'between', | ||
| 238 | + 'total_budget', | ||
| 239 | + $this->budget_from * $currencies[ $this->budget_currency ], | ||
| 240 | + $this->budget_to * $currencies[ $this->budget_currency ], | ||
| 241 | + ], | ||
| 242 | + [ | ||
| 243 | + 'not', | ||
| 244 | + [ | ||
| 245 | + 'contractual' => 1, | ||
| 246 | + ], | ||
| 247 | + ], | ||
| 248 | + ], | ||
| 249 | + [ | ||
| 250 | + 'contractual' => 1, | ||
| 251 | + ], | ||
| 252 | + ]); | ||
| 253 | + } elseif(!empty( $this->budget_from )) { | ||
| 254 | + $query->andWhere([ | ||
| 255 | + 'or', | ||
| 256 | + [ | ||
| 257 | + 'and', | ||
| 258 | + [ | ||
| 259 | + '>=', | ||
| 260 | + 'total_budget', | ||
| 261 | + $this->budget_from * $currencies[ $this->budget_currency ], | ||
| 262 | + ], | ||
| 263 | + [ | ||
| 264 | + 'not', | ||
| 265 | + [ | ||
| 266 | + 'contractual' => 1, | ||
| 267 | + ], | ||
| 268 | + ], | ||
| 269 | + ], | ||
| 270 | + [ | ||
| 271 | + 'contractual' => 1, | ||
| 272 | + ], | ||
| 273 | + ]); | ||
| 274 | + } elseif(!empty( $this->budget_to )) { | ||
| 275 | + $query->andWhere([ | ||
| 276 | + 'or', | ||
| 277 | + [ | ||
| 278 | + 'and', | ||
| 279 | + [ | ||
| 280 | + '<=', | ||
| 281 | + 'total_budget', | ||
| 282 | + $this->budget_to * $currencies[ $this->budget_currency ], | ||
| 283 | + ], | ||
| 284 | + [ | ||
| 285 | + 'not', | ||
| 286 | + [ | ||
| 287 | + 'contractual' => 1, | ||
| 288 | + ], | ||
| 289 | + ], | ||
| 290 | + ], | ||
| 291 | + [ | ||
| 292 | + 'contractual' => 1, | ||
| 293 | + ], | ||
| 294 | + ]); | ||
| 295 | + } else { | ||
| 296 | + $query->andWhere([ | ||
| 297 | + 'or', | ||
| 298 | + [ | ||
| 299 | + 'and', | ||
| 300 | + [ | ||
| 301 | + '>=', | ||
| 302 | + 'total_budget', | ||
| 303 | + 0, | ||
| 304 | + ], | ||
| 305 | + [ | ||
| 306 | + 'not', | ||
| 307 | + [ | ||
| 308 | + 'contractual' => 1, | ||
| 309 | + ], | ||
| 310 | + ], | ||
| 311 | + ], | ||
| 312 | + [ | ||
| 313 | + 'contractual' => 1, | ||
| 314 | + ], | ||
| 315 | + ]); | ||
| 316 | + } | ||
| 231 | } | 317 | } |
| 232 | 318 | ||
| 233 | return $dataProvider; | 319 | return $dataProvider; |
| 1 | +<?php | ||
| 2 | + namespace common\modules\comment\models; | ||
| 3 | + | ||
| 4 | + use common\models\Currency; | ||
| 5 | + use common\models\File; | ||
| 6 | + use yii\db\ActiveQuery; | ||
| 7 | + use yii\web\UploadedFile; | ||
| 8 | + | ||
| 9 | + /** | ||
| 10 | + * Class Comment | ||
| 11 | + * @property bool $guestComment | ||
| 12 | + * @property integer $comment_id | ||
| 13 | + * @property string $text | ||
| 14 | + * @property int $user_id | ||
| 15 | + * @property int $status | ||
| 16 | + * @property string $date_add | ||
| 17 | + * @property string $date_update | ||
| 18 | + * @property string $date_delete | ||
| 19 | + * @property string $model | ||
| 20 | + * @property int $model_id | ||
| 21 | + * @property string $files | ||
| 22 | + * @property float $budget_from | ||
| 23 | + * @property float $budget_to | ||
| 24 | + * @property int $term_from | ||
| 25 | + * @property int $term_to | ||
| 26 | + * @package common\modules\comment\models | ||
| 27 | + */ | ||
| 28 | + class CommentProject extends \yii\db\ActiveRecord | ||
| 29 | + implements \common\modules\comment\interfaces\CommentInterface | ||
| 30 | + { | ||
| 31 | + | ||
| 32 | + const STATUS_HIDDEN = 0; | ||
| 33 | + const STATUS_DELETED = 2; | ||
| 34 | + const STATUS_ACTIVE = 1; | ||
| 35 | + const STATUS_PERSONAL = 3; | ||
| 36 | + const STATUS_ANONYMOUS = 4; | ||
| 37 | + | ||
| 38 | + const SCENARIO_USER = 'user'; | ||
| 39 | + const SCENARIO_GUEST = 'guest'; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * @var bool | ||
| 43 | + */ | ||
| 44 | + public $guestComment = false; | ||
| 45 | + public $file; | ||
| 46 | + | ||
| 47 | + public function rules() | ||
| 48 | + { | ||
| 49 | + return [ | ||
| 50 | + [ | ||
| 51 | + [ | ||
| 52 | + 'text', | ||
| 53 | + 'budget_from', | ||
| 54 | + 'budget_to', | ||
| 55 | + 'term_from', | ||
| 56 | + 'term_to', | ||
| 57 | + 'budget_currency', | ||
| 58 | + ], | ||
| 59 | + 'required', | ||
| 60 | + ], | ||
| 61 | + [ | ||
| 62 | + [ | ||
| 63 | + 'budget_currency', | ||
| 64 | + ], | ||
| 65 | + 'integer', | ||
| 66 | + ], | ||
| 67 | + [ | ||
| 68 | + [ | ||
| 69 | + 'budget_from', | ||
| 70 | + 'budget_to', | ||
| 71 | + 'term_from', | ||
| 72 | + 'term_to', | ||
| 73 | + ], | ||
| 74 | + 'integer', | ||
| 75 | + 'min' => 0, | ||
| 76 | + ], | ||
| 77 | + [ | ||
| 78 | + [ | ||
| 79 | + 'budget_currency', | ||
| 80 | + ], | ||
| 81 | + 'default', | ||
| 82 | + 'value' => 3, | ||
| 83 | + ], | ||
| 84 | + [ | ||
| 85 | + [ 'budget_currency' ], | ||
| 86 | + 'exist', | ||
| 87 | + 'targetClass' => Currency::className(), | ||
| 88 | + 'targetAttribute' => 'currency_id', | ||
| 89 | + ], | ||
| 90 | + [ | ||
| 91 | + [ | ||
| 92 | + 'files', | ||
| 93 | + ], | ||
| 94 | + 'string', | ||
| 95 | + ], | ||
| 96 | + [ | ||
| 97 | + [ | ||
| 98 | + 'file', | ||
| 99 | + ], | ||
| 100 | + 'safe', | ||
| 101 | + ], | ||
| 102 | + [ | ||
| 103 | + [ 'status' ], | ||
| 104 | + 'default', | ||
| 105 | + 'value' => 1, | ||
| 106 | + ], | ||
| 107 | + ]; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public function scenarios() | ||
| 111 | + { | ||
| 112 | + return [ | ||
| 113 | + self::SCENARIO_USER => [ | ||
| 114 | + 'text', | ||
| 115 | + 'budget_from', | ||
| 116 | + 'budget_to', | ||
| 117 | + 'term_from', | ||
| 118 | + 'term_to', | ||
| 119 | + 'file', | ||
| 120 | + ], | ||
| 121 | + self::SCENARIO_GUEST => [ | ||
| 122 | + | ||
| 123 | + ], | ||
| 124 | + ]; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * @inheritdoc | ||
| 129 | + */ | ||
| 130 | + public function behaviors() | ||
| 131 | + { | ||
| 132 | + return [ | ||
| 133 | + [ | ||
| 134 | + 'class' => \yii\behaviors\TimestampBehavior::className(), | ||
| 135 | + 'createdAtAttribute' => 'date_add', | ||
| 136 | + 'updatedAtAttribute' => 'date_update', | ||
| 137 | + 'value' => new \yii\db\Expression('NOW()'), | ||
| 138 | + ], | ||
| 139 | + ]; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + public static function tableName() | ||
| 143 | + { | ||
| 144 | + return '{{%comment_project}}'; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * @inheritdoc | ||
| 149 | + */ | ||
| 150 | + public function attributeLabels() | ||
| 151 | + { | ||
| 152 | + return [ | ||
| 153 | + 'text' => \Yii::t('app', 'Текст ответа'), | ||
| 154 | + 'budget_from' => \Yii::t('app', 'от'), | ||
| 155 | + 'budget_to' => \Yii::t('app', 'до'), | ||
| 156 | + 'term_from' => \Yii::t('app', 'от'), | ||
| 157 | + 'term_to' => \Yii::t('app', 'до'), | ||
| 158 | + ]; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public function getGuestComment() | ||
| 162 | + { | ||
| 163 | + return $this->guestComment; | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | +// public function setGuestComment($value) | ||
| 167 | +// { | ||
| 168 | +// $this->guestComment = $value; | ||
| 169 | +// } | ||
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * @param string $model | ||
| 173 | + * @param integer $model_id | ||
| 174 | + * | ||
| 175 | + * @return ActiveQuery | ||
| 176 | + */ | ||
| 177 | + public function getComments($model, $model_id) | ||
| 178 | + { | ||
| 179 | + return $this->find() | ||
| 180 | + ->where([ | ||
| 181 | + 'comment_project.model' => $model, | ||
| 182 | + 'comment_project.model_id' => $model_id, | ||
| 183 | + 'comment_project.status' => 1, | ||
| 184 | + ]); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public function postComment() | ||
| 188 | + { | ||
| 189 | + if($this->checkCreate()) { | ||
| 190 | + if(!empty(\Yii::$app->request->post($this->formName())['anonymous'])) { | ||
| 191 | + $this->status = self::STATUS_ANONYMOUS; | ||
| 192 | + } | ||
| 193 | + $this->file = UploadedFile::getInstances($this, 'file'); | ||
| 194 | + if(!empty($this->file)) { | ||
| 195 | + $file_id = []; | ||
| 196 | + if(is_array($this->file)){ | ||
| 197 | + foreach($this->file as $file){ | ||
| 198 | + if($file instanceof UploadedFile){ | ||
| 199 | + $file_model = new File(); | ||
| 200 | + $file_id[] = $file_model->saveFile($file); | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + } else { | ||
| 204 | + if($this->file instanceof UploadedFile){ | ||
| 205 | + $file_model = new File(); | ||
| 206 | + $file_id[] = $file_model->saveFile($this->file); | ||
| 207 | + } | ||
| 208 | + } | ||
| 209 | + $this->files = json_encode($file_id); | ||
| 210 | + } | ||
| 211 | + if($this->insert()) { | ||
| 212 | + $this->clearSafe(); | ||
| 213 | + return true; | ||
| 214 | + } else { | ||
| 215 | + return false; | ||
| 216 | + } | ||
| 217 | + } else { | ||
| 218 | + $this->addError('comment_id', 'You can`t post comment here'); | ||
| 219 | + return false; | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public function updateComment() | ||
| 224 | + { | ||
| 225 | + if($this->checkUpdate()) { | ||
| 226 | + if(empty( $this->comment_id )) { | ||
| 227 | + $this->addError('comment_id', 'Comment ID not found'); | ||
| 228 | + return false; | ||
| 229 | + } else { | ||
| 230 | + if($this->update()) { | ||
| 231 | + $this->clearSafe(); | ||
| 232 | + return true; | ||
| 233 | + } else { | ||
| 234 | + return false; | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + } else { | ||
| 238 | + $this->addError('comment_id', 'You can`t update this post'); | ||
| 239 | + return false; | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public function deleteComment() | ||
| 244 | + { | ||
| 245 | + if($this->checkDelete()) { | ||
| 246 | + if(empty( $this->comment_id )) { | ||
| 247 | + $this->addError('comment_id', 'Comment ID not found'); | ||
| 248 | + return false; | ||
| 249 | + } else { | ||
| 250 | + if($this->status == self::STATUS_DELETED) { | ||
| 251 | + return false; | ||
| 252 | + } | ||
| 253 | + $this->status = self::STATUS_DELETED; | ||
| 254 | + if($this->update()) { | ||
| 255 | + $this->clearSafe(); | ||
| 256 | + return true; | ||
| 257 | + } else { | ||
| 258 | + return false; | ||
| 259 | + } | ||
| 260 | + } | ||
| 261 | + } else { | ||
| 262 | + $this->addError('comment_id', 'You can`t delete this post'); | ||
| 263 | + return false; | ||
| 264 | + } | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + public function checkCreate() | ||
| 268 | + { | ||
| 269 | + if($this->getGuestComment()) { | ||
| 270 | + return true; | ||
| 271 | + } else { | ||
| 272 | + return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [ | ||
| 273 | + 'model' => $this->model, | ||
| 274 | + 'model_id' => $this->model_id, | ||
| 275 | + ]); | ||
| 276 | + } | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + public function checkUpdate() | ||
| 280 | + { | ||
| 281 | + if($this->scenario == self::SCENARIO_GUEST) { | ||
| 282 | + return false; | ||
| 283 | + } else { | ||
| 284 | + return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [ | ||
| 285 | + 'model' => $this->model, | ||
| 286 | + 'model_id' => $this->model_id, | ||
| 287 | + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [ | ||
| 288 | + 'model' => $this->model, | ||
| 289 | + 'model_id' => $this->model_id, | ||
| 290 | + ]); | ||
| 291 | + } | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + public function checkDelete() | ||
| 295 | + { | ||
| 296 | + if($this->scenario == self::SCENARIO_GUEST) { | ||
| 297 | + return false; | ||
| 298 | + } else { | ||
| 299 | + return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [ | ||
| 300 | + 'model' => $this->model, | ||
| 301 | + 'model_id' => $this->model_id, | ||
| 302 | + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [ | ||
| 303 | + 'model' => $this->model, | ||
| 304 | + 'model_id' => $this->model_id, | ||
| 305 | + ]); | ||
| 306 | + } | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + protected function clearSafe($setNew = true) | ||
| 310 | + { | ||
| 311 | + $safe = $this->safeAttributes(); | ||
| 312 | + $count = count($safe); | ||
| 313 | + $values = array_fill(0, $count, NULL); | ||
| 314 | + $result = array_combine($safe, $values); | ||
| 315 | + $this->setAttributes($result); | ||
| 316 | + $this->setIsNewRecord($setNew); | ||
| 317 | + } | ||
| 318 | + | ||
| 319 | + public function getAuthor() | ||
| 320 | + { | ||
| 321 | + // if($this->user_id != NULL) { | ||
| 322 | + return $this->hasOne(\common\models\User::className(), [ 'id' => 'user_id' ]); | ||
| 323 | + // } else { | ||
| 324 | + // return ['firstname' => $this->user_name, 'email' => $this->user_email]; | ||
| 325 | + // } | ||
| 326 | + } | ||
| 327 | + | ||
| 328 | + } |
common/modules/comment/widgets/views/_project_comment_view.php
0 → 100644
| 1 | +<?php | ||
| 2 | + use common\models\User; | ||
| 3 | + use yii\helpers\Html; | ||
| 4 | + | ||
| 5 | + /** | ||
| 6 | + * @var \common\modules\comment\models\CommentProject $model Current comment model | ||
| 7 | + * @var integer $key ID of current comment | ||
| 8 | + * @var integer $index index of current element according | ||
| 9 | + * to current page, starting from 0 | ||
| 10 | + * @var \yii\widgets\ListView $widget current ListView instance | ||
| 11 | + * @var User $user | ||
| 12 | + */ | ||
| 13 | + $user = NULL; | ||
| 14 | + if(!empty( $model->user_id )) { | ||
| 15 | + $user = User::find() | ||
| 16 | + ->where([ 'id' => $model->user_id ]) | ||
| 17 | + ->with('userInfo') | ||
| 18 | + ->one(); | ||
| 19 | + } | ||
| 20 | +?> | ||
| 21 | +<div class="performer-vacancy-sidebar-left-wr"> | ||
| 22 | + <div class="performer-vacancy-sidebar-left"> | ||
| 23 | + <div class="performer-vacancy-sidebar-img style"> | ||
| 24 | + <?= Html::img($user->userInfo->image) ?> | ||
| 25 | + </div> | ||
| 26 | + <div class="performer-vacancy-sidebar-all style"> | ||
| 27 | + <div class="performer-vacancy-sidebar-soc style"> | ||
| 28 | + <ul> | ||
| 29 | + <?php | ||
| 30 | + if(!empty( $user->userInfo->social_fb )) { | ||
| 31 | + echo '<li>'.Html::a(Html::img('/images/ico-fb.png'), $user->userInfo->social_fb, ['target' => '_blank']).'</li>'; | ||
| 32 | + } | ||
| 33 | + ?> | ||
| 34 | + <?php | ||
| 35 | + if(!empty( $user->userInfo->social_t )) { | ||
| 36 | + echo '<li>'.Html::a(Html::img('/images/ico-tw.png'), $user->userInfo->social_t, ['target' => '_blank']).'</li>'; | ||
| 37 | + } | ||
| 38 | + ?> | ||
| 39 | + <?php | ||
| 40 | + if(!empty( $user->userInfo->social_in )) { | ||
| 41 | + echo '<li>'.Html::a(Html::img('/images/ico-in.png'), $user->userInfo->social_in, ['target' => '_blank']).'</li>'; | ||
| 42 | + } | ||
| 43 | + ?> | ||
| 44 | + <?php | ||
| 45 | + if(!empty( $user->userInfo->social_vk )) { | ||
| 46 | + echo '<li>'.Html::a(Html::img('/images/ico-vk.png'), $user->userInfo->social_vk, ['target' => '_blank']).'</li>'; | ||
| 47 | + } | ||
| 48 | + ?> | ||
| 49 | + </ul> | ||
| 50 | + </div> | ||
| 51 | + <div class="performer-vacancy-sidebar-views style"> | ||
| 52 | + <ul class="style"> | ||
| 53 | + <li><img src="/images/sidebar-ico/ico-1.png" alt=""> | ||
| 54 | + <div class="sidebarvievstxt"><?= $user->userInfo->view_count ?></div> | ||
| 55 | + </li> | ||
| 56 | + <li><img src="/images/sidebar-ico/ico-9.png" alt=""> | ||
| 57 | + <div class="sidebarvievstxt"><span class="sidebar-views-txt">Статус: </span><?= (empty($user->userInfo->busy)?'Свободен':'Занят') ?> | ||
| 58 | + </div> | ||
| 59 | + </li> | ||
| 60 | + <li><img src="/images/sidebar-ico/ico-2.png" alt=""> | ||
| 61 | + <div class="sidebarvievstxt"> | ||
| 62 | + <span class="sidebar-views-txt">На сайте: </span>1г. 8 мес. | ||
| 63 | + </div> | ||
| 64 | + </li> | ||
| 65 | + <li><img src="/images/sidebar-ico/ico-3.png" alt=""> | ||
| 66 | + <div class="sidebarvievstxt"><span class="sidebar-views-txt">Последний визит:<br></span>2 дня назад | ||
| 67 | + </div> | ||
| 68 | + </li> | ||
| 69 | + </ul> | ||
| 70 | + <a href="#" class="tender-see-profile style">Посмотреть профиль</a> | ||
| 71 | + </div> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | +</div> | ||
| 75 | +<div class="tender-offer-proj-block-right-wr"> | ||
| 76 | + <div class="tender-offer-proj-block-right"> | ||
| 77 | + <div class="tender-offer-proj-min-blocks"><span>2000 грн</span></div> | ||
| 78 | + <div class="tender-offer-proj-min-blocks"><span>3 ДНЯ</span></div> | ||
| 79 | + </div> | ||
| 80 | + <div class="tender-offer-proj-block-left"> | ||
| 81 | + <div class="search-worker-blocks-title-wr"> | ||
| 82 | + <div class="search-worker-blocks-title-title">Петер Цумтор</div> | ||
| 83 | + <div class="rating-new"> | ||
| 84 | + <!--оценка--> | ||
| 85 | + <input type="hidden" class="val" value="4"/> | ||
| 86 | + </div> | ||
| 87 | + <a href="#" class="link-to-comm">30 отзывов</a> | ||
| 88 | + </div> | ||
| 89 | + <div class="tender-offer-proj-txt"> | ||
| 90 | + <p>1.1 Строительная площадка расположена по адресу: г. Киев.</p> | ||
| 91 | + <p>1.2 Существующий объект представляет собой помещение общей площадью ориентировочно – 140 м2.</p> | ||
| 92 | + <p>1.3. Цель проекта состоит в проведении внутренних общестроительных и отделочных работ.</p> | ||
| 93 | + <p>1.4. При разработке методов строительства и выборе материалов, используемых в настоящем проекте, необходимо учитывать климатические условия, характерные для г. Киева.</p> | ||
| 94 | + <p>1.5. Требования к проектированию и производству работ определяются следующими документами:</p> | ||
| 95 | + <p>- Техническим заданием.</p> | ||
| 96 | + <p>- Строительными нормами и правилами.</p> | ||
| 97 | + <p>Все проектные решения и все разделы рабочего проекта должны быть согласованы с Заказчиком в объеме, необходимом для последующей сдачи инженерных систем и коммуникаций.</p> | ||
| 98 | + </div> | ||
| 99 | + <ul class="download-list-files"> | ||
| 100 | + <li> | ||
| 101 | + <span></span><a href="#" class="download-link-file">КП.doc</a><a href="#" class="download-link">Скачать</a> | ||
| 102 | + </li> | ||
| 103 | + <li> | ||
| 104 | + <span></span><a href="#" class="download-link-file">Резюме.txt</a><a href="#" class="download-link">Скачать</a> | ||
| 105 | + </li> | ||
| 106 | + </ul> | ||
| 107 | + </div> | ||
| 108 | + <div class="tender-more-buttons-wr"> | ||
| 109 | + <a class="get-project-new" href="#">Портфолио</a> | ||
| 110 | + <a class="get-list-new" href="#">Конаткты</a> | ||
| 111 | + </div> | ||
| 112 | + | ||
| 113 | +</div> |
common/modules/comment/widgets/views/form-project-comment.php
0 → 100644
| 1 | +<?php | ||
| 2 | + /** | ||
| 3 | + * @var \common\modules\comment\models\CommentProject $model | ||
| 4 | + * @var \common\models\User $user | ||
| 5 | + * @var \yii\data\ActiveDataProvider $dataProvider | ||
| 6 | + */ | ||
| 7 | + use common\models\Currency; | ||
| 8 | + use yii\widgets\ActiveForm; | ||
| 9 | + use yii\helpers\Html; | ||
| 10 | + | ||
| 11 | + $currencies = Currency::getCurrencyDropdown(); | ||
| 12 | +?> | ||
| 13 | + | ||
| 14 | +<div class="new-portf-add-comm style"> | ||
| 15 | + <div class="box-wr"> | ||
| 16 | + <div class="box-all"> | ||
| 17 | + <div class="tender-add-answer-title">Добавить ответ</div> | ||
| 18 | + <div class="form-tender-answer style"> | ||
| 19 | + <?php | ||
| 20 | + $form = ActiveForm::begin([ 'options' => [ 'class' => 'resformsfile MultiFile-intercepted', 'enctype' => 'multipart/form-data' ] ]); | ||
| 21 | + ?> | ||
| 22 | + <div class="form-value-wr style"> | ||
| 23 | + <div class="form-ico-ded-wr"> | ||
| 24 | + <div class="header-cabinet-foto"> | ||
| 25 | + <?= Html::img($user->userInfo->image) ?> | ||
| 26 | + </div> | ||
| 27 | + <div class="form-value-ded-name"> | ||
| 28 | + <?= $user->name ?> | ||
| 29 | + </div> | ||
| 30 | + </div> | ||
| 31 | + <div class="form-value-price-wr"> | ||
| 32 | + <div class="form-value-price-title">Стоимость</div> | ||
| 33 | + <div class="form-price-wr"> | ||
| 34 | + <?= $form->field($model, 'budget_from', [ | ||
| 35 | + 'template' => "{input}\n{error}", | ||
| 36 | + 'options' => [ 'tag' => 'span' ], | ||
| 37 | + ]) | ||
| 38 | + ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_from') ]) ?> | ||
| 39 | + <?= $form->field($model, 'budget_to', [ | ||
| 40 | + 'template' => "{input}\n{error}", | ||
| 41 | + 'options' => [ 'tag' => 'span' ], | ||
| 42 | + ]) | ||
| 43 | + ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_to') ]) ?> | ||
| 44 | + <?= $form->field($model, 'budget_currency', [ | ||
| 45 | + 'template' => "{input}<div class='select-after'></div>\n{error}", | ||
| 46 | + 'options' => [ 'class' => 'blocks-check-list-wrapp check-valuta' ], | ||
| 47 | + ]) | ||
| 48 | + ->dropDownList($currencies) ?> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + <div class="form-value-price-wr" style="float: right"> | ||
| 52 | + <div class="form-value-price-title"> | ||
| 53 | + Сроки(<span style="font-weight: normal">в днях</span>) | ||
| 54 | + </div> | ||
| 55 | + <div class="form-price-wr"> | ||
| 56 | + <?= $form->field($model, 'term_from', [ | ||
| 57 | + 'template' => "{input}\n{error}", | ||
| 58 | + 'options' => [ 'tag' => 'span' ], | ||
| 59 | + ]) | ||
| 60 | + ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_from') ]) ?> | ||
| 61 | + <?= $form->field($model, 'term_to', [ | ||
| 62 | + 'template' => "{input}\n{error}", | ||
| 63 | + 'options' => [ 'tag' => 'span' ], | ||
| 64 | + ]) | ||
| 65 | + ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_to') ]) ?> | ||
| 66 | + </div> | ||
| 67 | + </div> | ||
| 68 | + </div> | ||
| 69 | + <?= $form->field($model, 'text', [ | ||
| 70 | + 'template' => "{input}\n{error}", | ||
| 71 | + 'options' => [ 'class' => 'form-tender-txt style' ], | ||
| 72 | + ]) | ||
| 73 | + ->textarea([ 'placeholder' => $model->getAttributeLabel('text') ]) ?> | ||
| 74 | + <div class="tender-file-wr"> | ||
| 75 | + <?= $form->field($model, 'file[]') | ||
| 76 | + ->fileInput([ 'class' => 'multi' ]) | ||
| 77 | + ->label(false) ?> | ||
| 78 | + <a href="#" class="addfilemulti">Прикрепить файл</a> | ||
| 79 | + <div class="max-size">Максимальный размер<br/>файла 5 МБ</div> | ||
| 80 | + </div> | ||
| 81 | + <div class="tender-form-buttons-wr"> | ||
| 82 | + <?php | ||
| 83 | + echo Html::submitInput('Подать заявку', [ 'class' => 'get-project-new' ]); | ||
| 84 | + echo Html::submitInput('ответить анонимно', [ | ||
| 85 | + 'class' => 'get-list-new', | ||
| 86 | + 'name' => 'CommentProject[anonymous]', | ||
| 87 | + ]); | ||
| 88 | + echo Html::a('Очистить', [ | ||
| 89 | + 'tender/view', | ||
| 90 | + 'tender_id' => \Yii::$app->request->get('tender_id'), | ||
| 91 | + '#' => 'w1', | ||
| 92 | + ]); | ||
| 93 | + ?> | ||
| 94 | + </div> | ||
| 95 | + <?php | ||
| 96 | + $form->end(); | ||
| 97 | + ?> | ||
| 98 | + </div> | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 101 | +</div> | ||
| 0 | \ No newline at end of file | 102 | \ No newline at end of file |
common/modules/comment/widgets/views/list-project-comment.php
0 → 100644
| 1 | +<?php | ||
| 2 | + /** | ||
| 3 | + * @var \yii\data\DataProviderInterface $dataProvider | ||
| 4 | + */ | ||
| 5 | +?> | ||
| 6 | +<div class="box-wr"> | ||
| 7 | + <div class="box-all"> | ||
| 8 | + <div class="tender-offer-proj-title-all style">Предложения проектантов</div> | ||
| 9 | + <div class="tender-offer-proj-blocks-wr style"> | ||
| 10 | + <?php | ||
| 11 | + echo \yii\widgets\ListView::widget([ | ||
| 12 | + 'dataProvider' => $dataProvider, | ||
| 13 | + 'itemView' => '_project_comment_view', | ||
| 14 | + 'itemOptions' => [ | ||
| 15 | + 'class' => 'tender-offer-proj-blocks style', | ||
| 16 | + ], | ||
| 17 | + 'summary' => '', | ||
| 18 | + ]); | ||
| 19 | + ?> | ||
| 20 | + </div> | ||
| 21 | + </div> | ||
| 22 | +</div> | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
console/migrations/m160314_090858_project_comment.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160314_090858_project_comment extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up() | ||
| 8 | + { | ||
| 9 | + $this->createTable('{{%comment_project}}', [ | ||
| 10 | + 'comment_id' => $this->primaryKey(), | ||
| 11 | + 'model' => $this->string()->notNull(), | ||
| 12 | + 'model_id' => $this->integer()->notNull(), | ||
| 13 | + 'text' => $this->text()->notNull(), | ||
| 14 | + 'files' => $this->string(), | ||
| 15 | + 'budget_from' => $this->float()->notNull()->defaultValue(0), | ||
| 16 | + 'budget_to' => $this->float()->notNull()->defaultValue(0), | ||
| 17 | + 'budget_currency' => $this->integer()->notNull()->defaultValue(3), | ||
| 18 | + 'term_from' => $this->integer()->notNull()->defaultValue(0), | ||
| 19 | + 'term_to' => $this->integer()->notNull()->defaultValue(0), | ||
| 20 | + 'user_id' => $this->integer()->notNull(), | ||
| 21 | + 'status' => $this->integer(), | ||
| 22 | + 'date_add' => $this->timestamp()->notNull()->defaultExpression('NOW()'), | ||
| 23 | + 'date_update' => $this->timestamp()->notNull()->defaultExpression('NOW()'), | ||
| 24 | + 'date_delete' => $this->timestamp(), | ||
| 25 | + ]); | ||
| 26 | + | ||
| 27 | + $this->addForeignKey('comment_project_user', '{{%comment_project}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE'); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public function down() | ||
| 31 | + { | ||
| 32 | + $this->dropForeignKey('comment_project_user', '{{%comment_project}}'); | ||
| 33 | + $this->dropTable('{{%comment_project}}'); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | +} |
frontend/assets/AppAsset.php
| @@ -19,7 +19,7 @@ class AppAsset extends AssetBundle | @@ -19,7 +19,7 @@ class AppAsset extends AssetBundle | ||
| 19 | public $css = [ | 19 | public $css = [ |
| 20 | 'css/style.css', | 20 | 'css/style.css', |
| 21 | '/admin/css/flags32.css', | 21 | '/admin/css/flags32.css', |
| 22 | - 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', | 22 | + //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', |
| 23 | ]; | 23 | ]; |
| 24 | public $js = [ | 24 | public $js = [ |
| 25 | '/js/script.js', | 25 | '/js/script.js', |
frontend/views/search/_projects_list_view.php
| 1 | <?php | 1 | <?php |
| 2 | -use frontend\helpers\TextHelper; | 2 | + /** |
| 3 | + * @var Project $model | ||
| 4 | + * @var View $this | ||
| 5 | + */ | ||
| 6 | + use common\models\Project; | ||
| 7 | + use frontend\helpers\TextHelper; | ||
| 3 | use yii\helpers\Html; | 8 | use yii\helpers\Html; |
| 4 | use yii\helpers\Url; | 9 | use yii\helpers\Url; |
| 10 | + use yii\web\View; | ||
| 5 | 11 | ||
| 6 | ?> | 12 | ?> |
| 7 | <div class="search-profile-blocks"> | 13 | <div class="search-profile-blocks"> |
| 8 | <?= Html::a($model->name, Url::toRoute( ['tender/view','tender_id' =>$model->project_id] ), ['class' => 'srch-prof-title']) ?> | 14 | <?= Html::a($model->name, Url::toRoute( ['tender/view','tender_id' =>$model->project_id] ), ['class' => 'srch-prof-title']) ?> |
| 9 | - <div class="srch-prof-budget"><span></span>Бюджет: <?= $model->budget?> <?= $model->budgetCurrency->label?> (<?= $model->contractual ? "Договорной" : "Недоговорной" ?>)</div> | 15 | + <div class="srch-prof-budget"> |
| 16 | + <span></span> | ||
| 17 | + Бюджет: | ||
| 18 | + <?php | ||
| 19 | + if(empty($model->contractual)) { | ||
| 20 | + echo $model->budget.' '.$model->budgetCurrency->label; | ||
| 21 | + } else { | ||
| 22 | + echo "Договорной"; | ||
| 23 | + } | ||
| 24 | + ?> | ||
| 25 | + </div> | ||
| 10 | <div class="srch-prof-contract-wr"> | 26 | <div class="srch-prof-contract-wr"> |
| 11 | 27 | ||
| 12 | <?php if(!empty($model->parent->name)):?> | 28 | <?php if(!empty($model->parent->name)):?> |
| @@ -28,7 +44,7 @@ use yii\helpers\Url; | @@ -28,7 +44,7 @@ use yii\helpers\Url; | ||
| 28 | <img src="/images/ico-clock.png" alt=""/><span><?= Yii::$app->formatter->asDatetime($model->date_end, 'dd.MM.Y')?></span> | 44 | <img src="/images/ico-clock.png" alt=""/><span><?= Yii::$app->formatter->asDatetime($model->date_end, 'dd.MM.Y')?></span> |
| 29 | </div> | 45 | </div> |
| 30 | <div class="srch-prof-params srch-prof-params-comm"> | 46 | <div class="srch-prof-params srch-prof-params-comm"> |
| 31 | - <img src="/images/ico-comm.png" alt=""/><span>4 предложения</span> | 47 | + <img src="/images/ico-comm.png" alt=""/><span>X предложения</span> |
| 32 | </div> | 48 | </div> |
| 33 | </div> | 49 | </div> |
| 34 | </div> | 50 | </div> |
| 35 | \ No newline at end of file | 51 | \ No newline at end of file |
frontend/views/search/project.php
| @@ -70,25 +70,21 @@ | @@ -70,25 +70,21 @@ | ||
| 70 | ]) | 70 | ]) |
| 71 | ->dropDownList($currencies) ?> | 71 | ->dropDownList($currencies) ?> |
| 72 | </div> | 72 | </div> |
| 73 | - <?= $form->field($model, 'contractual', [ 'template' => "{input}\n{error}", 'options' => ['class' => ''] ]) | ||
| 74 | - ->checkboxList([1 => $model->getAttributeLabel('contractual')], [ | ||
| 75 | - 'item' => function($index, $label, $name, $checked, $value) { | ||
| 76 | - $return = '<div class="blocks-check-list" style="margin-bottom: 3px">'; | ||
| 77 | - $return .= '<input type="checkbox" '.($checked ? "checked" : "" ).' name="' . $name . '" class="check-search" value="' . $value . '" id="theme-'.$index.'">'; | ||
| 78 | - $return .= '<label for="theme-'.$index.'"><span></span>'.$label.'</label>'; | ||
| 79 | - $return .= '</div>'; | ||
| 80 | - return $return; | ||
| 81 | - } | ||
| 82 | - ]); ?> | 73 | + <?= $form->field($model, 'contractual', [ |
| 74 | + 'template' => "{input}\n{label}\n{hint}\n{error}", | ||
| 75 | + 'options' => [ 'class' => 'blocks-check-list' ], | ||
| 76 | + ]) | ||
| 77 | + ->label("<span></span>{$model->getAttributeLabel('contractual')}", ['class' => '']) | ||
| 78 | + ->checkbox([ 'uncheck' => NULL ], false) ?> | ||
| 83 | <?= $form->field($model, 'payment', [ 'template' => "{input}\n{error}" ]) | 79 | <?= $form->field($model, 'payment', [ 'template' => "{input}\n{error}" ]) |
| 84 | ->checkboxList($payments, [ | 80 | ->checkboxList($payments, [ |
| 85 | 'item' => function($index, $label, $name, $checked, $value) { | 81 | 'item' => function($index, $label, $name, $checked, $value) { |
| 86 | $return = '<div class="blocks-check-list">'; | 82 | $return = '<div class="blocks-check-list">'; |
| 87 | - $return .= '<input type="checkbox" '.($checked ? "checked" : "" ).' name="' . $name . '" class="check-search" value="' . $value . '" id="theme-'.$index.'">'; | ||
| 88 | - $return .= '<label for="theme-'.$index.'"><span></span>'.$label.'</label>'; | 83 | + $return .= '<input type="checkbox" ' . ( $checked ? "checked" : "" ) . ' name="' . $name . '" class="check-search" value="' . $value . '" id="theme-' . $index . '">'; |
| 84 | + $return .= '<label for="theme-' . $index . '"><span></span>' . $label . '</label>'; | ||
| 89 | $return .= '</div>'; | 85 | $return .= '</div>'; |
| 90 | return $return; | 86 | return $return; |
| 91 | - } | 87 | + }, |
| 92 | ]); ?> | 88 | ]); ?> |
| 93 | </div> | 89 | </div> |
| 94 | <div class="blocks-check-list-submit"> | 90 | <div class="blocks-check-list-submit"> |
| @@ -184,7 +180,7 @@ | @@ -184,7 +180,7 @@ | ||
| 184 | <input type="submit" value="Найти"/> | 180 | <input type="submit" value="Найти"/> |
| 185 | </div> | 181 | </div> |
| 186 | </form> | 182 | </form> |
| 187 | - */?> | 183 | + */ ?> |
| 188 | </div> | 184 | </div> |
| 189 | <div class="right-search-work"> | 185 | <div class="right-search-work"> |
| 190 | <div class="search-worker-title style">Сейчас <?= $dataProvider->totalCount ?> предложений</div> | 186 | <div class="search-worker-title style">Сейчас <?= $dataProvider->totalCount ?> предложений</div> |
frontend/views/tender/view.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -use \yii\helpers\Html; | 3 | + /** |
| 4 | + * @var View $this | ||
| 5 | + * @var Project $model | ||
| 6 | + */ | ||
| 7 | + use common\models\Project; | ||
| 8 | + use \yii\helpers\Html; | ||
| 4 | use yii\helpers\Url; | 9 | use yii\helpers\Url; |
| 5 | -use yii\widgets\DetailView; | ||
| 6 | - | ||
| 7 | - /* @var $this yii\web\View */ | 10 | + use yii\web\View; |
| 11 | + use yii\widgets\DetailView; | ||
| 8 | 12 | ||
| 9 | $this->title = 'My Yii Application'; | 13 | $this->title = 'My Yii Application'; |
| 10 | ?> | 14 | ?> |
| @@ -197,6 +201,35 @@ $this->title = 'My Yii Application'; | @@ -197,6 +201,35 @@ $this->title = 'My Yii Application'; | ||
| 197 | </div> | 201 | </div> |
| 198 | <div id="map_canvas" style="width: 100%; height:100%;"></div> | 202 | <div id="map_canvas" style="width: 100%; height:100%;"></div> |
| 199 | </div> | 203 | </div> |
| 204 | + <?php | ||
| 205 | + echo \common\modules\comment\widgets\CommentWidget::widget([ | ||
| 206 | + 'context' => $this, | ||
| 207 | + 'model' => $model::className(), | ||
| 208 | + 'model_id' => $model->project_id, | ||
| 209 | + 'comment_class' => \common\modules\comment\models\CommentProject::className(), | ||
| 210 | + 'class_options' => [ | ||
| 211 | + 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, | ||
| 212 | + 'user_id' => \Yii::$app->user->getId(), | ||
| 213 | + 'guestComment' => false, | ||
| 214 | + 'status' => \common\modules\comment\models\CommentProject::STATUS_ACTIVE, | ||
| 215 | + ], | ||
| 216 | + 'list_options' => [ | ||
| 217 | + 'view' => 'list-project-comment', | ||
| 218 | + 'class' => 'section box tender-offer-proj-wr', | ||
| 219 | + ], | ||
| 220 | + 'form_options' => [ | ||
| 221 | + 'view' => 'form-project-comment', | ||
| 222 | + 'tag' => 'div', | ||
| 223 | + 'class' => 'artbox_comment_form section-box tender-add-answer', | ||
| 224 | + ], | ||
| 225 | + 'options' => [ | ||
| 226 | + 'tag' => false, | ||
| 227 | + ], | ||
| 228 | + ]); | ||
| 229 | + ?> | ||
| 230 | + <?php | ||
| 231 | + /* | ||
| 232 | + ?> | ||
| 200 | <div class="section-box tender-add-answer"> | 233 | <div class="section-box tender-add-answer"> |
| 201 | <div class="box-wr"> | 234 | <div class="box-wr"> |
| 202 | <div class="box-all"> | 235 | <div class="box-all"> |
| @@ -383,6 +416,9 @@ $this->title = 'My Yii Application'; | @@ -383,6 +416,9 @@ $this->title = 'My Yii Application'; | ||
| 383 | </div> | 416 | </div> |
| 384 | </div> | 417 | </div> |
| 385 | </div> | 418 | </div> |
| 419 | + <?php | ||
| 420 | + */ | ||
| 421 | + ?> | ||
| 386 | </div> | 422 | </div> |
| 387 | <script> | 423 | <script> |
| 388 | $('div.rating, div.rating-new').rating({ | 424 | $('div.rating, div.rating-new').rating({ |