add api, docs
This commit is contained in:
@ -75,7 +75,7 @@ return [
|
||||
'components' => [
|
||||
'request' => [
|
||||
'csrfParam' => '_csrf-backend',
|
||||
'baseUrl' => '', //TODO /secure
|
||||
'baseUrl' => '/secure',
|
||||
'parsers' => [
|
||||
'application/json' => 'yii\web\JsonParser',
|
||||
'text/xml' => 'yii/web/XmlParser',
|
||||
|
@ -6,7 +6,7 @@ use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\questionnaire\models\AnswerSearch */
|
||||
/* @var $modelSearch backend\modules\questionnaire\models\AnswerSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
@ -17,7 +17,7 @@ use yii\widgets\ActiveForm;
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'questionnaire')->widget(Select2::className(),[
|
||||
<?= $form->field($modelSearch, 'questionnaire')->widget(Select2::className(),[
|
||||
'data' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
|
||||
'options' => ['placeholder' => 'Выберите анкету'],
|
||||
'pluginOptions' => [
|
||||
|
@ -21,7 +21,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
</p>
|
||||
|
||||
<?= $this->render('_search_by_questionnaire', [
|
||||
'model' => $searchModel,
|
||||
'modelSearch' => $searchModel,
|
||||
]) ?>
|
||||
|
||||
<?= GridView::widget([
|
||||
|
@ -32,7 +32,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_id',
|
||||
'filter' => ArrayHelper::map(User::find()->all(), 'id', 'username'),
|
||||
'filter' => User::find()->select(['username', 'id'])->indexBy('id')->column(),
|
||||
'value' => 'user.username'
|
||||
],
|
||||
'score',
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\questionnaire\models\Questionnaire;
|
||||
use backend\modules\questionnaire\models\UserQuestionnaire;
|
||||
use kartik\select2\Select2;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
@ -3,6 +3,8 @@
|
||||
namespace backend\modules\task\controllers;
|
||||
|
||||
use backend\modules\project\models\ProjectUser;
|
||||
use backend\modules\task\models\TaskUser;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use yii\web\Response;
|
||||
use Yii;
|
||||
use backend\modules\task\models\Task;
|
||||
@ -54,8 +56,17 @@ class TaskController extends Controller
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
$taskDataProvider = new ActiveDataProvider([
|
||||
'query' => $model->getTaskUsers()->with(['task', 'projectUser']),
|
||||
'pagination' => [
|
||||
'pageSize' => 20,
|
||||
],
|
||||
]);
|
||||
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
'model' => $model,
|
||||
'taskDataProvider' => $taskDataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class TaskSearch extends Task
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Task::find();
|
||||
$query = Task::find()->joinWith(['user', 'project', 'projectUser.user']);
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
|
@ -39,7 +39,7 @@ class TaskUserSearch extends TaskUser
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = TaskUser::find();
|
||||
$query = TaskUser::find()->joinWith(['task', 'projectUser']);
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
|
@ -27,13 +27,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
[
|
||||
'attribute' => 'task_id',
|
||||
'filter' => ArrayHelper::map(Task::find()->all(), 'id', 'title'),
|
||||
'filter' => Task::find()->select(['title', 'id'])->indexBy('id')->column(),
|
||||
'value' => 'task.title'
|
||||
],
|
||||
[
|
||||
'attribute' => 'project_user_id',
|
||||
'filter' => ArrayHelper::map(ProjectUser::find()->joinWith('user')
|
||||
->all(), 'id', 'user.username'),
|
||||
'filter' => ProjectUser::find()->select(['user.username', 'project_user.id'])
|
||||
->joinWith('user')->indexBy('project_user.id')->column(),
|
||||
'value' => 'projectUser.user.username'
|
||||
],
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\project\models\Project;
|
||||
use backend\modules\project\models\ProjectUser;
|
||||
use common\helpers\StatusHelper;
|
||||
use common\models\User;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
@ -31,6 +33,17 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'value' => 'project.name'
|
||||
],
|
||||
'title',
|
||||
[
|
||||
'attribute' => 'project_user_id',
|
||||
'filter' => ProjectUser::find()->select(['username', 'project_user.id'])->joinWith('user')->indexBy('id')->column(),
|
||||
'value' => 'projectUser.user.username'
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_id',
|
||||
'filter' => User::find()->select(['username', 'id'])->indexBy('id')->column(),
|
||||
'value' => 'user.username'
|
||||
],
|
||||
'description',
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'format' => 'raw',
|
||||
@ -40,6 +53,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
},
|
||||
],
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
|
@ -1,17 +1,20 @@
|
||||
<?php
|
||||
|
||||
use common\helpers\StatusHelper;
|
||||
use kartik\grid\GridView;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\web\YiiAsset;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\task\models\Task */
|
||||
/* @var $taskDataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'Задача: ' . $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Tasks', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
YiiAsset::register($this);
|
||||
?>
|
||||
<div class="task-view">
|
||||
|
||||
@ -55,4 +58,28 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<div>
|
||||
<h2>
|
||||
<?= 'Исполнители' ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $taskDataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
[
|
||||
'attribute' => 'task_id', // ArrayHelper::map(Task::find()->all(), 'id', 'title'),
|
||||
'value' => 'task.title'
|
||||
],
|
||||
[
|
||||
'attribute' => 'project_user_id',
|
||||
'value' => 'projectUser.user.username'
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@
|
||||
['label' => 'Должность', 'icon' => 'spotify', 'url' => ['/settings/position'], 'active' => \Yii::$app->controller->id == 'position'],
|
||||
['label' => 'Навыки', 'icon' => 'flask', 'url' => ['/settings/skill'], 'active' => \Yii::$app->controller->id == 'skill'],
|
||||
],
|
||||
// TODO visible 'visible' => Yii::$app->user->can('confidential_information')
|
||||
'visible' => Yii::$app->user->can('confidential_information')
|
||||
],
|
||||
[
|
||||
'label' => 'Профили', 'icon' => 'address-book-o', 'url' => '#', 'active' => \Yii::$app->controller->id == 'user-card',
|
||||
@ -39,12 +39,12 @@
|
||||
['label' => 'Менеджеры', 'icon' => 'user-circle-o', 'url' => ['/employee/manager'], 'active' => \Yii::$app->controller->id == 'manager'],
|
||||
['label' => 'Работники', 'icon' => 'user', 'url' => ['/employee/manager-employee'], 'active' => \Yii::$app->controller->id == 'manager-employee'],
|
||||
],
|
||||
// TODO visible 'visible' => Yii::$app->user->can('confidential_information')
|
||||
'visible' => Yii::$app->user->can('confidential_information')
|
||||
],
|
||||
[
|
||||
'label' => 'Проекты', 'icon' => 'cubes', 'url' => ['#'], //'active' => \Yii::$app->controller->id == 'project',
|
||||
'items' => $projectItems,
|
||||
// TODO visible 'visible' => Yii::$app->user->can('confidential_information')
|
||||
'visible' => Yii::$app->user->can('confidential_information')
|
||||
],
|
||||
[
|
||||
'label' => 'Задачи', 'icon' => '', 'url' => '#',
|
||||
@ -53,7 +53,7 @@
|
||||
['label' => 'Исполнители задачи', 'icon' => '', 'url' => ['/task/task-user'], 'active' => \Yii::$app->controller->id == 'task-user'],
|
||||
],
|
||||
|
||||
// TODO visible 'visible' => Yii::$app->user->can('confidential_information')
|
||||
'visible' => Yii::$app->user->can('confidential_information')
|
||||
],
|
||||
['label' => 'Компании', 'icon' => 'building', 'url' => ['/company/company'], 'active' => \Yii::$app->controller->id == 'company', 'visible' => Yii::$app->user->can('confidential_information')],
|
||||
[
|
||||
@ -62,7 +62,7 @@
|
||||
['label' => 'Компании', 'icon' => 'building', 'url' => ['/hh/hh'], 'active' => \Yii::$app->controller->id == 'hh'],
|
||||
['label' => 'Вакансии', 'icon' => 'user-md', 'url' => ['/hh/hh-job'], 'active' => \Yii::$app->controller->id == 'hh-job'],
|
||||
],
|
||||
// TODO visible 'visible' => Yii::$app->user->can('confidential_information')
|
||||
'visible' => Yii::$app->user->can('confidential_information')
|
||||
],
|
||||
['label' => 'Баланс', 'icon' => 'dollar', 'url' => ['/balance/balance'], 'active' => \Yii::$app->controller->id == 'balance', 'visible' => Yii::$app->user->can('confidential_information')],
|
||||
['label' => 'Отпуска', 'icon' => 'plane', 'url' => ['/holiday/holiday'], 'active' => \Yii::$app->controller->id == 'holiday', 'visible' => Yii::$app->user->can('confidential_information')],
|
||||
@ -91,8 +91,7 @@
|
||||
['label' => 'Анкеты пользователей', 'icon' => 'drivers-license', 'url' => ['/questionnaire/user-questionnaire'], 'active' => \Yii::$app->controller->id == 'user-questionnaire'],
|
||||
['label' => 'Ответы пользователей', 'icon' => 'comments', 'url' => ['/questionnaire/user-response'], 'active' => \Yii::$app->controller->id == 'user-response'],
|
||||
],
|
||||
|
||||
// TODO visible 'visible' => Yii::$app->user->can('confidential_information')
|
||||
'visible' => Yii::$app->user->can('confidential_information')
|
||||
],
|
||||
|
||||
/*['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii']],
|
||||
|
Reference in New Issue
Block a user