]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-282 Нужно сделать интерфейс настройки магазина
authormarina <m.zozirova@gmail.com>
Fri, 24 Jan 2025 09:59:24 +0000 (12:59 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 24 Jan 2025 09:59:24 +0000 (12:59 +0300)
erp24/controllers/CityStoreParamsController.php
erp24/records/CityStoreParams.php
erp24/views/city-store-params/view.php

index 51050cd9b0bdfad26bee128efe8072ee8d905320..a0ed126c007605b499e9015d0b1ced7f1ae5e5db 100644 (file)
@@ -61,30 +61,13 @@ class CityStoreParamsController extends Controller
             ? $this->findModel(Yii::$app->request->post()['CityStoreParams']['id'])
             : new CityStoreParams();
 
-
         if ($model->load(Yii::$app->request->post())) {
             $model->matrix_type = is_array($model->matrix_type) ? implode(',', $model->matrix_type) : $model->matrix_type;
-//            $oldStoreDynamic = StoreDynamic::findOne(['store_id' => $model->store_id, 'category' => 1, 'active' => 1]) ?? null;
-//            if ($oldStoreDynamic != $model->bush_id) {
-//                $newStoreDynamic = new StoreDynamic();
-//                $newStoreDynamic->setAttributes([
-//                    'store_id' => $model->store_id,
-//                    'value_type' => 'int',
-//                    'value_int' => $model->bush_id,
-//                    'date_from' => new Expression('now()'),
-//                    'date_to' => '2100-01-01 00:00:00',
-//                    'active' => 1,
-//                    'category' => 1
-//                ]);
-//                $oldStoreDynamic->update(['date_to' => new Expression('now()'), 'active' => 0], ['store_id' => $model->store_id, 'category' => 1, 'active' => 1]);
-//            }
-//
-////            $oldBushChefFlorist =
-
-            if ($model->validate()) {
-                $model->save();
-                return $this->redirect(['view', 'id' => $model->id]);
-            }
+        }
+
+        if ($model->validate()) {
+            $model->save();
+            return $this->redirect(['view', 'id' => $model->id]);
         }
 
         return $this->render('index');
index 56d1b3770e2dad2ab6db5b3634502fa27c4b9d3b..3c991112178af31795574cdcff958ae925eb1630 100644 (file)
@@ -138,4 +138,8 @@ class CityStoreParams extends ActiveRecord
     public function getAddressCity() {
         return $this->hasOne(StoreCityList::class, ['id' => 'address_city']);
     }
+
+    public function getBush() {
+        return $this->hasOne(ClusterAdmin::class, ['id' => 'bush_id']);
+    }
 }
index 0fe79ce2e3a409088a074a2e58b7047aabfa6c57..f3a4d64848f44d0d40ea1fe61bee281cdf99dd78 100644 (file)
@@ -61,6 +61,12 @@ $this->params['breadcrumbs'][] = $this->title;
                             return $data->territorialManager->name_full ?? '';
                         }
                     ],
+                    [
+                        'attribute' => 'bushId',
+                        'value' => function ($data) {
+                            return $data->bush->name ?? '';
+                        }
+                    ],
                     [
                         'attribute' => 'bush_chef_florist',
                         'value' => function ($data) {