Commit 38a6e1ddae8bc32dd9b7a2559aace1ae1546af7a
1 parent
68d14cf6
test
Showing
21 changed files
with
519 additions
and
174 deletions
Show diff stats
common/models/Job.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace common\models; | |
| 3 | + namespace common\models; | |
| 4 | 4 | |
| 5 | -use Yii; | |
| 5 | + use Yii; | |
| 6 | 6 | |
| 7 | -/** | |
| 8 | - * This is the model class for table "job". | |
| 9 | - * | |
| 10 | - * @property integer $job_id | |
| 11 | - * @property string $name | |
| 12 | - * @property string $link | |
| 13 | - * @property string $date_start | |
| 14 | - * @property string $date_end | |
| 15 | - * @property string $position | |
| 16 | - * @property integer $user_id | |
| 17 | - * @property integer $total_count | |
| 18 | - * @property integer $complete_count | |
| 19 | - * @property integer $current | |
| 20 | - */ | |
| 21 | -class Job extends \yii\db\ActiveRecord | |
| 22 | -{ | |
| 23 | 7 | /** |
| 24 | - * @inheritdoc | |
| 8 | + * This is the model class for table "job". | |
| 9 | + * @property integer $job_id | |
| 10 | + * @property string $name | |
| 11 | + * @property string $link | |
| 12 | + * @property string $date_start | |
| 13 | + * @property string $date_end | |
| 14 | + * @property string $position | |
| 15 | + * @property integer $user_id | |
| 16 | + * @property integer $total_count | |
| 17 | + * @property integer $complete_count | |
| 18 | + * @property integer $current | |
| 25 | 19 | */ |
| 26 | - public static function tableName() | |
| 20 | + class Job extends \yii\db\ActiveRecord | |
| 27 | 21 | { |
| 28 | - return 'job'; | |
| 29 | - } | |
| 30 | - | |
| 31 | 22 | |
| 32 | - /** | |
| 33 | - * @inheritdoc | |
| 34 | - */ | |
| 35 | - public function behaviors() | |
| 36 | - { | |
| 37 | - return [ | |
| 38 | - 'slug' => [ | |
| 39 | - 'class' => 'common\behaviors\Slug', | |
| 40 | - 'in_attribute' => 'name', | |
| 41 | - 'out_attribute' => 'link', | |
| 42 | - 'translit' => true | |
| 43 | - ] | |
| 44 | - ]; | |
| 45 | - } | |
| 23 | + /** | |
| 24 | + * @inheritdoc | |
| 25 | + */ | |
| 26 | + public static function tableName() | |
| 27 | + { | |
| 28 | + return 'job'; | |
| 29 | + } | |
| 46 | 30 | |
| 47 | - public function beforeSave($insert) | |
| 48 | - { | |
| 49 | - $this->date_start = \Yii::$app->formatter->asDatetime($this->date_start, 'Y-MM-d HH:mm:ss'); | |
| 31 | + /** | |
| 32 | + * @inheritdoc | |
| 33 | + */ | |
| 34 | + public function behaviors() | |
| 35 | + { | |
| 36 | + return [ | |
| 50 | 37 | |
| 51 | - if($this->date_end) { | |
| 52 | - $this->date_end = \Yii::$app->formatter->asDatetime($this->date_end, 'Y-MM-d HH:mm:ss'); | |
| 38 | + ]; | |
| 53 | 39 | } |
| 54 | 40 | |
| 41 | + public function beforeSave($insert) | |
| 42 | + { | |
| 43 | + $this->date_start = \Yii::$app->formatter->asDatetime($this->date_start, 'Y-MM-d HH:mm:ss'); | |
| 55 | 44 | |
| 56 | - return parent::beforeSave($insert); // TODO: Change the autogenerated stub | |
| 57 | - } | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * @inheritdoc | |
| 61 | - */ | |
| 62 | - public function rules() | |
| 63 | - { | |
| 64 | - return [ | |
| 65 | - [['name'], 'required'], | |
| 66 | - [['date_start', 'date_end'], 'safe'], | |
| 67 | - [['user_id', 'total_count', 'complete_count', 'current'], 'integer'], | |
| 68 | - [['name', 'link', 'position'], 'string', 'max' => 255] | |
| 69 | - ]; | |
| 70 | - } | |
| 71 | - | |
| 45 | + if($this->date_end) { | |
| 46 | + $this->date_end = \Yii::$app->formatter->asDatetime($this->date_end, 'Y-MM-d HH:mm:ss'); | |
| 47 | + } | |
| 72 | 48 | |
| 49 | + return parent::beforeSave($insert); // TODO: Change the autogenerated stub | |
| 50 | + } | |
| 73 | 51 | |
| 74 | - public function getExpTime() | |
| 75 | - { | |
| 76 | - if($this->date_end && $this->date_start){ | |
| 77 | - $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start)); | |
| 78 | - return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $this->date_end)))); | |
| 79 | - } elseif($this->date_start) { | |
| 80 | - $now = new \DateTime(); | |
| 81 | - $date = new \DateTime(date('Y-m-d H:i:s', strtotime($this->date_start))); | |
| 82 | - return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime())); | |
| 83 | - } else { | |
| 84 | - return 'ะฝะตะธะทะฒะตััะฝะฐ ะดะฐัะฐ ะฝะฐัะฐะปะฐ'; | |
| 52 | + /** | |
| 53 | + * @inheritdoc | |
| 54 | + */ | |
| 55 | + public function rules() | |
| 56 | + { | |
| 57 | + return [ | |
| 58 | + [ | |
| 59 | + [ 'name' ], | |
| 60 | + 'required', | |
| 61 | + ], | |
| 62 | + [ | |
| 63 | + [ | |
| 64 | + 'date_start', | |
| 65 | + 'date_end', | |
| 66 | + ], | |
| 67 | + 'safe', | |
| 68 | + ], | |
| 69 | + [ | |
| 70 | + [ | |
| 71 | + 'user_id', | |
| 72 | + 'total_count', | |
| 73 | + 'complete_count', | |
| 74 | + 'current', | |
| 75 | + ], | |
| 76 | + 'integer', | |
| 77 | + ], | |
| 78 | + [ | |
| 79 | + [ | |
| 80 | + 'name', | |
| 81 | + 'link', | |
| 82 | + 'position', | |
| 83 | + ], | |
| 84 | + 'string', | |
| 85 | + 'max' => 255, | |
| 86 | + ], | |
| 87 | + ]; | |
| 85 | 88 | } |
| 86 | 89 | |
| 87 | - } | |
| 90 | + public function getExpTime() | |
| 91 | + { | |
| 92 | + if($this->date_end && $this->date_start) { | |
| 93 | + $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start)); | |
| 94 | + return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $this->date_end)))); | |
| 95 | + } elseif($this->date_start) { | |
| 96 | + $now = new \DateTime(); | |
| 97 | + $date = new \DateTime(date('Y-m-d H:i:s', strtotime($this->date_start))); | |
| 98 | + return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime())); | |
| 99 | + } else { | |
| 100 | + return 'ะฝะตะธะทะฒะตััะฝะฐ ะดะฐัะฐ ะฝะฐัะฐะปะฐ'; | |
| 101 | + } | |
| 88 | 102 | |
| 103 | + } | |
| 89 | 104 | |
| 90 | - /** | |
| 91 | - * @inheritdoc | |
| 92 | - */ | |
| 93 | - public function attributeLabels() | |
| 94 | - { | |
| 95 | - return [ | |
| 96 | - 'job_id' => Yii::t('app', 'Job ID'), | |
| 97 | - 'name' => Yii::t('app', 'Name'), | |
| 98 | - 'link' => Yii::t('app', 'Link'), | |
| 99 | - 'date_start' => Yii::t('app', 'Date Start'), | |
| 100 | - 'date_end' => Yii::t('app', 'Date End'), | |
| 101 | - 'position' => Yii::t('app', 'Position'), | |
| 102 | - 'user_id' => Yii::t('app', 'User ID'), | |
| 103 | - 'total_count' => Yii::t('app', 'Total Count'), | |
| 104 | - 'complete_count' => Yii::t('app', 'Complete Count'), | |
| 105 | - 'current' => Yii::t('app', 'Current'), | |
| 106 | - ]; | |
| 105 | + /** | |
| 106 | + * @inheritdoc | |
| 107 | + */ | |
| 108 | + public function attributeLabels() | |
| 109 | + { | |
| 110 | + return [ | |
| 111 | + 'job_id' => Yii::t('app', 'Job ID'), | |
| 112 | + 'name' => Yii::t('app', 'Name'), | |
| 113 | + 'link' => Yii::t('app', 'Link'), | |
| 114 | + 'date_start' => Yii::t('app', 'Date Start'), | |
| 115 | + 'date_end' => Yii::t('app', 'Date End'), | |
| 116 | + 'position' => Yii::t('app', 'Position'), | |
| 117 | + 'user_id' => Yii::t('app', 'User ID'), | |
| 118 | + 'total_count' => Yii::t('app', 'Total Count'), | |
| 119 | + 'complete_count' => Yii::t('app', 'Complete Count'), | |
| 120 | + 'current' => Yii::t('app', 'Current'), | |
| 121 | + ]; | |
| 122 | + } | |
| 107 | 123 | } |
| 108 | -} | ... | ... |
common/models/User.php
| ... | ... | @@ -133,6 +133,14 @@ |
| 133 | 133 | 'default', |
| 134 | 134 | 'value' => 1, |
| 135 | 135 | ], |
| 136 | + [ | |
| 137 | + [ | |
| 138 | + 'specializationInput', | |
| 139 | + 'paymentInput', | |
| 140 | + ], | |
| 141 | + 'default', | |
| 142 | + 'value' => [ ], | |
| 143 | + ], | |
| 136 | 144 | ]; |
| 137 | 145 | } |
| 138 | 146 | |
| ... | ... | @@ -513,7 +521,7 @@ |
| 513 | 521 | */ |
| 514 | 522 | public function getJobs() |
| 515 | 523 | { |
| 516 | - return $this->hasMany(Job::className(), [ 'user_id' => 'id' ]); | |
| 524 | + return $this->hasMany(Job::className(), [ 'user_id' => 'id' ])->orderBy(['current' => SORT_DESC]); | |
| 517 | 525 | } |
| 518 | 526 | |
| 519 | 527 | /** |
| ... | ... | @@ -771,4 +779,30 @@ |
| 771 | 779 | ]); |
| 772 | 780 | }); |
| 773 | 781 | } |
| 782 | + | |
| 783 | + public function getBookmarksVacancies() | |
| 784 | + { | |
| 785 | + return $this->hasMany(Vacancy::className(), [ 'vacancy_id' => 'model_id' ]) | |
| 786 | + ->viaTable('{{%bookmark}}', [ 'user_id' => 'id' ], function($query) { | |
| 787 | + /** | |
| 788 | + * @var ActiveQuery $query | |
| 789 | + */ | |
| 790 | + $query->andWhere([ | |
| 791 | + 'model' => Vacancy::className(), | |
| 792 | + 'type' => Bookmark::TYPE_VACANCY, | |
| 793 | + ]); | |
| 794 | + }); | |
| 795 | + } | |
| 796 | + | |
| 797 | + public function getChatCount() | |
| 798 | + { | |
| 799 | + return Chat::find() | |
| 800 | + ->select('COUNT(*)') | |
| 801 | + ->where([ | |
| 802 | + 'or', | |
| 803 | + [ 'from_user' => $this->id ], | |
| 804 | + [ 'to_user' => $this->id ], | |
| 805 | + ]) | |
| 806 | + ->scalar(); | |
| 807 | + } | |
| 774 | 808 | } | ... | ... |
common/models/UserInfo.php
common/modules/comment/Controller.php
common/modules/comment/models/CommentProject.php
| ... | ... | @@ -25,6 +25,7 @@ |
| 25 | 25 | * @property float $budget_to |
| 26 | 26 | * @property int $term_from |
| 27 | 27 | * @property int $term_to |
| 28 | + * @property int $state | |
| 28 | 29 | * @property Currency $currency |
| 29 | 30 | * @package common\modules\comment\models |
| 30 | 31 | */ |
| ... | ... | @@ -38,8 +39,16 @@ |
| 38 | 39 | const STATUS_PERSONAL = 3; |
| 39 | 40 | const STATUS_ANONYMOUS = 4; |
| 40 | 41 | |
| 42 | + const STATE_NEW = 1; | |
| 43 | + const STATE_CANDIDATE = 2; | |
| 44 | + const STATE_PERFORMER = 3; | |
| 45 | + const STATE_DENY = 4; | |
| 46 | + const STATE_TRASH = 5; | |
| 47 | + | |
| 41 | 48 | const SCENARIO_USER = 'user'; |
| 42 | 49 | const SCENARIO_GUEST = 'guest'; |
| 50 | + const SCENARIO_STATE = 'state'; | |
| 51 | + const SCENARIO_OWNER = 'owner'; | |
| 43 | 52 | |
| 44 | 53 | /** |
| 45 | 54 | * @var bool |
| ... | ... | @@ -108,6 +117,29 @@ |
| 108 | 117 | 'default', |
| 109 | 118 | 'value' => 1, |
| 110 | 119 | ], |
| 120 | + [ | |
| 121 | + [ 'state' ], | |
| 122 | + 'integer', | |
| 123 | + 'max' => 4, | |
| 124 | + 'min' => 1, | |
| 125 | + 'on' => self::SCENARIO_STATE, | |
| 126 | + ], | |
| 127 | + [ | |
| 128 | + [ 'state' ], | |
| 129 | + 'required', | |
| 130 | + 'on' => self::SCENARIO_STATE, | |
| 131 | + ], | |
| 132 | + [ | |
| 133 | + [ 'state' ], | |
| 134 | + 'required', | |
| 135 | + 'on' => self::SCENARIO_OWNER, | |
| 136 | + ], | |
| 137 | + [ | |
| 138 | + [ 'state' ], | |
| 139 | + 'in', | |
| 140 | + 'range' => [1, 5], | |
| 141 | + 'on' => self::SCENARIO_OWNER, | |
| 142 | + ], | |
| 111 | 143 | ]; |
| 112 | 144 | } |
| 113 | 145 | |
| ... | ... | @@ -125,6 +157,9 @@ |
| 125 | 157 | self::SCENARIO_GUEST => [ |
| 126 | 158 | |
| 127 | 159 | ], |
| 160 | + self::SCENARIO_STATE => [ | |
| 161 | + 'state', | |
| 162 | + ], | |
| 128 | 163 | ]; |
| 129 | 164 | } |
| 130 | 165 | |
| ... | ... | @@ -370,7 +405,20 @@ |
| 370 | 405 | */ |
| 371 | 406 | public function getUser() |
| 372 | 407 | { |
| 373 | - return $this->hasOne(User::className(), ['id' => 'user_id']); | |
| 408 | + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); | |
| 409 | + } | |
| 410 | + | |
| 411 | + public function changeState() | |
| 412 | + { | |
| 413 | + if($this->isAttributeChanged('state')) { | |
| 414 | + if($this->save()) { | |
| 415 | + return true; | |
| 416 | + } else { | |
| 417 | + return false; | |
| 418 | + } | |
| 419 | + } else { | |
| 420 | + return true; | |
| 421 | + } | |
| 374 | 422 | } |
| 375 | 423 | |
| 376 | 424 | } | ... | ... |
common/modules/comment/rbac/ArtboxCommentCreateRule.php
| ... | ... | @@ -11,7 +11,24 @@ |
| 11 | 11 | |
| 12 | 12 | public function execute($user, $item, $params) |
| 13 | 13 | { |
| 14 | + if($params[ 'model' ] == \common\models\Project::className()) { | |
| 15 | + return $this->checkProject($user, $item, $params); | |
| 16 | + } | |
| 14 | 17 | return true; |
| 15 | 18 | } |
| 16 | 19 | |
| 20 | + public function checkProject($user, $item, $params) | |
| 21 | + { | |
| 22 | + $comment = \common\modules\comment\models\CommentProject::find() | |
| 23 | + ->where([ 'model' => $params[ 'model' ], | |
| 24 | + 'model_id' => $params[ 'model_id' ], | |
| 25 | + 'user_id' => $user, | |
| 26 | + ])->one(); | |
| 27 | + if(empty($comment)) { | |
| 28 | + return true; | |
| 29 | + } else { | |
| 30 | + return false; | |
| 31 | + } | |
| 32 | + } | |
| 33 | + | |
| 17 | 34 | } |
| 18 | 35 | \ No newline at end of file | ... | ... |
common/modules/comment/widgets/CommentWidget.php
| ... | ... | @@ -167,7 +167,7 @@ |
| 167 | 167 | $this->parts[ 'list' ] = Html::tag($tag, $this->renderItems($view), $this->list_options); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if($this->display_comment_form) { | |
| 170 | + if($this->display_comment_form && $this->comment_class->checkCreate()) { | |
| 171 | 171 | $tag = ArrayHelper::remove($this->form_options, 'tag', 'div'); |
| 172 | 172 | $view = ArrayHelper::remove($this->form_options, 'view'); |
| 173 | 173 | $this->parts[ 'form' ] = Html::tag($tag, $this->renderForm($view), $this->form_options); | ... | ... |
common/modules/comment/widgets/views/_project_comment_view.php
| ... | ... | @@ -82,7 +82,7 @@ |
| 82 | 82 | <!--ะพัะตะฝะบะฐ--> |
| 83 | 83 | <input type="hidden" class="val" value="<?= $user->userInfo->rating ?>"/> |
| 84 | 84 | </div> |
| 85 | - <?= Html::a(count($user->comments). ' ะพัะทัะฒะพะฒ', $user->getLink('review'), ['class' => 'link-to-comm']) ?> | |
| 85 | + <?= Html::a(count($user->comments) . ' ะพัะทัะฒะพะฒ', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?> | |
| 86 | 86 | </div> |
| 87 | 87 | <div class="tender-offer-proj-txt"> |
| 88 | 88 | <?= $model->text ?> |
| ... | ... | @@ -93,8 +93,11 @@ |
| 93 | 93 | ?> |
| 94 | 94 | <li> |
| 95 | 95 | <span></span> |
| 96 | - <?= Html::a($file->name, $file->dir, ['class' => 'download-link-file']) ?> | |
| 97 | - <?= Html::a('ะกะบะฐัะฐัั', $file->dir, ['class' => 'download-link', 'download' => 'download']) ?> | |
| 96 | + <?= Html::a($file->name, $file->dir, [ 'class' => 'download-link-file' ]) ?> | |
| 97 | + <?= Html::a('ะกะบะฐัะฐัั', $file->dir, [ | |
| 98 | + 'class' => 'download-link', | |
| 99 | + 'download' => 'download', | |
| 100 | + ]) ?> | |
| 98 | 101 | </li> |
| 99 | 102 | <?php |
| 100 | 103 | } |
| ... | ... | @@ -102,8 +105,39 @@ |
| 102 | 105 | </ul> |
| 103 | 106 | </div> |
| 104 | 107 | <div class="tender-more-buttons-wr"> |
| 105 | - <?= Html::a('ะะพัััะพะปะธะพ', $user->getLink('portfolio'), ['class' => 'get-project-new']) ?> | |
| 106 | - <?= Html::a('ะะพะฝัะฐะบัั', $user->link, ['class' => 'get-list-new']) ?> | |
| 108 | + <?= Html::a('ะะพัััะพะปะธะพ', $user->getLink('portfolio'), [ 'class' => 'get-project-new' ]) ?> | |
| 109 | + <?= Html::a('ะะพะฝัะฐะบัั', $user->link, [ 'class' => 'get-list-new' ]) ?> | |
| 107 | 110 | </div> |
| 111 | + <?php | |
| 112 | + if(\Yii::$app->user->getId() == $model->owner->user_id) { | |
| 113 | + ?> | |
| 114 | + <div class="project_owner_control" style="clear:both"> | |
| 115 | + <span>ะัะผะตัะธัั ะบะฐะบ: </span> | |
| 116 | + <?php | |
| 117 | + echo Html::a('ะฝะพะฒัะน', [ '#' ], [ | |
| 118 | + 'data-project-id' => $model->owner->project_id, | |
| 119 | + 'data-comment-id' => $model->comment_id, | |
| 120 | + 'class' => 'artbox_project_make_new', | |
| 121 | + ]); | |
| 122 | + echo Html::a('ะบะฐะฝะดะธะดะฐั', [ '#' ], [ | |
| 123 | + 'data-project-id' => $model->owner->project_id, | |
| 124 | + 'data-comment-id' => $model->comment_id, | |
| 125 | + 'class' => 'artbox_project_make_candidate', | |
| 126 | + ]); | |
| 127 | + echo Html::a('ะธัะฟะพะปะฝะธัะตะปั', [ '#' ], [ | |
| 128 | + 'data-project-id' => $model->owner->project_id, | |
| 129 | + 'data-comment-id' => $model->comment_id, | |
| 130 | + 'class' => 'artbox_project_make_performer', | |
| 131 | + ]); | |
| 132 | + echo Html::a('ะพัะบะฐะทะฐัั', [ '#' ], [ | |
| 133 | + 'data-project-id' => $model->owner->project_id, | |
| 134 | + 'data-comment-id' => $model->comment_id, | |
| 135 | + 'class' => 'artbox_project_make_deny', | |
| 136 | + ]); | |
| 137 | + ?> | |
| 138 | + </div> | |
| 139 | + <?php | |
| 140 | + } | |
| 141 | + ?> | |
| 108 | 142 | |
| 109 | 143 | </div> | ... | ... |
console/migrations/m160317_143914_project_state_add.php
0 โ 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\db\Migration; | |
| 4 | + | |
| 5 | +class m160317_143914_project_state_add extends Migration | |
| 6 | +{ | |
| 7 | + public function up() | |
| 8 | + { | |
| 9 | + $this->addColumn('{{%comment_project}}', 'state', $this->integer()->notNull()->defaultValue(1)); | |
| 10 | + } | |
| 11 | + | |
| 12 | + public function down() | |
| 13 | + { | |
| 14 | + $this->dropColumn('{{%comment_project}}', 'state'); | |
| 15 | + } | |
| 16 | + | |
| 17 | +} | ... | ... |
frontend/controllers/AccountsController.php
| ... | ... | @@ -842,12 +842,16 @@ |
| 842 | 842 | $user_info->save(); |
| 843 | 843 | $user->load($post); |
| 844 | 844 | $user->unlinkAll('specializations', true); |
| 845 | - foreach($user->specializationInput as $one_specialization) { | |
| 846 | - $user->link('specializations', Specialization::findOne($one_specialization)); | |
| 845 | + if(is_array($user->specializationInput)) { | |
| 846 | + foreach($user->specializationInput as $one_specialization) { | |
| 847 | + $user->link('specializations', Specialization::findOne($one_specialization)); | |
| 848 | + } | |
| 847 | 849 | } |
| 848 | 850 | $user->unlinkAll('payments', true); |
| 849 | - foreach($user->paymentInput as $one_payment) { | |
| 850 | - $user->link('payments', Payment::findOne($one_payment)); | |
| 851 | + if(is_array($user->paymentInput)) { | |
| 852 | + foreach($user->paymentInput as $one_payment) { | |
| 853 | + $user->link('payments', Payment::findOne($one_payment)); | |
| 854 | + } | |
| 851 | 855 | } |
| 852 | 856 | } |
| 853 | 857 | } | ... | ... |
frontend/controllers/BookmarksController.php
| ... | ... | @@ -103,6 +103,24 @@ |
| 103 | 103 | ]); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | + public function actionVacancy() | |
| 107 | + { | |
| 108 | + /** | |
| 109 | + * @var User $user | |
| 110 | + */ | |
| 111 | + $user = \Yii::$app->user->identity; | |
| 112 | + $dataProvider = new ActiveDataProvider([ | |
| 113 | + 'query' => $user->getBookmarksVacancies(), | |
| 114 | + 'pagination' => [ | |
| 115 | + 'pageSize' => 10, | |
| 116 | + ], | |
| 117 | + ]); | |
| 118 | + return $this->render('bookmarks-vacancy', [ | |
| 119 | + 'dataProvider' => $dataProvider, | |
| 120 | + 'user' => $user, | |
| 121 | + ]); | |
| 122 | + } | |
| 123 | + | |
| 106 | 124 | public function actionAddPerformer() |
| 107 | 125 | { |
| 108 | 126 | $response = \Yii::$app->response; | ... | ... |
frontend/controllers/PerformerController.php
| ... | ... | @@ -57,7 +57,10 @@ |
| 57 | 57 | public function actionCommon($performer_id) |
| 58 | 58 | { |
| 59 | 59 | |
| 60 | - $user = User::findOne($performer_id); | |
| 60 | + $user = User::find() | |
| 61 | + ->where([ 'id' => $performer_id ]) | |
| 62 | + ->with('jobs') | |
| 63 | + ->one(); | |
| 61 | 64 | |
| 62 | 65 | if(!$user instanceof User) { |
| 63 | 66 | throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); |
| ... | ... | @@ -216,7 +219,8 @@ |
| 216 | 219 | 'link' => $link, |
| 217 | 220 | 'user_id' => $performer_id, |
| 218 | 221 | ]) |
| 219 | - ->with('comments')->one(); | |
| 222 | + ->with('comments') | |
| 223 | + ->one(); | |
| 220 | 224 | $article->updateCounters([ 'view_count' => 1 ]); |
| 221 | 225 | |
| 222 | 226 | return $this->render('blog-view', [ | ... | ... |
frontend/controllers/TenderController.php
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | namespace frontend\controllers; |
| 3 | 3 | |
| 4 | 4 | use common\models\Project; |
| 5 | +use common\modules\comment\models\CommentProject; | |
| 5 | 6 | use Yii; |
| 6 | 7 | use common\models\LoginForm; |
| 7 | 8 | use frontend\models\PasswordResetRequestForm; |
| ... | ... | @@ -29,6 +30,8 @@ use common\models\Social; |
| 29 | 30 | */ |
| 30 | 31 | class TenderController extends Controller |
| 31 | 32 | { |
| 33 | + | |
| 34 | + public $enableCsrfValidation = false; | |
| 32 | 35 | /** |
| 33 | 36 | * @inheritdoc |
| 34 | 37 | */ |
| ... | ... | @@ -42,6 +45,12 @@ class TenderController extends Controller |
| 42 | 45 | 'class' => 'yii\captcha\CaptchaAction', |
| 43 | 46 | 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, |
| 44 | 47 | ], |
| 48 | + 'verbs' => [ | |
| 49 | + 'class' => \yii\filters\VerbFilter::className(), | |
| 50 | + 'actions' => [ | |
| 51 | + 'change-state' => ['post'], | |
| 52 | + ], | |
| 53 | + ], | |
| 45 | 54 | ]; |
| 46 | 55 | } |
| 47 | 56 | /** |
| ... | ... | @@ -63,4 +72,49 @@ class TenderController extends Controller |
| 63 | 72 | ]); |
| 64 | 73 | } |
| 65 | 74 | |
| 75 | + public function actionChangeState() | |
| 76 | + { | |
| 77 | + /** | |
| 78 | + * @var User $user | |
| 79 | + */ | |
| 80 | + $response = \Yii::$app->response; | |
| 81 | + $response->format = $response::FORMAT_JSON; | |
| 82 | + $user = \Yii::$app->user->identity; | |
| 83 | + $project_id = \Yii::$app->request->post('project_id'); | |
| 84 | + $comment_id = \Yii::$app->request->post('comment_id'); | |
| 85 | + $state = \Yii::$app->request->post('state'); | |
| 86 | + if(empty($project_id) || empty($comment_id) || empty($state)) { | |
| 87 | + return ['error' => 'project_id, comment_id, state ะดะพะปะถะฝั ะฑััั ะพัะฟัะฐะฒะปะตะฝั ะฒ ะทะฐะฟัะพัะต']; | |
| 88 | + } | |
| 89 | + /** | |
| 90 | + * @var Project $project | |
| 91 | + */ | |
| 92 | + $project = Project::findOne($project_id); | |
| 93 | + if(empty($project)) { | |
| 94 | + return ['error' => 'ะัะพะตะบั ะฝะต ะฝะฐะนะดะตะฝ']; | |
| 95 | + } elseif($project->user_id != $user->id) { | |
| 96 | + return ['error' => 'ะั ะผะพะถะตัะต ะผะตะฝััั ััะฐััั ัะพะปัะบะพ ัะพะฑััะฒะตะฝะฝัั ะฟัะพะตะบัะพะฒ']; | |
| 97 | + } | |
| 98 | + /** | |
| 99 | + * @var CommentProject $comment | |
| 100 | + */ | |
| 101 | + $comment = CommentProject::find()->where(['comment_id' => $comment_id, 'model' => $project->className(), 'model_id' => $project->project_id])->one(); | |
| 102 | + if(empty($comment)) { | |
| 103 | + return ['error' => 'ะะฐะฝะฝะพะณะพ ะฟัะตะดะปะพะถะตะฝะธั ะฝะต ัััะตััะฒัะตั']; | |
| 104 | + } | |
| 105 | + if($comment->state == $comment::STATE_TRASH) { | |
| 106 | + return ['error' => 'ะัะฟะพะปะฝะธัะตะปั ะพัะผะตะฝะธะป ะดะฐะฝะฝะพะต ะฟัะตะดะปะพะถะตะฝะธะต']; | |
| 107 | + } | |
| 108 | + $comment->scenario = $comment::SCENARIO_STATE; | |
| 109 | + $comment->state = $state; | |
| 110 | + if(!$comment->validate()) { | |
| 111 | + return ['error' => 'ะะตะดะพะฟัััะธะผะพะต ะทะฝะฐัะตะฝะธะต state']; | |
| 112 | + } | |
| 113 | + if($comment->changeState()) { | |
| 114 | + return ['message' => 'ะะฒัะพั ะพะฟะพะฒะตัะตะฝ ะพ ะฒะฐัะตะผ ัะตัะตะฝะธะธ']; | |
| 115 | + } else { | |
| 116 | + return ['error' => 'ะัะธะฑะบะฐ ะพะฑะฝะพะฒะปะตะฝะธั.']; | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 66 | 120 | } | ... | ... |
frontend/views/accounts/employment.php
frontend/views/bookmarks/bookmarks-vacancy.php
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | <div class="box-wr"> |
| 18 | 18 | <div class="box-all"> |
| 19 | 19 | <div class="left-search-work"> |
| 20 | - <div class="search-performer-button-bookmark"><a>ะัะพะตะบัั</a></div> | |
| 20 | + <div class="search-performer-button-bookmark"><a>ะะฐะบะปะฐะดะบะธ</a></div> | |
| 21 | 21 | <?= Html::a('ะัะฟะพะปะฝะธัะตะปะธ', [ 'bookmarks/performer' ], [ 'class' => 'search-performer-button-performers' ]) ?> |
| 22 | 22 | <?= Html::a('ะะฐะบะฐะทัะธะบะธ', [ 'bookmarks/customer' ], [ 'class' => 'search-performer-button-customers' ]) ?> |
| 23 | 23 | <?= Html::a('ะัะพะตะบัั', [ 'bookmarks/project' ], [ 'class' => 'search-performer-button-project' ]) ?> | ... | ... |
frontend/views/layouts/main.php
| ... | ... | @@ -158,7 +158,7 @@ AppAsset::register($this); |
| 158 | 158 | ], |
| 159 | 159 | [ |
| 160 | 160 | 'url' => ['chat/list'], |
| 161 | - 'template' => '<a href="{url}" class="main-menu-icons-edit"><span>28</span></a>', | |
| 161 | + 'template' => '<a href="{url}" class="main-menu-icons-edit"><span>'.\Yii::$app->user->identity->chatCount.'</span></a>', | |
| 162 | 162 | ], |
| 163 | 163 | [ |
| 164 | 164 | 'url' => ['/bookmarks'], | ... | ... |
frontend/views/layouts/performer.php
| ... | ... | @@ -35,11 +35,11 @@ |
| 35 | 35 | <div class="box-all"> |
| 36 | 36 | <?php |
| 37 | 37 | echo Menu::widget([ |
| 38 | - 'options' => [ | |
| 38 | + 'options' => [ | |
| 39 | 39 | 'class' => 'menu-content', |
| 40 | 40 | ], |
| 41 | 41 | 'activeCssClass' => 'active-menu-content', |
| 42 | - 'items' => [ | |
| 42 | + 'items' => [ | |
| 43 | 43 | [ |
| 44 | 44 | 'label' => 'ะะฑัะตะต', |
| 45 | 45 | 'url' => [ |
| ... | ... | @@ -94,7 +94,7 @@ |
| 94 | 94 | <div class="performer-vacancy-sidebar-left-wr"> |
| 95 | 95 | <div class="performer-vacancy-sidebar-left"> |
| 96 | 96 | <div class="performance-vacancy-sidebar-company-wr"> |
| 97 | - <div class="performance-vacancy-sidebar-company-title style">ะะพะทะฝัะบะธะถะธะปัััะพะน</div> | |
| 97 | + <div class="performance-vacancy-sidebar-company-title style"><?= $this->params[ 'user' ]->name ?></div> | |
| 98 | 98 | <div class="performance-vacancy-sidebar-company-job style"> |
| 99 | 99 | <ul> |
| 100 | 100 | <li class="activejob"> |
| ... | ... | @@ -112,21 +112,21 @@ |
| 112 | 112 | <div class="performance-vacancy-sidebar-stars style"> |
| 113 | 113 | <div class="rating"> |
| 114 | 114 | <!--ะพัะตะฝะบะฐ--> |
| 115 | - <input type="hidden" class="val" value="<?= $this->params['user']->userInfo->rating ?>"/> | |
| 115 | + <input type="hidden" class="val" value="<?= $this->params[ 'user' ]->userInfo->rating ?>"/> | |
| 116 | 116 | <!--ะบะพะปะธัะตััะฒะพ ะณะพะปะพัะพะฒ--> |
| 117 | 117 | <input type="hidden" class="votes" value="1"/> |
| 118 | 118 | </div> |
| 119 | 119 | </div> |
| 120 | - <div class="performance-vacancy-sidebar-comm style"><?= count($this->params['user']->comments) ?> ะพัะทัะฒะพะฒ</div> | |
| 120 | + <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'user' ]->comments) ?> ะพัะทัะฒะพะฒ</div> | |
| 121 | 121 | <a href="#" class="performance-vacancy-sidebar-write style">ะฝะฐะฟะธัะฐัั ะพัะทัะฒ</a> |
| 122 | 122 | </div> |
| 123 | 123 | <div class="performer-vacancy-sidebar-img style"> |
| 124 | 124 | <?= Html::img($this->params[ 'user' ]->userInfo->image); ?> |
| 125 | 125 | </div> |
| 126 | 126 | <div class="performer-vacancy-sidebar-all style"> |
| 127 | - <?= $this->render('/patrial/social_list',[ | |
| 128 | - 'params' => $this->params | |
| 129 | - ])?> | |
| 127 | + <?= $this->render('/patrial/social_list', [ | |
| 128 | + 'params' => $this->params, | |
| 129 | + ]) ?> | |
| 130 | 130 | <div class="performer-vacancy-sidebar-views style"> |
| 131 | 131 | <ul class="style"> |
| 132 | 132 | <li><img src="/images/sidebar-ico/ico-1.png" alt=""/> |
| ... | ... | @@ -157,9 +157,10 @@ |
| 157 | 157 | <span class="sidebar-views-txt">ะะฒะฐะฝะธะต ะฒ ะะคะ:<br/></span><?= $this->params[ 'user' ]->userInfo->rank ?> |
| 158 | 158 | </div> |
| 159 | 159 | </li> |
| 160 | - <li><img src="/images/sidebar-ico/ico-12.png" alt=""/> | |
| 160 | + <li><img src="/images/sidebar-ico/ico_money.png" alt=""/> | |
| 161 | 161 | <div class="sidebarvievstxt"> |
| 162 | - <span class="sidebar-views-txt">ะกัะพะธะผะพััั ัะฐะฑะพั:<br/></span><?= $this->params[ 'user' ]->userInfo->salary ?> | |
| 162 | + <span class="sidebar-views-txt">ะกัะพะธะผะพััั ัะฐะฑะพั:<br/></span> | |
| 163 | + <?= $this->params[ 'user' ]->userInfo->salary. ' ' . $this->params['user']->userInfo->currency->label ?> | |
| 163 | 164 | </div> |
| 164 | 165 | </li> |
| 165 | 166 | <li><img src="/images/sidebar-ico/ico-13.png" alt=""/> | ... | ... |
frontend/views/performer/common.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use yii\helpers\ArrayHelper; | |
| 4 | -use \yii\helpers\Html; | |
| 3 | + use yii\helpers\ArrayHelper; | |
| 4 | + use \yii\helpers\Html; | |
| 5 | 5 | |
| 6 | -/* @var $this yii\web\View | |
| 7 | - * @var $user common\models\User | |
| 8 | - */ | |
| 9 | -$this->params['user'] = $user; | |
| 6 | + /* @var $this yii\web\View | |
| 7 | + * @var $user common\models\User | |
| 8 | + */ | |
| 9 | + $this->params[ 'user' ] = $user; | |
| 10 | 10 | |
| 11 | -$this->title = 'My Yii Application'; | |
| 11 | + $this->title = 'My Yii Application'; | |
| 12 | 12 | ?> |
| 13 | 13 | <div class="proektant-profile-content"> |
| 14 | 14 | <div class="proektant-profile-hidden-txt"> |
| 15 | - <?= $user->userInfo->about?> | |
| 15 | + <?= $user->userInfo->about ?> | |
| 16 | 16 | </div> |
| 17 | 17 | <a href="#" class="profile-see-all"></a> |
| 18 | 18 | <div class="proektant-profile-courses-wr style"> |
| 19 | - <?php foreach( $educations as $education):?> | |
| 20 | - <div class="proektant-profile-courses"> | |
| 21 | - <div class="proektant-profile-courses-title">ะะฑัะฐะทะพะฒะฐะฝะธะต:</div> | |
| 22 | - <div class="proektant-profile-courses-year"><?= isset($education['year_from']) ? $education['year_from'] : '' ?>-<?= isset($education['year_to']) ? $education['year_to'] : '' ?></div> | |
| 23 | - <div class="proektant-profile-courses-content"><?= isset($education['name']) ? $education['name'] : '' ?></div> | |
| 24 | - </div> | |
| 19 | + <?php foreach($educations as $education): ?> | |
| 20 | + <div class="proektant-profile-courses"> | |
| 21 | + <div class="proektant-profile-courses-title">ะะฑัะฐะทะพะฒะฐะฝะธะต:</div> | |
| 22 | + <div class="proektant-profile-courses-year"><?= isset( $education[ 'year_from' ] ) ? $education[ 'year_from' ] : '' ?>-<?= isset( $education[ 'year_to' ] ) ? $education[ 'year_to' ] : '' ?></div> | |
| 23 | + <div class="proektant-profile-courses-content"><?= isset( $education[ 'name' ] ) ? $education[ 'name' ] : '' ?></div> | |
| 24 | + </div> | |
| 25 | 25 | <?php endforeach; ?> |
| 26 | 26 | </div> |
| 27 | - | |
| 28 | - <div class="proektant-profile-statistic-wr style"> | |
| 29 | - | |
| 30 | - <div class="proektant-profile-tb-blocks"> | |
| 31 | - <div class="proektant-profile-stat-title">ะกัะฐัะธััะธะบะฐ ััะฐััะธั</div> | |
| 32 | - <div class="proektant-profile-stat-table"> | |
| 33 | - <table cellspacing="0" cellpadding="0" border="0" width="100%" style="border: 1px solid #dfdfdf; border-radius: 4px;"> | |
| 34 | - <tr> | |
| 35 | - <td width="284" style="border-left: none;">ะะพะผะฟะฐะฝะธั</td> | |
| 36 | - <td width="75" >ะัะพะตะบัั</td> | |
| 37 | - <td width="117">ะ ะตะฐะปะธะทะพะฒะฐะฝะฝัะต</td> | |
| 38 | - </tr> | |
| 39 | - <tr> | |
| 40 | - <td style="border-left: none">UBCP</td> | |
| 41 | - <td>20</td> | |
| 42 | - <td>12</td> | |
| 43 | - </tr> | |
| 44 | - <tr> | |
| 45 | - <td style="border-left: none"> TRP</td> | |
| 46 | - <td>20</td> | |
| 47 | - <td>12</td> | |
| 48 | - </tr> | |
| 49 | - <tr> | |
| 50 | - <td style="border-left: none">ะคัะธะปะฐะฝั</td> | |
| 51 | - <td>20</td> | |
| 52 | - <td>12</td> | |
| 53 | - </tr> | |
| 54 | - </table> | |
| 27 | + <?php | |
| 28 | + if(!empty( $user->jobs )) { | |
| 29 | + ?> | |
| 30 | + <div class="proektant-profile-statistic-wr style"> | |
| 31 | + <div class="proektant-profile-tb-blocks"> | |
| 32 | + <div class="proektant-profile-stat-title">ะกัะฐัะธััะธะบะฐ ััะฐััะธั</div> | |
| 33 | + <div class="proektant-profile-stat-table"> | |
| 34 | + <table cellspacing="0" cellpadding="0" border="0" width="100%" style="border: 1px solid #dfdfdf; border-radius: 4px;"> | |
| 35 | + <tr> | |
| 36 | + <td width="284" style="border-left: none;">ะะพะผะฟะฐะฝะธั</td> | |
| 37 | + <td width="75">ะัะพะตะบัั</td> | |
| 38 | + <td width="117">ะ ะตะฐะปะธะทะพะฒะฐะฝะฝัะต</td> | |
| 39 | + </tr> | |
| 40 | + <?php | |
| 41 | + foreach($user->jobs as $job) { | |
| 42 | + ?> | |
| 43 | + <tr> | |
| 44 | + <td style="border-left: none"><?= $job->name ?></td> | |
| 45 | + <td><?= $job->total_count ?></td> | |
| 46 | + <td><?= $job->complete_count ?></td> | |
| 47 | + </tr> | |
| 48 | + <?php | |
| 49 | + } | |
| 50 | + ?> | |
| 51 | + </table> | |
| 52 | + </div> | |
| 53 | + </div> | |
| 55 | 54 | </div> |
| 56 | - </div> | |
| 57 | - | |
| 58 | - | |
| 59 | - </div> | |
| 55 | + <?php | |
| 56 | + } | |
| 57 | + ?> | |
| 60 | 58 | </div> |
| 61 | 59 | <div class="proektant-profile-sidebar-right"> |
| 62 | 60 | <div class="style"> |
| 63 | 61 | <div class="profile-phone-site style"> |
| 64 | - <?= $this->render('/patrial/show_phone',[ | |
| 65 | - 'phones' => $phones | |
| 66 | - ])?> | |
| 67 | - <?= $this->render('/patrial/show_site',[ | |
| 68 | - 'sites' => $sites | |
| 69 | - ])?> | |
| 62 | + <?= $this->render('/patrial/show_phone', [ | |
| 63 | + 'phones' => $phones, | |
| 64 | + ]) ?> | |
| 65 | + <?= $this->render('/patrial/show_site', [ | |
| 66 | + 'sites' => $sites, | |
| 67 | + ]) ?> | |
| 70 | 68 | </div> |
| 71 | 69 | <div class="profile-features style"> |
| 72 | 70 | <ul> |
| 73 | - <li><span>ะะตะพะณัะฐัะธั ัะฐะฑะพั: </span><?= implode(',',array_filter(ArrayHelper::getColumn($user->portfolios, 'city'))) ?></li> | |
| 71 | + <li> | |
| 72 | + <span>ะะตะพะณัะฐัะธั ัะฐะฑะพั: </span><?= implode(',', array_filter(ArrayHelper::getColumn($user->portfolios, 'city'))) ?> | |
| 73 | + </li> | |
| 74 | 74 | <li><span>ะะตััะพะฝะฐั ะพะถะดะตะฝะธะต: </span><?= $user->userInfo->city ?></li> |
| 75 | 75 | <li> |
| 76 | 76 | <div class="features-tags features-tags-profile"> |
| 77 | - <?php foreach($user->specializations as $specialization):?> | |
| 77 | + <?php foreach($user->specializations as $specialization): ?> | |
| 78 | 78 | <span><a href="#"><?= $specialization->specialization_name ?></a>, </span> |
| 79 | 79 | <?php endforeach; ?> |
| 80 | 80 | </div> |
| 81 | 81 | </li> |
| 82 | 82 | <li><span>ะ ะฐะฑะพัะฐ ั ะฟัะพะณัะฐะผะผะฐะผะธ: </span><?= $soft ?></li> |
| 83 | 83 | <li><span>ะะฐัะฐะฝัะธั: </span><?= $user->userInfo->guarantee ?> ะณะพะดะฐ</li> |
| 84 | - <li><span>ะะพะณะพะฒะพั: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->contract)?></li> | |
| 85 | - <li><span>ะกะผะตัะฐ: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->estimate)?></li> | |
| 86 | - <li><span>ะะฐะบัะฟะบะฐ ัััะพะนะผะฐัะตัะธะฐะปะพะฒ: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->purchase)?></li> | |
| 87 | - <li><span>ะะพััะฐะฒะบะฐ ัััะพะนะผะฐัะตัะธะฐะปะพะฒ: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->delivery)?></li> | |
| 84 | + <li> | |
| 85 | + <span>ะะพะณะพะฒะพั: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->contract) ?> | |
| 86 | + </li> | |
| 87 | + <li> | |
| 88 | + <span>ะกะผะตัะฐ: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->estimate) ?> | |
| 89 | + </li> | |
| 90 | + <li> | |
| 91 | + <span>ะะฐะบัะฟะบะฐ ัััะพะนะผะฐัะตัะธะฐะปะพะฒ: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->purchase) ?> | |
| 92 | + </li> | |
| 93 | + <li> | |
| 94 | + <span>ะะพััะฐะฒะบะฐ ัััะพะนะผะฐัะตัะธะฐะปะพะฒ: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->delivery) ?> | |
| 95 | + </li> | |
| 88 | 96 | <li><span>ะัะตะดะพะฟะปะฐัะฐ: </span><?= $user->userInfo->prepayment ?> %</li> |
| 89 | 97 | </ul> |
| 90 | 98 | </div> |
| ... | ... | @@ -145,7 +153,8 @@ $this->title = 'My Yii Application'; |
| 145 | 153 | <a href="#" class="company-comm-see-all"><span>ะ ะฐะทะฒะตัะฝััั</span></a> |
| 146 | 154 | </div> |
| 147 | 155 | </div> |
| 148 | - <div class="company-performer-comm-see-all-butt style"><a href="#">ะงะธัะฐัั ะฒัะต ะพัะทัะฒั</a></div> | |
| 156 | + <div class="company-performer-comm-see-all-butt style"><a href="#">ะงะธัะฐัั ะฒัะต ะพัะทัะฒั</a> | |
| 157 | + </div> | |
| 149 | 158 | </div> |
| 150 | 159 | </div> |
| 151 | 160 | </div> | ... | ... |
frontend/web/css/style.css
| ... | ... | @@ -6703,4 +6703,8 @@ input[disabled], select[disabled] { |
| 6703 | 6703 | .list_item.title {margin-top: 20px} |
| 6704 | 6704 | .search_customer_image { |
| 6705 | 6705 | height: 100%; |
| 6706 | +} | |
| 6707 | +.project_owner_control a { | |
| 6708 | + display: inline-block; | |
| 6709 | + margin: 0 10px; | |
| 6706 | 6710 | } |
| 6707 | 6711 | \ No newline at end of file | ... | ... |
1.1 KB
frontend/web/js/forms.js
| ... | ... | @@ -383,6 +383,86 @@ $(document).ready( |
| 383 | 383 | // addToFavorites() |
| 384 | 384 | } |
| 385 | 385 | ) |
| 386 | + | |
| 387 | + //project comment state | |
| 388 | + $(document).on('click', '.artbox_project_make_candidate', function(e) { | |
| 389 | + e.preventDefault(); | |
| 390 | + var project_id = $(this).data('project-id'); | |
| 391 | + var comment_id = $(this).data('comment-id'); | |
| 392 | + var state = 2; | |
| 393 | + var link = $(this); | |
| 394 | + $.post('/tender/change-state', {project_id: project_id, comment_id: comment_id, state: state}, function(data) { | |
| 395 | + if(data.error) { | |
| 396 | + alert(data.error); | |
| 397 | + } else { | |
| 398 | + alert(data.message); | |
| 399 | + } | |
| 400 | + }, 'json').fail( | |
| 401 | + function() | |
| 402 | + { | |
| 403 | + alert(txtErrorModal); | |
| 404 | + } | |
| 405 | + ); | |
| 406 | + }); | |
| 407 | + $(document).on('click', '.artbox_project_make_new', function(e) { | |
| 408 | + e.preventDefault(); | |
| 409 | + var project_id = $(this).data('project-id'); | |
| 410 | + var comment_id = $(this).data('comment-id'); | |
| 411 | + var state = 1; | |
| 412 | + var link = $(this); | |
| 413 | + $.post('/tender/change-state', {project_id: project_id, comment_id: comment_id, state: state}, function(data) { | |
| 414 | + if(data.error) { | |
| 415 | + alert(data.error); | |
| 416 | + } else { | |
| 417 | + alert(data.message); | |
| 418 | + } | |
| 419 | + }, 'json').fail( | |
| 420 | + function() | |
| 421 | + { | |
| 422 | + alert(txtErrorModal); | |
| 423 | + } | |
| 424 | + ); | |
| 425 | + }); | |
| 426 | + $(document).on('click', '.artbox_project_make_performer', function(e) { | |
| 427 | + e.preventDefault(); | |
| 428 | + var project_id = $(this).data('project-id'); | |
| 429 | + var comment_id = $(this).data('comment-id'); | |
| 430 | + var state = 3; | |
| 431 | + var link = $(this); | |
| 432 | + $.post('/tender/change-state', {project_id: project_id, comment_id: comment_id, state: state}, function(data) { | |
| 433 | + if(data.error) { | |
| 434 | + alert(data.error); | |
| 435 | + } else { | |
| 436 | + alert(data.message); | |
| 437 | + } | |
| 438 | + }, 'json').fail( | |
| 439 | + function() | |
| 440 | + { | |
| 441 | + alert(txtErrorModal); | |
| 442 | + } | |
| 443 | + ); | |
| 444 | + }); | |
| 445 | + $(document).on('click', '.artbox_project_make_deny', function(e) { | |
| 446 | + e.preventDefault(); | |
| 447 | + var project_id = $(this).data('project-id'); | |
| 448 | + var comment_id = $(this).data('comment-id'); | |
| 449 | + var state = 4; | |
| 450 | + var link = $(this); | |
| 451 | + $.post('/tender/change-state', {project_id: project_id, comment_id: comment_id, state: state}, function(data) { | |
| 452 | + if(data.error) { | |
| 453 | + alert(data.error); | |
| 454 | + } else { | |
| 455 | + alert(data.message); | |
| 456 | + } | |
| 457 | + }, 'json').fail( | |
| 458 | + function() | |
| 459 | + { | |
| 460 | + alert(txtErrorModal); | |
| 461 | + } | |
| 462 | + ); | |
| 463 | + }); | |
| 464 | + | |
| 465 | + | |
| 386 | 466 | //offer |
| 387 | 467 | $('a.get-project, .blog-buttons-offer').click( |
| 388 | 468 | function(e) | ... | ... |