diff --git a/backend/modules/task/models/ProjectTaskSearch.php b/backend/modules/task/models/ProjectTaskSearch.php
index 6b60bee..9c20656 100644
--- a/backend/modules/task/models/ProjectTaskSearch.php
+++ b/backend/modules/task/models/ProjectTaskSearch.php
@@ -62,6 +62,7 @@ class ProjectTaskSearch extends ProjectTask
'id' => $this->id,
'project_task.project_id' => $this->project_id,
'project_task.status' => $this->status,
+ 'project_task.execution_priority' => $this->execution_priority,
'project_task.created_at' => $this->created_at,
'project_task.updated_at' => $this->updated_at,
]);
diff --git a/backend/modules/task/views/task/_form.php b/backend/modules/task/views/task/_form.php
index 7ae2466..f8c8e20 100644
--- a/backend/modules/task/views/task/_form.php
+++ b/backend/modules/task/views/task/_form.php
@@ -60,12 +60,12 @@ use yii\widgets\ActiveForm;
= $form->field($model, 'priority')->input('number') ?>
-//= $form->field($model, 'priority')->dropDownList(
-// ProjectTask::priorityList(),
-// [
-// 'prompt' => 'Выберите'
-// ]
-// ) ?>
+ = $form->field($model, 'execution_priority')->dropDownList(
+ ProjectTask::priorityList(),
+ [
+ 'prompt' => 'Выберите'
+ ]
+ ) ?>
= Html::submitButton('Создать', ['class' => 'btn btn-success']) ?>
diff --git a/backend/modules/task/views/task/index.php b/backend/modules/task/views/task/index.php
index b130a43..538f42c 100644
--- a/backend/modules/task/views/task/index.php
+++ b/backend/modules/task/views/task/index.php
@@ -58,14 +58,14 @@ $this->params['breadcrumbs'][] = $this->title;
return StatusHelper::statusLabel($model->status);
}
],
-// [
-// 'attribute' => 'priority',
-// 'format' => 'raw',
-// 'filter' => ProjectTask::priorityList(),
-// 'value' => function($model){
-// return ProjectTask::getPriority($model->status);
-// }
-// ],
+ [
+ 'attribute' => 'execution_priority',
+ 'format' => 'raw',
+ 'filter' => ProjectTask::priorityList(),
+ 'value' => function($model){
+ return ProjectTask::getPriority($model->status);
+ }
+ ],
[
'attribute' => 'created_at',
'format' => ['datetime', 'php:d.m.Y H:i']
diff --git a/backend/modules/task/views/task/view.php b/backend/modules/task/views/task/view.php
index c13a900..0f458b1 100644
--- a/backend/modules/task/views/task/view.php
+++ b/backend/modules/task/views/task/view.php
@@ -61,12 +61,12 @@ YiiAsset::register($this);
],
'description',
'priority',
-// [
-// 'attribute' => 'priority',
-// 'value' => function($model){
-// return ProjectTask::getPriority($model->status);
-// }
-// ],
+ [
+ 'attribute' => 'execution_priority',
+ 'value' => function($model){
+ return ProjectTask::getPriority($model->status);
+ }
+ ],
],
]) ?>
diff --git a/common/models/ProjectTask.php b/common/models/ProjectTask.php
index 37f94e4..7321c9b 100644
--- a/common/models/ProjectTask.php
+++ b/common/models/ProjectTask.php
@@ -21,6 +21,7 @@ use yii\helpers\ArrayHelper;
* @property int $user_id
* @property int $executor_id
* @property int $priority
+ * @property int $execution_priority
* @property string $description
* @property string $dead_line
*
@@ -37,31 +38,31 @@ class ProjectTask extends ActiveRecord
const STATUS_ACTIVE = 1;
const STATUS_DISABLE = 0;
-// const PRIORITY_LOW = 0;
-// const PRIORITY_MEDIUM = 1;
-// const PRIORITY_HIGH = 2;
-//
-// /**
-// * @return string[]
-// */
-// public static function priorityList() :array
-// {
-// return [
-// self::PRIORITY_LOW => 'Низкий',
-// self::PRIORITY_MEDIUM => 'Средний',
-// self::PRIORITY_HIGH => 'Высокий',
-// ];
-// }
+ const PRIORITY_LOW = 0;
+ const PRIORITY_MEDIUM = 1;
+ const PRIORITY_HIGH = 2;
-// /**
-// * @param $priority
-// * @return string
-// * @throws \Exception
-// */
-// public static function getPriority($priority): string
-// {
-// return ArrayHelper::getValue(self::priorityList(), $priority);
-// }
+ /**
+ * @return string[]
+ */
+ public static function priorityList() :array
+ {
+ return [
+ self::PRIORITY_LOW => 'Низкий',
+ self::PRIORITY_MEDIUM => 'Средний',
+ self::PRIORITY_HIGH => 'Высокий',
+ ];
+ }
+
+ /**
+ * @param $priority
+ * @return string
+ * @throws \Exception
+ */
+ public static function getPriority($priority): string
+ {
+ return ArrayHelper::getValue(self::priorityList(), $priority);
+ }
/**
* {@inheritdoc}
@@ -90,9 +91,9 @@ class ProjectTask extends ActiveRecord
{
return [
[['project_id', 'status', 'title', 'description',], 'required'],
- [['project_id', 'status', 'column_id', 'user_id', 'executor_id', 'priority'], 'integer'],
+ [['project_id', 'status', 'column_id', 'user_id', 'executor_id', 'priority', 'execution_priority'], 'integer'],
[['created_at', 'updated_at', 'dead_line'], 'safe'],
-// ['status', 'in', 'range' => [self::PRIORITY_LOW, self::PRIORITY_MEDIUM, self::PRIORITY_HIGH]],
+ ['execution_priority', 'in', 'range' => [self::PRIORITY_LOW, self::PRIORITY_MEDIUM, self::PRIORITY_HIGH]],
['title', 'unique', 'targetAttribute' => ['title', 'project_id'], 'message' => 'Такая задача уже создана'],
[['title'], 'string', 'max' => 255],
[['description'], 'string', 'max' => 1500],
@@ -121,6 +122,7 @@ class ProjectTask extends ActiveRecord
'executor_id' => 'Исполнитель',
'priority' => 'Приоритет',
'dead_line' => 'Срок выполнения задачи',
+ 'execution_priority' => 'Приоритет выполнения',
];
}
@@ -165,7 +167,8 @@ class ProjectTask extends ActiveRecord
return Comment::find()->where(['entity_id' => $this->id, 'entity_type' => 2, 'status' => Comment::STATUS_ACTIVE])->count();
},
'taskUsers',
- 'mark'
+ 'mark',
+ 'execution_priority'
];
}
diff --git a/console/migrations/m231013_144526_add_execution_priority_column_to_project_task_table.php b/console/migrations/m231013_144526_add_execution_priority_column_to_project_task_table.php
new file mode 100644
index 0000000..8dea2cd
--- /dev/null
+++ b/console/migrations/m231013_144526_add_execution_priority_column_to_project_task_table.php
@@ -0,0 +1,25 @@
+addColumn('project_task', 'execution_priority', $this->integer(1));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->dropColumn('project_task', 'execution_priority');
+ }
+}
diff --git a/frontend/modules/api/controllers/TaskController.php b/frontend/modules/api/controllers/TaskController.php
index 89cdde9..77d830c 100644
--- a/frontend/modules/api/controllers/TaskController.php
+++ b/frontend/modules/api/controllers/TaskController.php
@@ -75,6 +75,11 @@ class TaskController extends ApiController
* description="Приоритет задачи.",
* ),
* @OA\Property(
+ * property="execution_priority",
+ * type="integer",
+ * description="Приоритет выполнения задачи (0 - low, 1 - medium, 2 - high)",
+ * ),
+ * @OA\Property(
* property="column_id",
* type="integer",
* description="Колонка к которой относится задача",