display: block !important;
width: 40px;
}
+
+ [data-hidden] {
+ display: none;
+ }
');
$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' => 'Фактические остатки кол-во, шт',
'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;',
]
],
],
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();
remains_count.on('change', onChangeTarget);
}
+function makeInputReadonly(currentIndex, row) {
+ const productGuid = $(row).find('#shifttransfer-shiftremainscopy-' + currentIndex + '-product_guid');
+ productGuid.select2({disabled: true});
+ const inp = $("<input>");
+ 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);