rollback last changes

This commit is contained in:
iIronside 2023-10-13 17:00:01 +03:00
parent 5ce77f2ef0
commit 5b3f6518dc
6 changed files with 50 additions and 48 deletions

View File

@ -18,7 +18,7 @@ class ProjectTaskSearch extends ProjectTask
public function rules() public function rules()
{ {
return [ return [
[['id', 'project_id', 'status', 'priority'], 'integer'], // 'card_id_creator', 'card_id' [['id', 'project_id', 'status'], 'integer'], // 'card_id_creator', 'card_id'
[['title', 'created_at', 'updated_at', 'description'], 'safe'], [['title', 'created_at', 'updated_at', 'description'], 'safe'],
]; ];
} }
@ -62,7 +62,6 @@ class ProjectTaskSearch extends ProjectTask
'id' => $this->id, 'id' => $this->id,
'project_task.project_id' => $this->project_id, 'project_task.project_id' => $this->project_id,
'project_task.status' => $this->status, 'project_task.status' => $this->status,
'project_task.priority' => $this->priority,
'project_task.created_at' => $this->created_at, 'project_task.created_at' => $this->created_at,
'project_task.updated_at' => $this->updated_at, 'project_task.updated_at' => $this->updated_at,
]); ]);

View File

@ -58,12 +58,14 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'description')->textarea(['rows' => '6']) ?> <?= $form->field($model, 'description')->textarea(['rows' => '6']) ?>
<?= $form->field($model, 'priority')->dropDownList( <?= $form->field($model, 'priority')->input('number') ?>
ProjectTask::priorityList(),
[ <!-- --><?//= $form->field($model, 'priority')->dropDownList(
'prompt' => 'Выберите' // ProjectTask::priorityList(),
] // [
) ?> // 'prompt' => 'Выберите'
// ]
// ) ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton('Создать', ['class' => 'btn btn-success']) ?> <?= Html::submitButton('Создать', ['class' => 'btn btn-success']) ?>

View File

@ -58,14 +58,14 @@ $this->params['breadcrumbs'][] = $this->title;
return StatusHelper::statusLabel($model->status); return StatusHelper::statusLabel($model->status);
} }
], ],
[ // [
'attribute' => 'priority', // 'attribute' => 'priority',
'format' => 'raw', // 'format' => 'raw',
'filter' => ProjectTask::priorityList(), // 'filter' => ProjectTask::priorityList(),
'value' => function($model){ // 'value' => function($model){
return ProjectTask::getPriority($model->status); // return ProjectTask::getPriority($model->status);
} // }
], // ],
[ [
'attribute' => 'created_at', 'attribute' => 'created_at',
'format' => ['datetime', 'php:d.m.Y H:i'] 'format' => ['datetime', 'php:d.m.Y H:i']

View File

@ -60,12 +60,13 @@ YiiAsset::register($this);
'value' => ArrayHelper::getValue($model, 'executor.userCard.fio'), 'value' => ArrayHelper::getValue($model, 'executor.userCard.fio'),
], ],
'description', 'description',
[ 'priority',
'attribute' => 'priority', // [
'value' => function($model){ // 'attribute' => 'priority',
return ProjectTask::getPriority($model->status); // 'value' => function($model){
} // return ProjectTask::getPriority($model->status);
], // }
// ],
], ],
]) ?> ]) ?>

View File

@ -37,31 +37,31 @@ class ProjectTask extends ActiveRecord
const STATUS_ACTIVE = 1; const STATUS_ACTIVE = 1;
const STATUS_DISABLE = 0; const STATUS_DISABLE = 0;
const PRIORITY_LOW = 0; // const PRIORITY_LOW = 0;
const PRIORITY_MEDIUM = 1; // const PRIORITY_MEDIUM = 1;
const PRIORITY_HIGH = 2; // const PRIORITY_HIGH = 2;
//
// /**
// * @return string[]
// */
// public static function priorityList() :array
// {
// return [
// self::PRIORITY_LOW => 'Низкий',
// self::PRIORITY_MEDIUM => 'Средний',
// self::PRIORITY_HIGH => 'Высокий',
// ];
// }
/** // /**
* @return string[] // * @param $priority
*/ // * @return string
public static function priorityList() :array // * @throws \Exception
{ // */
return [ // public static function getPriority($priority): string
self::PRIORITY_LOW => 'Низкий', // {
self::PRIORITY_MEDIUM => 'Средний', // return ArrayHelper::getValue(self::priorityList(), $priority);
self::PRIORITY_HIGH => 'Высокий', // }
];
}
/**
* @param $priority
* @return string
* @throws \Exception
*/
public static function getPriority($priority): string
{
return ArrayHelper::getValue(self::priorityList(), $priority);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -92,7 +92,7 @@ class ProjectTask extends ActiveRecord
[['project_id', 'status', 'title', 'description',], 'required'], [['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'], 'integer'],
[['created_at', 'updated_at', 'dead_line'], 'safe'], [['created_at', 'updated_at', 'dead_line'], 'safe'],
['status', 'in', 'range' => [self::PRIORITY_LOW, self::PRIORITY_MEDIUM, self::PRIORITY_HIGH]], // ['status', 'in', 'range' => [self::PRIORITY_LOW, self::PRIORITY_MEDIUM, self::PRIORITY_HIGH]],
['title', 'unique', 'targetAttribute' => ['title', 'project_id'], 'message' => 'Такая задача уже создана'], ['title', 'unique', 'targetAttribute' => ['title', 'project_id'], 'message' => 'Такая задача уже создана'],
[['title'], 'string', 'max' => 255], [['title'], 'string', 'max' => 255],
[['description'], 'string', 'max' => 1500], [['description'], 'string', 'max' => 1500],

View File

@ -72,7 +72,7 @@ class TaskController extends ApiController
* @OA\Property( * @OA\Property(
* property="priority", * property="priority",
* type="integer", * type="integer",
* description="Приоритет задачи. (0 -low, 1 - medium, 2 - high)", * description="Приоритет задачи.",
* ), * ),
* @OA\Property( * @OA\Property(
* property="column_id", * property="column_id",