Example #1
0
 public function notifyAssignmentBid()
 {
     $bids = Bid::find()->where(['user_id' => Yii::$app->user->identity->id, 'status' => [R::BID_REFUSED_BY_MANAGER, R::BID_REFUSED_BY_CLIENT, R::BID_APPROVED_BY_MANAGER, R::BID_APPROVED_BY_CLIENT, R::BID_DONE], 'notify_status' => R::NOTIFY_ACTIVE, 'bid_type' => R::BID_ASSIGNMENT])->all();
     foreach ($bids as $bid) {
         // if ($bid->notify_times == 1) {
         $bid->notify_status = R::NOTIFY_NOTIFIED;
         $bid->save();
         //     } else {
         //         $bid->notify_times += 1;
         //         $bid->save();
         //     }
     }
     if (Yii::$app->user->identity->role == R::ADMIN) {
         // Samy tupoi variant reweniya uvedomleny
         $bids = Bid::find()->where(['status' => [R::BID_SENT_TO_MANAGER, R::BID_REFUSED_BY_CLIENT, R::BID_APPROVED_BY_CLIENT], 'notify_status' => R::NOTIFY_ACTIVE, 'bid_type' => R::BID_ASSIGNMENT])->all();
         foreach ($bids as $bid) {
             // if ($bid->notify_times == 1) {
             $bid->notify_status = R::NOTIFY_NOTIFIED;
             $bid->save();
             // } else {
             // $bid->notify_times += 1;
             // $bid->save();
             // }
         }
     }
 }
Example #2
0
 public function measurement()
 {
     //echo "<pre>".print_r(MeasureMan::all(),1)."</pre>";
     $this->data['bids'] = Bid::getAllBids();
     foreach ($this->data['bids'] as $key => $value) {
         $this->data['bids'][$key]['source'] = $value->sourcesList['name'];
         $this->data['bids'][$key]['fio'] = $value->client['fio'];
     }
     $this->data['services'] = ServicesList::getServicesList();
     $this->data['sources'] = SourcesList::getSourcesList();
     $this->data['rejections'] = Rejection::getRejections();
     $this->data['scriptSales'] = ScriptSale::getScriptSales();
     return view('measurement', $this->data);
     //получим список замерщиков и вызовем метод index
 }
Example #3
0
 /**
  * Одобрение заявки
  * меняем статус отчета и стадии, уведомляем исполнителя и менеджера
  * Проверен (21.12.15)
  */
 public function actionApprove()
 {
     if (isset($_POST['bid_id'])) {
         $bid = Bid::findOne($_POST['bid_id']);
         if ($bid) {
             $bid->status = R::BID_APPROVED_BY_CLIENT;
             $bid->notify_status = R::NOTIFY_ACTIVE;
             $bid->save();
             $bid->stage->status = R::STAGE_APPROVED;
             $bid->stage->notify_status = R::NOTIFY_ACTIVE;
             $bid->stage->save();
             echo '1';
         }
     }
 }
Example #4
0
 public function getBids()
 {
     return $this->hasMany(Bid::className(), ['obj_id' => 'id'])->where(['bid_type' => R::BID_STAGE]);
 }
Example #5
0
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
$items = [];
if (!Yii::$app->user->isGuest) {
    $n_sr = isset($this->params['n_sr']) ? $this->params['n_sr'] : false;
    $n_ar = isset($this->params['n_ar']) ? $this->params['n_ar'] : false;
    $n_s = isset($this->params['n_s']) ? $this->params['n_s'] : false;
    $n_a = isset($this->params['n_a']) ? $this->params['n_a'] : false;
    $logout = ['label' => '<img src="' . Yii::$app->user->identity->avatar . '" style="width:16px;height:16px">', 'items' => [['label' => 'Выход', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']], ['label' => 'Профиль', 'url' => ['/user/view?id=' . Yii::$app->user->identity->id]]]];
    $manager = Bid::find()->where(['status' => R::BID_SENT_TO_MANAGER])->count();
    $teammate = Stage::find()->where(['user_id' => Yii::$app->user->identity->id, 'status' => R::STAGE_CREATED])->count();
    if (Yii::$app->user->identity->role == R::ADMIN) {
        $items = [['label' => 'Архив', 'items' => [['label' => 'Проекты', 'url' => ['/leader/project-done']], ['label' => 'Поручения', 'url' => ['/leader/assignment-done']]]], ['label' => 'Журнал', 'url' => ['/logbook/logbook/logbooks']], ['label' => 'Пользователи', 'url' => ['/user/index']], ['label' => 'Отчеты' . ($n_sr || $n_ar ? '<span class="circle"></span>' : ''), 'items' => [['label' => 'Проекты' . ($n_sr ? '<span class="circle"></span>' : ''), 'url' => ['/leader/stage-reports']], ['label' => 'Поручения' . ($n_ar ? '<span class="circle"></span>' : ''), 'url' => ['/leader/assignment-reports']]]], ['label' => 'Поручения', 'url' => ['/leader/assignments']], ['label' => 'Проекты', 'url' => ['/leader/index']]];
    }
    if (Yii::$app->user->identity->role == R::DESIGNER || Yii::$app->user->identity->role == R::FRONTEND || Yii::$app->user->identity->role == R::COPYRIGHTER || Yii::$app->user->identity->role == R::PROTOTYPER || Yii::$app->user->identity->role == R::TESTER || Yii::$app->user->identity->role == R::BACKEND || Yii::$app->user->identity->role == R::CONTENTER) {
        $items = [['label' => 'Журнал', 'url' => ['/logbook/logbook/index']], ['label' => 'Отчеты' . ($n_sr || $n_ar ? '<span class="circle"></span>' : ''), 'items' => [['label' => 'Проекты' . ($n_sr ? '<span class="circle"></span>' : ''), 'url' => ['/team/stage-reports']], ['label' => 'Поручения' . ($n_ar ? '<span class="circle"></span>' : ''), 'url' => ['/team/assignment-reports']]]], ['label' => 'Поручения' . ($n_a ? '<span class="circle"></span>' : ''), 'url' => ['/team/assignments']], ['label' => 'Работы' . ($n_s ? '<span class="circle"></span>' : ''), 'url' => ['/team/index']]];
    }
    if (Yii::$app->user->identity->role == R::CLIENT) {
        $items = [['label' => 'Проекты', 'url' => ['/client/projects']], ['label' => 'Уведомления' . ($n_sr ? '<span class="circle"></span>' : ''), 'url' => ['/client/reports']]];
    }
    array_push($items, $logout);
    // array_push($items, $avatar);
} else {
    $items = [['label' => 'Регистрация', 'url' => ['/user/fast-create']], ['label' => 'Вход', 'url' => ['/site/login']]];
}
 public function actionRank()
 {
     $request = Yii::$app->request;
     $price = trim($request->post('price'));
     $auctionId = trim($request->post('auction'));
     if (empty($price) or empty($auctionId)) {
         echo json_encode(['status' => 0, 'message' => 'Wrong params'], JSON_PRETTY_PRINT);
         exit;
     }
     $top = intval(Bid::find()->select('MAX(offer)')->where(['auction_id' => $auctionId])->scalar());
     list($rank, $class, $message) = $this->composeRankInfo($auctionId, $price);
     $status = 1;
     echo json_encode(compact('status', 'rank', 'class', 'message', 'top'), JSON_PRETTY_PRINT);
     exit;
 }
Example #7
0
 /**
  * Отправка отчета менеджеру о выполнении поручения
  * создаем отчет, меняем статус поручения и уведомляем менеджера об отправки отчетности
  * Проверен (21.12.15)
  */
 public function actionSentAssign()
 {
     if (isset($_POST)) {
         $bid = new Bid();
         $bid->text = $_POST['text'];
         $bid->name = "Test";
         $bid->status = R::BID_SENT_TO_MANAGER;
         $bid->user_id = Yii::$app->user->identity->id;
         $bid->obj_id = $_POST['assignment_id'];
         $bid->bid_type = R::BID_ASSIGNMENT;
         $bid->notify_status = R::NOTIFY_ACTIVE;
         $bid->create_time = time();
         $bid->update_time = time();
         $bid->save();
         if ($bid->save()) {
             $bid->uploadFiles(Yii::$app->session['cs_' . Yii::$app->user->identity->id]);
             $assignment = Assignment::findOne($bid->obj_id);
             $assignment->status = R::ASSIGNMENT_PROCESS;
             $assignment->save();
             echo '1';
         }
     }
 }
Example #8
0
 public function getBid()
 {
     return $this->hasOne(Bid::className(), ['id' => 'bid_id']);
 }
Example #9
0
 public function getAssignmentReportNotification()
 {
     if ($this->role == R::ADMIN) {
         $bid = Bid::find()->where(['status' => [R::BID_SENT_TO_MANAGER, R::BID_REFUSED_BY_CLIENT, R::BID_APPROVED_BY_CLIENT], 'notify_status' => R::NOTIFY_ACTIVE, 'bid_type' => R::BID_ASSIGNMENT])->count();
         if ($bid == 0) {
             return false;
         } else {
             return true;
         }
     } elseif ($this->role == R::DESIGNER || $this->role == R::FRONTEND || $this->role == R::COPYRIGHTER || $this->role == R::PROTOTYPER || $this->role == R::TESTER || $this->role == R::BACKEND || $this->role == R::CONTENTER) {
         $bid = Bid::find()->where(['user_id' => $this->id, 'status' => [R::BID_REFUSED_BY_MANAGER, R::BID_REFUSED_BY_CLIENT, R::BID_APPROVED_BY_MANAGER, R::BID_APPROVED_BY_CLIENT, R::BID_DONE], 'notify_status' => R::NOTIFY_ACTIVE, 'bid_type' => R::BID_ASSIGNMENT])->count();
         if ($bid == 0) {
             return false;
         } else {
             return true;
         }
     }
 }
Example #10
0
 /**
  * Одобрение отчета менеджером (стадия - поручение) 
  * меняем статус отчета и (стадии или поручения)
  * Проверен (21.12.15)
  */
 public function actionApprovve()
 {
     if (isset($_POST['bid_id'])) {
         $bid = Bid::findOne($_POST['bid_id']);
         if ($bid) {
             $bid->status = R::BID_APPROVED_BY_MANAGER;
             $bid->notify_status = R::NOTIFY_ACTIVE;
             $bid->save();
             if (isset($bid->stage)) {
                 $bid->stage->status = R::STAGE_APPROVED;
                 $bid->stage->notify_status = R::NOTIFY_ACTIVE;
                 $bid->stage->save();
             } else {
                 $bid->assignment->status = R::ASSIGNMENT_APPROVED;
                 $bid->assignment->notify_status = R::NOTIFY_ACTIVE;
                 $bid->assignment->save();
             }
             echo '1';
         }
     }
 }
Example #11
0
 public function actionApprovve()
 {
     if (isset($_POST['bid_id'])) {
         $bid = Bid::findOne($_POST['bid_id']);
         if ($bid) {
             $bid->status = R::BID_APPROVED_BY_MANAGER;
             $bid->update_time = time();
             $bid->save();
             $bid->stage->status = R::STAGE_APPROVED;
             $bid->stage->save();
             echo '1';
         }
     }
 }
Example #12
0
 public function searchAssignmentReportsForTeam($params)
 {
     $query = Bid::find();
     // $query->joinWith(['project', 'stage']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['create_time' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'user_id' => $this->user_id, 'obj_id' => $this->obj_id, 'bid_id' => $this->bid_id, 'notify_status' => $this->notify_status, 'create_time' => $this->create_time, 'update_time' => $this->update_time]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['not', ['status' => 0]])->andFilterWhere(['user_id' => Yii::$app->user->identity->id])->andFilterWhere(['bid_type' => R::BID_ASSIGNMENT]);
     // ->andFilterWhere(['like', 'project.name', $this->project])
     // ->andFilterWhere(['like', 'stage.name', $this->stage]);
     return $dataProvider;
 }