From: fomichev Date: Wed, 20 Nov 2024 10:49:33 +0000 (+0300) Subject: Исправления по ревью 2 X-Git-Tag: 1.7~226^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=9e48b2adb5dde398eea6279178f73b5ecae1d1cf;p=erp24_rep%2Fyii-erp24%2F.git Исправления по ревью 2 --- diff --git a/erp24/views/crud/product1c-replacement/_form.php b/erp24/views/crud/product1c-replacement/_form.php index d364b6c9..1cc4c431 100644 --- a/erp24/views/crud/product1c-replacement/_form.php +++ b/erp24/views/crud/product1c-replacement/_form.php @@ -17,8 +17,7 @@ $this->registerJsFile('/js/crud/product1cReplacement/_form.js', ['position' => \ 'product-replacement-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' => \
-
+
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' => \ ], ], ]) ?> - -
+
diff --git a/erp24/views/crud/product1c-replacement/multy-form.php b/erp24/views/crud/product1c-replacement/multy-form.php index d2d599cc..fb24a825 100644 --- a/erp24/views/crud/product1c-replacement/multy-form.php +++ b/erp24/views/crud/product1c-replacement/multy-form.php @@ -18,31 +18,9 @@ $this->registerJsFile('/js/crud/product1cReplacement/multy-form.js', ['position' 'product-replacement-form']); ?> - + 'guid-select']) ?> - 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 - }; - }) - }; - }'), - ], - ], - ]) */?> +
@@ -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); + }'), ], ]) ?> + style="position: absolute; right: -40px; top:33%; width:auto;">×