add task, fixed executors in all projects

This commit is contained in:
iIronside
2021-11-24 13:05:12 +03:00
parent a058b1baa1
commit 7d886ff7c3
19 changed files with 1444 additions and 85 deletions

View File

@ -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']) ?>

View File

@ -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,
]) ?>

View File

@ -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'],
],

View File

@ -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,
]) ?>

View File

@ -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'),
],
],
]) ?>