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

index d364b6c9800f71641963f0967d5f1e90eff31ab0..1cc4c4310a862a41a3dfa42a0fbfdf1b459b1614 100644 (file)
@@ -17,8 +17,7 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
 
     <?php $form = ActiveForm::begin(['id' => 'product-replacement-form']); ?>
     <div class="row mb-3">
-
-    <div class="col-6">
+        <div class="col-6">
 
         <?= $form->field($model, 'guid')->widget(Select2::class, [
             'options' => ['placeholder' => 'Выберите товар...'],
@@ -34,7 +33,7 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
                             results: $.map(data.items, function(item) {
                                 return {
                                     id: item.id,
-                                    text: item.text 
+                                    text: item.text
                                 };
                             })
                         };
@@ -50,7 +49,7 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
 
 
     <div class="row">
-    <div id="guid-replacement-container" class="col-6">
+     <div id="guid-replacement-container" class="col-6">
         <?= $form->field($model, 'guid_replacement[]')->widget(Select2::class, [
             'options' => ['placeholder' => 'Выберите замену...', 'class' => 'guid-replacement-select'],
             'pluginOptions' => [
@@ -59,9 +58,9 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
                 'ajax' => [
                     'url' => \yii\helpers\Url::to(['/crud/product1c-replacement/search']),
                     'dataType' => 'json',
-                    'data' => new JsExpression('function(params) { 
+                    'data' => new JsExpression('function(params) {
                         var exclude = [];
-                        exclude.push($("#product1creplacement-guid").val()); 
+                        exclude.push($("#product1creplacement-guid").val());
                         $(".guid-replacement-select").each(function() {
                          if ($(this).val()) {
                               exclude.push($(this).val());
@@ -70,7 +69,7 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
                         return {
                           q: params.term,
                           exclude: exclude.join(","),
-                          guid: $("#guid-select").val() 
+                          guid: $("#guid-select").val()
                         };
                     }'),
                     'processResults' => new JsExpression('function(data) {
@@ -86,8 +85,7 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \
                 ],
             ],
         ]) ?>
-
-    </div>
+        </div>
     </div>
 
     <!-- Кнопка добавления нового Select2 -->
index d2d599cc25260008ed6277c11ed2b985385ffba5..fb24a8252404dfce95b8e076e5843f3e48201c06 100644 (file)
@@ -18,31 +18,9 @@ $this->registerJsFile('/js/crud/product1cReplacement/multy-form.js', ['position'
 
         <?php $form = ActiveForm::begin(['id' => 'product-replacement-form']); ?>
 
-        <!-- Скрытое поле GUID -->
+
         <?= Html::activeHiddenInput($model, 'guid', ['id' => 'guid-select']) ?>
-       <!-- --><?php /*= $form->field($model, 'guid')->widget(Select2::class, [
-            'value' => $model->id,
-            'options' => ['placeholder' => 'Выберите товар...', 'id' => 'product-replacement-form-guid'],
-            'pluginOptions' => [
-                'allowClear' => true,
-                'minimumInputLength' => 1,
-                'ajax' => [
-                    'url' => \yii\helpers\Url::to(['/crud/product1c-replacement/search']),
-                    'dataType' => 'json',
-                    'data' => new JsExpression('function(params) { return {q:params.term}; }'),
-                    'processResults' => new JsExpression('function(data) {
-                    return {
-                        results: $.map(data.items, function(item) {
-                            return {
-                                id: item.id,
-                                text: item.text
-                            };
-                        })
-                    };
-                }'),
-                ],
-            ],
-        ]) */?>
+
 
 <div class="row">
         <div id="guid-replacement-container" class="col-6">
@@ -68,7 +46,7 @@ $this->registerJsFile('/js/crud/product1cReplacement/multy-form.js', ['position'
                         'ajax' => [
                             'url' => \yii\helpers\Url::to(['/crud/product1c-replacement/search']),
                             'dataType' => 'json',
-                            'data' => new JsExpression('function(params) { 
+                            'data' => new JsExpression('function(params) {
                                 var exclude = [];
                                 exclude.push($("#guid-select").val());
                                 $(".guid-replacement-select").each(function() {
@@ -78,34 +56,30 @@ $this->registerJsFile('/js/crud/product1cReplacement/multy-form.js', ['position'
                                  });
                                  return {
                                      q: params.term,
-                                      exclude: exclude.join(","),
-                     
+                                     exclude: exclude.join(","),
                                       };
                              }'),
                             'processResults' => new JsExpression('function(data) {
-                        return {
-                            results: $.map(data.items, function(item) {
-                                return {
-                                    id: item.id,
-                                    text: item.text
-                                };
-                            })
-                        };
-                    }'),
+                                 return {
+                                    results: $.map(data.items, function(item) {
+                                         return {
+                                          id: item.id,
+                                          text: item.text
+                                          };
+                                    })
+                                 };
+                             }'),
                         ],
                         'initSelection' => new JsExpression('function (element, callback) {
-                    var data = {id: ' . json_encode($replacement->guid_replacement) . ', text: ' . json_encode($replacementName) . '};
-                    callback(data);
-                }'),
+                              var data = {id: ' . json_encode($replacement->guid_replacement) . ', text: ' . json_encode($replacementName) . '};
+                              callback(data);
+                         }'),
                     ],
                 ]) ?>
                 <button type="button"
                         class="btn btn-danger delete-guid-replacement btn-remove"
-
                         data-url="<?= \yii\helpers\Url::to(['/crud/product1c-replacement/delete', 'id' => $replacement->id]) ?>"
-                        style="position: absolute; right: -40px; top:33%; width:auto;">
-                    ×
-                </button>
+                        style="position: absolute; right: -40px; top:33%; width:auto;">×</button>
             </div>
             <?php endforeach; ?>