From: Alexander Smirnov Date: Tue, 10 Dec 2024 10:38:06 +0000 (+0300) Subject: readonly и поменяли и спрятали колонки X-Git-Tag: 1.7~182^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=69098d9f3eb19f31d3c6826e6d4379d29360ccff;p=erp24_rep%2Fyii-erp24%2F.git readonly и поменяли и спрятали колонки --- diff --git a/erp24/views/shift-transfer/update.php b/erp24/views/shift-transfer/update.php index af154eae..5b88b704 100644 --- a/erp24/views/shift-transfer/update.php +++ b/erp24/views/shift-transfer/update.php @@ -25,6 +25,10 @@ $this->registerCss(' display: block !important; width: 40px; } + + [data-hidden] { + display: none; + } '); $this->registerJs('var getMeOut = false;', \yii\web\View::POS_HEAD, 'getMeOut'); @@ -122,21 +126,18 @@ $this->registerJs('var getMeOut = false;', \yii\web\View::POS_HEAD, 'getMeOut') 'style' => 'width: 70px;', ] ], - /*[ - 'name' => 'group_label', - 'title' => 'Название группы', - 'type' => Select2::class, - 'options' => [ - 'data' => ProductsClass::getHints(), - 'readonly' => true - ], + [ + 'name' => 'retail_price', + 'title' => 'Розничная цена, руб', + 'type' => BaseColumn::TYPE_TEXT_INPUT, + 'options' => ['type' => 'number', 'step' => 0.01, 'readonly' => true], 'value' => function($data) { - return $data['group_label'] ?? 'other_items'; + return $data['retail_price'] ?? ''; }, 'headerOptions' => [ 'style' => 'width: 70px;', ] - ], */ + ], [ 'name' => 'remains_count', 'title' => 'Фактические остатки кол-во, шт', @@ -173,40 +174,28 @@ $this->registerJs('var getMeOut = false;', \yii\web\View::POS_HEAD, 'getMeOut') 'style' => 'width: 70px;', ] ], - [ - 'name' => 'retail_price', - 'title' => 'Розничная цена, руб', - 'type' => BaseColumn::TYPE_TEXT_INPUT, - 'options' => ['type' => 'number', 'step' => 0.01, 'readonly' => true], - 'value' => function($data) { - return $data['retail_price'] ?? ''; - }, - 'headerOptions' => [ - 'style' => 'width: 70px;', - ] - ], [ 'name' => 'self_cost', - 'title' => 'Себестоимость, руб', + 'title' => '',//'Себестоимость, руб', 'type' => BaseColumn::TYPE_TEXT_INPUT, - 'options' => ['type' => 'number', 'step' => 0.01, 'readonly' => true], + 'options' => ['type' => 'number', 'step' => 0.01, 'readonly' => true, 'data-hidden' => true], 'value' => function($data) { return $data['self_cost'] ?? ''; }, 'headerOptions' => [ - 'style' => 'width: 70px;', + 'style' => 'width: 10px;', ] ], [ 'name' => 'remains_summ', - 'title' => 'Сумма остатков (недостача или излишек), руб', + 'title' => '',//'Сумма остатков (недостача или излишек), руб', 'type' => BaseColumn::TYPE_TEXT_INPUT, - 'options' => ['type' => 'number', 'step' => 0.01, 'readonly' => true], + 'options' => ['type' => 'number', 'step' => 0.01, 'readonly' => true, 'data-hidden' => true], 'value' => function($data) { return $data['remains_summ'] ?? ''; }, 'headerOptions' => [ - 'style' => 'width: 70px;', + 'style' => 'width: 10px;', ] ], ], diff --git a/erp24/web/js/shift-transfer/update.js b/erp24/web/js/shift-transfer/update.js index c1c4bea4..c08c274d 100644 --- a/erp24/web/js/shift-transfer/update.js +++ b/erp24/web/js/shift-transfer/update.js @@ -4,35 +4,6 @@ const param24 = $('meta[name=csrf-param]').attr('content'); const token24 = $('meta[name=csrf-token]').attr('content'); -// function updateProductsWithBalance(currentIndex, row) { -// const store = $('#shifttransfer-store_guid'); -// const productGuid = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid'); -// productGuid.empty(); -// $.ajax({ -// type: 'POST', -// url: '/shift-transfer/get-products-with-remains', -// data: { storeGuid: store.val(), [param24]: token24 }, -// dataType: 'json', -// success: (data) => { -// console.log(data); -// $.each(data, (key, el) => { -// console.log(key, el) -// const opt = document.createElement('option'); -// opt.text = el; -// opt.value = key; -// productGuid.append(opt); -// }) -// } -// }); -// } - -// function updateProductsWithBalanceAll() { -// const rows = $('.multiple-input-list__item'); -// for (let currentIndex = 0; currentIndex < rows.length; currentIndex++) { -// updateProductsWithBalance(currentIndex + 1, rows[currentIndex]); -// } -// } - function checkInputRow(currentIndex, row, errorContainer) { const productGuid = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid'); const productName = $(row).find('#select2-shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid-container').text(); @@ -105,12 +76,22 @@ function setMultipleInputHandlers(currentIndex, row) { remains_count.on('change', onChangeTarget); } +function makeInputReadonly(currentIndex, row) { + const productGuid = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid'); + productGuid.select2({disabled: true}); + const inp = $(""); + inp.attr('type', 'hidden'); + inp.attr('value', productGuid.val()); + inp.attr('name', 'ShiftTransfer[shiftRemainsCopy][' + currentIndex + '][product_guid]'); + productGuid.parent().append(inp); +} $(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]); } }).on('afterAddRow', function(e, row, currentIndex) { setMultipleInputHandlers(currentIndex, row);