]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Правки по ревью
authorvladfo <fvv2011@gmail.com>
Tue, 24 Sep 2024 12:21:30 +0000 (15:21 +0300)
committervladfo <fvv2011@gmail.com>
Tue, 24 Sep 2024 12:21:30 +0000 (15:21 +0300)
erp24/actions/task/IndexAction.php
erp24/controllers/crud/TaskController.php
erp24/views/crud/task/_form.php
erp24/views/crud/task/create.php
erp24/views/crud/task/update.php

index 409918c9d71613dc245e0d24f19c002394a0a0f3..6193c6d4ebc6e87c132a0662c57f6544e67ce301 100755 (executable)
@@ -249,19 +249,16 @@ class IndexAction extends Action
         }
 
         $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', '');
@@ -296,7 +293,7 @@ class IndexAction extends Action
         }
         }
         $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 = [];
index ced8806525a58b9bb157b53adb610f47cf5b06dc..ca3898695b150447f118130bb2a7507823345a14 100644 (file)
@@ -188,11 +188,16 @@ class TaskController extends Controller
         $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'));
     }
 
 // Метод для сохранения пользователей задачи и наблюдателей
@@ -387,6 +392,10 @@ class TaskController extends Controller
         $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);
 
         // Получаем данные из базы данных
@@ -401,7 +410,7 @@ class TaskController extends Controller
 
         return $this->render('update',
             compact('model', 'entities', 'taskEntity','tasksType', 'taskStatus', 'taskAlertLevels', 'comment',
-                'canUpdateAll', 'canUpdateStatusAndDuration'));
+                'canUpdateAll', 'canUpdateStatusAndDuration', 'priorities'));
     }
 
     /**
index 6d0c8198a1989e2d78ee73311f623b3e4b83722e..ac2b3768301b83d674a76fafec924913a08efaa5 100755 (executable)
@@ -80,13 +80,11 @@ $this->registerJsFile('/js/crud/task/update.js', ['position' => \yii\web\View::P
         ]
     ])->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)) ?>
@@ -95,20 +93,8 @@ $this->registerJsFile('/js/crud/task/update.js', ['position' => \yii\web\View::P
     PrintBlockHelper::printBlock(
         'Приоритет',
         $form->field($model, 'prioritet')->dropDownList(
-            [
-                0 => 'Очень низкий',
-                1 => 'Низкий',
-                2 => 'Терпит',
-                3 => 'Можно не спешить',
-                4 => 'Пониженный',
-                5 => 'Обычный',
-                6 => 'Повышенный',
-                7 => 'Ниже среднего',
-                8 => 'Средний',
-                9 => 'Высокий',
-                10 => 'Самая важная'
-            ],
-            ['prompt' => 'Выберите приоритет'] // Опционально: можно добавить "пустую" опцию
+            $priorities,
+            ['prompt' => 'Выберите приоритет']
         )->label(false)
     );
     ?>
index 4a12b298f98ac6986ac2011cd9ec175f57f07296..4a71e85d5900deb7ee18a1d12ad4ff2fb954fea1 100755 (executable)
@@ -19,6 +19,6 @@ $canUpdateStatusAndDuration = true;
     <h1><?= Html::encode($this->title) ?></h1>
 
     <?= $this->render('_form', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels',
-        'canUpdateAll', 'canUpdateStatusAndDuration')) ?>
+        'canUpdateAll', 'canUpdateStatusAndDuration', 'priorities')) ?>
 
 </div>
index 6972ee7a760817d6c766c4c75082036f5bc14024..dcbfa4bbc49a324b6effec2a1a412f6ab7e4f1c6 100755 (executable)
@@ -23,6 +23,6 @@ $this->params['breadcrumbs'][] = 'Update';
         <?= Html::encode($model->name) ?></h3>
 
     <?= $this->render('_form', compact('model', 'entities', 'taskEntity', 'tasksType', 'taskStatus', 'taskAlertLevels', 'comment',
-    'canUpdateAll', 'canUpdateStatusAndDuration')) ?>
+    'canUpdateAll', 'canUpdateStatusAndDuration', 'priorities')) ?>
 
 </div>