}
$text = Yii::$app->request->post('name');
- // var_dump($text);
+
if (!isset($text)) {
$text = Yii::$app->session->get('searchFilter');
}
if (isset($text) && !empty($text)) {
Yii::$app->session->set('searchFilter', $text);
- //$text = 'Создание';
+
$tasks = Task::find()
- ->where(
- ['ilike', 'task.name', $text], // Регистронезависимый поиск по полю name
- );// Получаем все записи
+ ->where(['ilike', 'task.name', '%' . $text . '%', false]) ;
- // var_dump($tasks);
} else {
Yii::$app->session->set('searchFilter', '');
}
}
$tasks = $tasks->andWhere(['or', ['task.parent_id' => 0], ['task.parent_id' => null]])->all();
- //var_dump($tasks);
+
if (Yii::$app->request->isPjax) {
$task = Task::findOne($task_id);
$balance = [];
$model->deadline = date("Y-m-d H:i:s", strtotime("+1 day", strtotime($model->data_start)));
$model->data_end = date("Y-m-d H:i:s", strtotime("+1 day", strtotime($model->data_start)));
$model->group_id = 1;
+
+ $priorities = array_map(function($priority) {
+ return $priority['label'];
+ }, Task::getPriorities());
+
if ($isAjax) {
- return $this->renderAjax('_form', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels', 'canUpdateAll', 'canUpdateStatusAndDuration'));
+ return $this->renderAjax('_form', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels', 'canUpdateAll', 'canUpdateStatusAndDuration', 'priorities'));
}
- return $this->render('create', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels'));
+ return $this->render('create', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels', 'priorities'));
}
// Метод для сохранения пользователей задачи и наблюдателей
$taskStatus = TaskStatus::find()->all();
$taskAlertLevels = TaskAlertLevel::find()->all();
+ $priorities = array_map(function($priority) {
+ return $priority['label'];
+ }, Task::getPriorities());
+
$entities = TaskService::getEntitiesByAlias(TaskEntity::findOne($model->entity_type)->alias);
// Получаем данные из базы данных
return $this->render('update',
compact('model', 'entities', 'taskEntity','tasksType', 'taskStatus', 'taskAlertLevels', 'comment',
- 'canUpdateAll', 'canUpdateStatusAndDuration'));
+ 'canUpdateAll', 'canUpdateStatusAndDuration', 'priorities'));
}
/**
]
])->label(false)) ?>
- <?php // $form->field($model, 'entity_id')->textInput() ?>
+
<?php PrintBlockHelper::printBlock('Сущность', $form->field($model, 'entity_id')->dropDownList($entities, ['disabled' => $canUpdateAll ? null : 'disabled'])->label(false)) ?>
- <?php // $form->field($model, 'entity_type')->dropDownList(
- // ArrayHelper::map($entityType, 'id', 'name')) ?>
<?php PrintBlockHelper::printBlock('Статус', $form->field($model, 'status')->dropDownList(
ArrayHelper::map($taskStatus, 'id','name'), ['disabled' => $canUpdateStatusAndDuration ? null : 'disabled'])->label(false)) ?>
PrintBlockHelper::printBlock(
'Приоритет',
$form->field($model, 'prioritet')->dropDownList(
- [
- 0 => 'Очень низкий',
- 1 => 'Низкий',
- 2 => 'Терпит',
- 3 => 'Можно не спешить',
- 4 => 'Пониженный',
- 5 => 'Обычный',
- 6 => 'Повышенный',
- 7 => 'Ниже среднего',
- 8 => 'Средний',
- 9 => 'Высокий',
- 10 => 'Самая важная'
- ],
- ['prompt' => 'Выберите приоритет'] // Опционально: можно добавить "пустую" опцию
+ $priorities,
+ ['prompt' => 'Выберите приоритет']
)->label(false)
);
?>
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels',
- 'canUpdateAll', 'canUpdateStatusAndDuration')) ?>
+ 'canUpdateAll', 'canUpdateStatusAndDuration', 'priorities')) ?>
</div>
<?= Html::encode($model->name) ?></h3>
<?= $this->render('_form', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels', 'comment',
- 'canUpdateAll', 'canUpdateStatusAndDuration')) ?>
+ 'canUpdateAll', 'canUpdateStatusAndDuration', 'priorities')) ?>
</div>