Esempio n. 1
0
 public function actionView($id)
 {
     $model = $this->loadModel('app\\models\\Issue', $id);
     $this->view->params['appSettings'] = ['app_name' => $model->project->title];
     if (!\Yii::$app->user->can('viewProject', ['project' => $model->project]) || \Yii::$app->user->isGuest) {
         throw new ForbiddenHttpException('Access denied');
     }
     if (\Yii::$app->request->post('hasEditable') && !\Yii::$app->user->isGuest) {
         $post = \Yii::$app->request->post('Issue');
         if (isset($post['status_id'])) {
             $model->status_id = $post['status_id'];
             $output = StatusEnum::i()->getMap()[$post['status_id']];
             $this->sendMessage($model, ['subject' => \Yii::t('app', 'Issue Status Changed'), 'view' => 'changeStatus']);
         }
         if (isset($post['priority_id'])) {
             $model->priority_id = (int) $post['priority_id'];
             $output = PriorityEnum::i()->getMap()[$post['priority_id']];
         }
         if (isset($post['tracker_id'])) {
             $model->tracker_id = (int) $post['tracker_id'];
             $output = TrackerEnum::i()->getMap()[$post['tracker_id']];
         }
         if (isset($post['assignee_id'])) {
             if ($post['assignee_id']) {
                 $model->assignee_id = (int) $post['assignee_id'];
                 $output = \app\models\Project::getAssigneeOptions($model->project_id)[$post['assignee_id']];
                 $this->sendMessage($model);
             } else {
                 $model->assignee_id = null;
                 $output = '<i>(' . \Yii::t('app', 'not set') . ')</i>';
             }
         }
         if (isset($post['readiness_id'])) {
             $model->readiness_id = (int) $post['readiness_id'];
             $output = Issue::getReadinessOptions()[$post['readiness_id']];
         }
         if (isset($post['deadline'])) {
             $model->deadline = $post['deadline'];
             $output = $post['deadline'];
         }
         if ($model->save()) {
             $out = Json::encode(['output' => $output, 'message' => '']);
             echo $out;
             return;
         }
     }
     if ($post = \Yii::$app->request->post('IssueComment')) {
         $comment = new IssueComment();
         $comment->text = $post['text'];
         $comment->issue_id = $id;
         if ($comment->save()) {
             \Yii::$app->session->setFlash('success', \Yii::t('app', 'Comment successfully added.'));
         }
     }
     return $this->render('view', ['model' => $model]);
 }
Esempio n. 2
0
            <dd>
                <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'tracker_id', 'header' => \Yii::t('app', 'Priority'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => TrackerEnum::i()->getMap(), 'options' => ['class' => 'form-control'], 'displayValue' => TrackerEnum::i()->getMap()[$model->tracker_id]]);
?>
            </dd>
        </dl>
    </div>
    <div class="col-sm-3">
        <dl class="dl-horizontal">
            <dt><?php 
echo \Yii::t('app', 'Assignee');
?>
</dt>
            <dd>
                <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'assignee_id', 'header' => \Yii::t('app', 'Assignee'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => \app\models\Project::getAssigneeOptions($model->project_id), 'options' => ['class' => 'form-control', 'prompt' => ' - '], 'displayValue' => $model->assignee ? $model->assignee->getFullName() : '<i>(' . \Yii::t('app', 'not set') . ')</i>']);
?>
            </dd>
            <dt><?php 
echo \Yii::t('app', '% Done');
?>
</dt>
            <dd>
                <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'readiness_id', 'header' => \Yii::t('app', '% Done'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => Issue::getReadinessOptions(), 'options' => ['class' => 'form-control'], 'displayValue' => Issue::getReadinessOptions()[$model->readiness_id]]);
?>
            </dd>
            <dt><?php 
echo \Yii::t('app', 'Deadline');
?>
</dt>
Esempio n. 3
0
}, 'editableOptions' => ['header' => \Yii::t('app', 'Status'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => StatusEnum::i()->getMap()]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'priority_id', 'filter' => PriorityEnum::i()->getMap(), 'value' => function ($data) {
    return PriorityEnum::i()->getMap()[$data->priority_id];
}, 'editableOptions' => ['header' => \Yii::t('app', 'Priority'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => PriorityEnum::i()->getMap()]], ['attribute' => 'subject', 'format' => 'raw', 'value' => function ($data) {
    $additionalLinks = '';
    $checkList = '';
    if ($data->creator_id == \Yii::$app->user->id || \Yii::$app->user->can('adminDashboard')) {
        $additionalLinks = '<span class="pull-right">' . Html::a('<i class="fa fa-edit"></i>', ['/issue/update', 'id' => $data->id]) . ' ';
        $additionalLinks .= Html::a('<i class="fa fa-trash"></i>', ['/issue/delete', 'id' => $data->id], ['class' => 'confirmLink']) . '</span>';
    }
    if ($data->checkLists) {
        $checkList = '<span class="label label-success" data-toggle="tooltip" title="' . \Yii::t('app', 'Checklist') . '">
                            <i class="fa fa-th-list"></i> ' . $data->offListItems . '/' . $data->checkListsCount . '</span>';
    }
    return Html::a($data->subject, ['/issue/view', 'id' => $data->id]) . ' ' . $checkList . $additionalLinks;
}], ['attribute' => 'creator_id', 'filter' => \app\models\Project::getAssigneeOptions($project->id), 'value' => function ($data) {
    return $data->author ? $data->author->getFullName() : '';
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'assignee_id', 'filter' => \app\models\Project::getAssigneeOptions($project->id), 'value' => function ($data) {
    return $data->assignee ? $data->assignee->getFullName() : '';
}, 'editableOptions' => ['header' => \Yii::t('app', 'Assignee'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => \app\models\Project::getAssigneeOptions($project->id), 'options' => ['prompt' => ' - ']]], ['attribute' => 'created_date', 'filter' => false]]]);
?>

</div>

<style>
    #w0-container > table > thead > tr:nth-child(1) > th:nth-child(2) {
        width: 50px;
    }
    #w0-container > table > thead > tr:nth-child(1) > th:nth-child(5) {
        width: 40%;
    }
</style>
Esempio n. 4
0
            </div>

            <a href="#" class="checklist-add pull-right"><i class="fa fa-plus-circle"></i> <?php 
echo \Yii::t('app', 'Add Checklist Item');
?>
</a>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-sm-6">
        <?php 
echo $form->field($model, 'milestone_id')->dropDownList(app\models\Milestone::getOptions($project->id), ['prompt' => ' ']);
echo $form->field($model, 'status_id')->dropDownList(\app\components\enums\StatusEnum::i()->getMap());
echo $form->field($model, 'priority_id')->dropDownList(\app\components\enums\PriorityEnum::i()->getMap());
echo $form->field($model, 'assignee_id')->dropDownList(\app\models\Project::getAssigneeOptions($project->id), ['prompt' => ' ']);
?>
    </div>
    <div class="col-sm-6">
        <?php 
echo $form->field($model, 'deadline')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]);
echo $form->field($model, 'readiness_id')->dropDownList(\app\models\Issue::getReadinessOptions());
echo $form->field($model, 'image_array[]')->fileInput(['multiple' => ''])->hint(\Yii::t('app', 'Chose one or few files'));
if (!empty($model->photos)) {
    echo $this->render('_imageGrid', ['model' => $model]);
}
?>
    </div>
</div>

<?php