From 25fb512468c7ea6a4ed3984621ea84e81185a202 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 10 Dec 2024 14:22:19 +0300 Subject: [PATCH] =?utf8?q?=D0=A0=D0=B0=D0=B7=D1=80=D0=B5=D1=88=D0=B5=D0=BD?= =?utf8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D1=8B?= =?utf8?q?=20=D1=81=20=D0=B8=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=D0=B0=D0=BC?= =?utf8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/views/shift-transfer/update.php | 1 + erp24/web/js/shift-transfer/update.js | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/erp24/views/shift-transfer/update.php b/erp24/views/shift-transfer/update.php index 5b88b704..3a949f6c 100644 --- a/erp24/views/shift-transfer/update.php +++ b/erp24/views/shift-transfer/update.php @@ -104,6 +104,7 @@ $this->registerJs('var getMeOut = false;', \yii\web\View::POS_HEAD, 'getMeOut') [ 'name' => 'index', 'title' => '№', + 'options' => ['readonly' => true], 'value' => function () { static $counter = 1; return $counter++; diff --git a/erp24/web/js/shift-transfer/update.js b/erp24/web/js/shift-transfer/update.js index c08c274d..22719983 100644 --- a/erp24/web/js/shift-transfer/update.js +++ b/erp24/web/js/shift-transfer/update.js @@ -4,7 +4,8 @@ const param24 = $('meta[name=csrf-param]').attr('content'); const token24 = $('meta[name=csrf-token]').attr('content'); -function checkInputRow(currentIndex, row, errorContainer) { +function checkInputRow(row, errorContainer) { + const currentIndex = $(row).find('.list-cell__index').find('input').val() - 1; const productGuid = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid'); const productName = $(row).find('#select2-shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid-container').text(); //const groupLabel = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-group_label'); @@ -34,7 +35,7 @@ function checkInputs() { let noError = true; const errorContainer = []; for (let currentIndex = 0; currentIndex < rows.length; currentIndex++) { - noError = checkInputRow(currentIndex, rows[currentIndex], errorContainer) && noError; + noError = checkInputRow(rows[currentIndex], errorContainer) && noError; } if (errorContainer.length > 0) { alert(errorContainer.join('\n')); @@ -42,10 +43,9 @@ function checkInputs() { return noError; } -function setMultipleInputHandlers(currentIndex, row) { - // updateProductsWithBalance(currentIndex, row); +function setMultipleInputHandlers(row) { + const currentIndex = $(row).find('.list-cell__index').find('input').val() - 1; const store = $('#shifttransfer-store_guid'); - // const groupLabel = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-group_label'); const productGuid = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid'); const retailPrice = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-retail_price'); const selfCost = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-self_cost'); @@ -76,7 +76,8 @@ function setMultipleInputHandlers(currentIndex, row) { remains_count.on('change', onChangeTarget); } -function makeInputReadonly(currentIndex, row) { +function makeInputReadonly(row) { + const currentIndex = $(row).find('.list-cell__index').find('input').val() - 1; const productGuid = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid'); productGuid.select2({disabled: true}); const inp = $(""); @@ -90,11 +91,11 @@ $(document).ready(() => { $('.multiple-input').on('afterInit', function(){ const rows = $('.multiple-input-list__item'); for (let currentIndex = 0; currentIndex < rows.length; currentIndex++) { - setMultipleInputHandlers(currentIndex, rows[currentIndex]); - makeInputReadonly(currentIndex, rows[currentIndex]); + setMultipleInputHandlers(rows[currentIndex]); + makeInputReadonly(rows[currentIndex]); } }).on('afterAddRow', function(e, row, currentIndex) { - setMultipleInputHandlers(currentIndex, row); + setMultipleInputHandlers(row); const index = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-index'); index.val(currentIndex+1); }); -- 2.39.5