add task, fixed executors in all projects
This commit is contained in:
@ -86,7 +86,6 @@ YiiAsset::register($this);
|
||||
'class' => 'btn btn-primary',
|
||||
'data' => [
|
||||
'confirm' => 'Проверка ответов пользователя: ' . $user . ". Категория: " . $questionnaire_title,
|
||||
// 'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
<?php
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace backend\modules\task\controllers;
|
||||
|
||||
use backend\modules\project\models\ProjectUser;
|
||||
use yii\web\Response;
|
||||
use Yii;
|
||||
use backend\modules\task\models\Task;
|
||||
use backend\modules\task\models\TaskSearch;
|
||||
@ -124,4 +126,25 @@ class TaskController extends Controller
|
||||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
|
||||
public function actionCreator()
|
||||
{
|
||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
if (isset($_POST['depdrop_parents'])) {
|
||||
$parents = $_POST['depdrop_parents'];
|
||||
if ($parents != null) {
|
||||
$project_id = $parents[0];
|
||||
$users = ProjectUser::usersByProjectArr($project_id);
|
||||
|
||||
$formattedUsersArr = array();
|
||||
foreach ($users as $key => $value){
|
||||
$formattedUsersArr[] = array('id' => $key, 'name' => $value);
|
||||
}
|
||||
|
||||
return ['output'=>$formattedUsersArr, 'selected'=>''];
|
||||
}
|
||||
}
|
||||
return ['output'=>'', 'selected'=>''];
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace backend\modules\task\controllers;
|
||||
|
||||
use backend\modules\project\models\ProjectUser;
|
||||
use yii\web\Response;
|
||||
use Yii;
|
||||
use backend\modules\task\models\TaskUser;
|
||||
use backend\modules\task\models\TaskUserSearch;
|
||||
@ -124,4 +126,25 @@ class TaskUserController extends Controller
|
||||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
|
||||
public function actionExecutor()
|
||||
{
|
||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
if (isset($_POST['depdrop_parents'])) {
|
||||
$parents = $_POST['depdrop_parents'];
|
||||
if ($parents != null) {
|
||||
$task_id = $parents[0];
|
||||
$users = ProjectUser::usersByTaskArr($task_id);
|
||||
|
||||
$formattedUsersArr = array();
|
||||
foreach ($users as $key => $value){
|
||||
$formattedUsersArr[] = array('id' => $key, 'name' => $value);
|
||||
}
|
||||
|
||||
return ['output'=>$formattedUsersArr, 'selected'=>''];
|
||||
}
|
||||
}
|
||||
return ['output'=>'', 'selected'=>''];
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\task\models\Task;
|
||||
use kartik\depdrop\DepDrop;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
@ -12,9 +15,25 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'task_id')->textInput() ?>
|
||||
<?= $form->field($model, 'task_id')->dropDownList(Task::find()
|
||||
->select(['title', 'id'])->indexBy('id')->column(),
|
||||
[
|
||||
'id' => 'task-id',
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<?= $form->field($model, 'project_user_id')->textInput() ?>
|
||||
<?= $form->field($model, 'project_user_id')->widget(DepDrop::className(),
|
||||
[
|
||||
'options' => ['id' => 'project-user-id'],
|
||||
'pluginOptions' => [
|
||||
'depends' => ['task-id'],
|
||||
'placeholder' => 'Выберите',
|
||||
'url' => Url::to(['/task/task-user/executor'])
|
||||
]
|
||||
]
|
||||
); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
|
||||
|
@ -1,18 +1,15 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\task\models\TaskUser */
|
||||
|
||||
$this->title = 'Create Task User';
|
||||
$this->title = 'Назначить сотрудника';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Task Users', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="task-user-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\project\models\ProjectUser;
|
||||
use backend\modules\task\models\Task;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
@ -7,16 +10,13 @@ use yii\grid\GridView;
|
||||
/* @var $searchModel backend\modules\task\models\TaskUserSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'Task Users';
|
||||
$this->title = 'Исполнители задачи';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="task-user-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Create Task User', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
<?= Html::a('Назначить сотрудника', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
@ -25,9 +25,17 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'id',
|
||||
'task_id',
|
||||
'project_user_id',
|
||||
[
|
||||
'attribute' => 'task_id',
|
||||
'filter' => ArrayHelper::map(Task::find()->all(), 'id', 'title'),
|
||||
'value' => 'task.title'
|
||||
],
|
||||
[
|
||||
'attribute' => 'project_user_id',
|
||||
'filter' => ArrayHelper::map(ProjectUser::find()->joinWith('user')
|
||||
->all(), 'id', 'user.username'),
|
||||
'value' => 'projectUser.user.username'
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
|
@ -5,15 +5,13 @@ use yii\helpers\Html;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\task\models\TaskUser */
|
||||
|
||||
$this->title = 'Update Task User: ' . $model->id;
|
||||
$this->title = 'Изменить назначение';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Task Users', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="task-user-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
@ -1,23 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\task\models\TaskUser */
|
||||
|
||||
$this->title = $model->id;
|
||||
$this->title = 'Изменить назначение сотрудника';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Task Users', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
?>
|
||||
<div class="task-user-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
|
||||
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
@ -30,8 +30,14 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
'task_id',
|
||||
'project_user_id',
|
||||
[
|
||||
'attribute' => 'task_id',
|
||||
'value' => ArrayHelper::getValue($model, 'task.title'),
|
||||
],
|
||||
[
|
||||
'attribute' => 'project_user_id',
|
||||
'value' => ArrayHelper::getValue($model, 'projectUser.user.username'),
|
||||
],
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
@ -1,6 +1,12 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\project\models\Project;
|
||||
use backend\modules\project\models\ProjectUser;
|
||||
use common\helpers\StatusHelper;
|
||||
use kartik\depdrop\DepDrop;
|
||||
use kartik\select2\Select2;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
@ -12,17 +18,34 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'project_id')->textInput() ?>
|
||||
<?= $form->field($model, 'project_id')->dropDownList(Project::find()
|
||||
->select(['name', 'id'])->indexBy('id')->column(),
|
||||
[
|
||||
'id' => 'project-id',
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<?= $form->field($model, 'project_user_id')->widget(DepDrop::className(),
|
||||
[
|
||||
'options' => ['id' => 'project-user-id'],
|
||||
'pluginOptions' => [
|
||||
'depends' => ['project-id'],
|
||||
'placeholder' => 'Выберите',
|
||||
'url' => Url::to(['/task/task/creator'])
|
||||
]
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'status')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'created_at')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'updated_at')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'project_user_id')->textInput() ?>
|
||||
<?= $form->field($model, 'status')->dropDownList(
|
||||
StatusHelper::statusList(),
|
||||
[
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $form->field($model, 'user_id')->textInput() ?>
|
||||
|
||||
|
@ -1,18 +1,14 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\task\models\Task */
|
||||
|
||||
$this->title = 'Create Task';
|
||||
$this->title = 'Создать задачу';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Tasks', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="task-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\project\models\Project;
|
||||
use common\helpers\StatusHelper;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
@ -7,16 +10,13 @@ use yii\grid\GridView;
|
||||
/* @var $searchModel backend\modules\task\models\TaskSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'Tasks';
|
||||
$this->title = 'Задачи';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="task-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Create Task', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
<?= Html::a('Создать задачу', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
@ -25,15 +25,21 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'id',
|
||||
'project_id',
|
||||
[
|
||||
'attribute' => 'project_id',
|
||||
'filter' => ArrayHelper::map(Project::find()->all(), 'id', 'name'),
|
||||
'value' => 'project.name'
|
||||
],
|
||||
'title',
|
||||
'status',
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'format' => 'raw',
|
||||
'filter' => StatusHelper::statusList(),
|
||||
'value' => function ($model) {
|
||||
return StatusHelper::statusLabel($model->status);
|
||||
},
|
||||
],
|
||||
'created_at',
|
||||
//'updated_at',
|
||||
//'project_user_id',
|
||||
//'user_id',
|
||||
//'description',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
|
@ -5,15 +5,13 @@ use yii\helpers\Html;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\task\models\Task */
|
||||
|
||||
$this->title = 'Update Task: ' . $model->title;
|
||||
$this->title = 'Исполнители задачи: ' . $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Tasks', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="task-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
@ -1,23 +1,24 @@
|
||||
<?php
|
||||
|
||||
use common\helpers\StatusHelper;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\task\models\Task */
|
||||
|
||||
$this->title = $model->title;
|
||||
$this->title = 'Задача: ' . $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Tasks', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
?>
|
||||
<div class="task-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
|
||||
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
@ -30,13 +31,26 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
'project_id',
|
||||
[
|
||||
'attribute' => 'project_id',
|
||||
'value' => ArrayHelper::getValue($model, 'project.name')
|
||||
],
|
||||
'title',
|
||||
'status',
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'format' => 'raw',
|
||||
'value' => StatusHelper::statusLabel($model->status),
|
||||
],
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'project_user_id',
|
||||
'user_id',
|
||||
[
|
||||
'attribute' => 'project_user_id',
|
||||
'value' => ArrayHelper::getValue($model, 'projectUser.user.username'),
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_id',
|
||||
'value' => ArrayHelper::getValue($model, 'user.username'),
|
||||
],
|
||||
'description',
|
||||
],
|
||||
]) ?>
|
||||
|
Reference in New Issue
Block a user