From: Aleksey Filippov Date: Tue, 19 Aug 2025 16:23:53 +0000 (+0300) Subject: [ERP-454] Добавил фильтр по умолчанию X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=db86d7549d35745a02cde7d8bc52f1fe6ccac2c5;p=erp24_rep%2Fyii-erp24%2F.git [ERP-454] Добавил фильтр по умолчанию --- diff --git a/erp24/controllers/MatrixErpController.php b/erp24/controllers/MatrixErpController.php index 2226b4ee..5cdec005 100644 --- a/erp24/controllers/MatrixErpController.php +++ b/erp24/controllers/MatrixErpController.php @@ -106,16 +106,6 @@ class MatrixErpController extends Controller ], ]); - if(Yii::$app->request->isPost && $filterModel->load(Yii::$app->request->post())){ - $nameFilter = $filterModel->nameFilter; - $groupNameFilter = $filterModel->groupNameFilter; - $activeFilter = $filterModel->activeFilter; - - } - - - - $searchModel = new MatrixErpSearch(); $dataProvider = $searchModel->search($this->request->queryParams); @@ -126,6 +116,15 @@ class MatrixErpController extends Controller ; + if(Yii::$app->request->isPost && $filterModel->load(Yii::$app->request->post())){ + $nameFilter = $filterModel->nameFilter; + $groupNameFilter = $filterModel->groupNameFilter; + $activeFilter = $filterModel->activeFilter; + + } else { + $query->andWhere(['group_name' => 'marketplace']); + } + if (isset($groupNameFilter) && $groupNameFilter != "") { if (!empty($groupNameFilter)) { $query->andWhere(['group_name' => $groupNameFilter]); diff --git a/erp24/views/matrix_erp/index.php b/erp24/views/matrix_erp/index.php index f65c99c9..5235e3f8 100644 --- a/erp24/views/matrix_erp/index.php +++ b/erp24/views/matrix_erp/index.php @@ -88,9 +88,13 @@ $this->params['breadcrumbs'][] = $this->title;
field($filterModel, 'groupNameFilter')->dropDownList(array_merge(['' => 'Все'], ArrayHelper::map( + echo $form->field($filterModel, 'groupNameFilter')->dropDownList(array_merge([ + 'marketplace' => 'marketplace', + '' => 'Все', + ], ArrayHelper::map( \yii_app\records\MatrixErp::find() ->select(['group_name' => new \yii\db\Expression("DISTINCT(group_name)")]) + ->where(['!=','group_name' , 'marketplace']) ->orderBy(['group_name' => SORT_ASC]) ->asArray() ->all(), diff --git a/erp24/views/matrix_erp/update.php b/erp24/views/matrix_erp/update.php index a03672b7..79b219d1 100644 --- a/erp24/views/matrix_erp/update.php +++ b/erp24/views/matrix_erp/update.php @@ -29,6 +29,7 @@ $this->params['breadcrumbs'][] = 'Update'; 'attributes' => [ // 'id', 'name', + 'articule', 'price.price', 'group_name', 'code', @@ -44,7 +45,7 @@ $this->params['breadcrumbs'][] = 'Update'; // 'updated_admin_id', // 'created_at', // 'created_admin_id', -// 'articule', + ], ]) ?>