]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Исправления по ревью
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 20 Nov 2024 10:40:17 +0000 (13:40 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 20 Nov 2024 10:40:17 +0000 (13:40 +0300)
erp24/controllers/crud/Product1cReplacementController.php
erp24/records/Product1cReplacementSearch.php
erp24/views/crud/product1c-replacement/_form.php
erp24/views/crud/product1c-replacement/update.php

index 9141d669201663f1663f432292627410a97b6774..727a00be9d92dfe315fd9db4328c52842144ad72 100644 (file)
@@ -30,14 +30,14 @@ class Product1cReplacementController extends Controller
                 'verbs' => [
                     'class' => VerbFilter::class,
                     'actions' => [
-                        //'delete' => ['POST'],
+
                     ],
                 ],
                 [
                     'class' => TimestampBehavior::class,
                     'createdAtAttribute' => 'created_at',
                     'updatedAtAttribute' => 'updated_at',
-                    //'deletedAtAttribute' => 'deleted_at',
+
                     'value' => new \yii\db\Expression('NOW()'),
                 ],
             ]
@@ -64,7 +64,6 @@ class Product1cReplacementController extends Controller
                 ->select('guid_replacement')
                 ->where(['guid' => $model->guid])
                 ->andWhere(['deleted_at' => null])
-               // ->distinct()
                 ->column();
         }
 
@@ -197,7 +196,7 @@ class Product1cReplacementController extends Controller
 
         if ($guid) {
 
-            if ($guid == "guid"){
+            if ($guid == "guid") {
                 $existingGuids = Product1cReplacement::find()
                     ->select(['guid'])
                     ->distinct()
@@ -256,7 +255,7 @@ class Product1cReplacementController extends Controller
             try {
                 $replacementData = $this->request->post('Product1cReplacement')['guid_replacement'] ?? [];
                 $replacementIds = $this->request->post('Product1cReplacement')['replacement_ids'] ?? [];
-                //var_dump($replacementData); die();
+
                 foreach ($replacementData as $index => $replacementGuid) {
                     if (!empty($replacementIds[$index])) {
 
index c7fe607a0a1a564e177f68b165fe6f25d7a92f63..5f95c943beba13ac64797f6197fceca232f44b5e 100644 (file)
@@ -70,4 +70,5 @@ class Product1cReplacementSearch extends Product1cReplacement
 
         return $dataProvider;
     }
-}
\ No newline at end of file
+
+}
index 27faa68b397d5449e594708a7a629ad7fdee6f1c..d364b6c9800f71641963f0967d5f1e90eff31ab0 100644 (file)
@@ -30,19 +30,21 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
                     'dataType' => 'json',
                     'data' => new JsExpression('function(params) { return {q:params.term, guid: "guid"}; }'),
                     'processResults' => new JsExpression('function(data) {
-                return {
-                    results: $.map(data.items, function(item) {
                         return {
-                            id: item.id,
-                            text: item.text 
+                            results: $.map(data.items, function(item) {
+                                return {
+                                    id: item.id,
+                                    text: item.text 
+                                };
+                            })
                         };
-                    })
-                };
-            }'),
+                    }'),
                 ],
             ],
         ]) ?>
-        <p class="text-danger">Внимание! Если товар не найден, проверьте общий список - возможно товар уже присутствует в списке замен</p>
+        <p class="text-danger">Внимание! Если товар не найден,
+            проверьте общий список - возможно товар
+            уже присутствует в списке замен</p>
         </div>
     </div>
 
@@ -58,29 +60,29 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
                     'url' => \yii\helpers\Url::to(['/crud/product1c-replacement/search']),
                     'dataType' => 'json',
                     'data' => new JsExpression('function(params) { 
-                var exclude = [];
-                exclude.push($("#product1creplacement-guid").val()); 
-                $(".guid-replacement-select").each(function() {
-                    if ($(this).val()) {
-                        exclude.push($(this).val());
-                    }
-                });
-                return {
-                    q: params.term,
-                    exclude: exclude.join(","),
-                    guid: $("#guid-select").val() 
-                };
-            }'),
-                    'processResults' => new JsExpression('function(data) {
-                return {
-                    results: $.map(data.items, function(item) {
+                        var exclude = [];
+                        exclude.push($("#product1creplacement-guid").val()); 
+                        $(".guid-replacement-select").each(function() {
+                         if ($(this).val()) {
+                              exclude.push($(this).val());
+                         }
+                     });
                         return {
-                            id: item.id,
-                            text: item.text
+                          q: params.term,
+                          exclude: exclude.join(","),
+                          guid: $("#guid-select").val() 
                         };
-                    })
-                };
-            }'),
+                    }'),
+                    'processResults' => new JsExpression('function(data) {
+                         return {
+                            results: $.map(data.items, function(item) {
+                               return {
+                                    id: item.id,
+                                    text: item.text
+                             };
+                         })
+                      };
+                    }'),
                 ],
             ],
         ]) ?>
index e5015049eae0406d40bead87fc73236d9e090942..3f6ff8ddcdc0971e5520f6b8ecad759d2434ad96 100644 (file)
@@ -12,7 +12,9 @@ $this->params['breadcrumbs'][] = 'Update';
 ?>
 <div class="product1-creplacement-update p-4">
     <?= Html::a('Отмена', ['index'], ['class' => 'btn btn-danger mb-4']) ?>
-    <h1><?= Html::encode($this->title) ?> <br> <?= $model->product->name ?> (<?= $model->product->id ?> , <?= $model->product->articule ?>) </h1>
+    <h1><?= Html::encode($this->title) ?> <br>
+        <?= $model->product->name ?>
+        (<?= $model->product->id ?>, <?= $model->product->articule ?>) </h1>
 
     <?= $this->render('multy-form', [
         'model' => $model,