public function buildLoadDataShiftRemains($groups, $storeGuid) {
$productsClass = ProductsClass::find()->select(['category_id'])->where(['tip' => $groups])->column();
- $products = ArrayHelper::map(Products1c::find()->select(['id', 'name'])
- ->where(['parent_id' => $productsClass])->orderBy(['name' => SORT_ASC, 'parent_id' => SORT_DESC])->all(), 'id', 'name');
+ $products = ArrayHelper::map(Products1c::find()->alias('p')->select(['id', 'name'])->leftJoin('products_class pc', 'pc.category_id = p.parent_id')
+ ->where(['parent_id' => $productsClass])->orderBy(['(CASE WHEN pc.tip = \'other_items\' THEN 1 ELSE 0 END)' => SORT_DESC
+ ,'name' => SORT_ASC])->all(), 'id', 'name');
$balance = ArrayHelper::map(Balances::find()->select(['quantity', 'product_id'])
->where(['store_id' => $storeGuid])->all(), 'product_id', 'quantity');
$productGuids = [];
return $products[$data['product_guid']] ?? '';
},
],
- [
- 'attribute' => 'group_label',
- 'label' => 'Название группы',
- 'value' => function($data) {
- return ProductsClass::getHints()[$data['group_label']] ?? '';
- },
- ],
+// [
+// 'attribute' => 'group_label',
+// 'label' => 'Название группы',
+// 'value' => function($data) {
+// return ProductsClass::getHints()[$data['group_label']] ?? '';
+// },
+// ],
[
'attribute' => 'retail_price',
'label' => 'Розничная цена, руб',
<?php $hints2 = [ProductsClass::HINT_OTHER_ITEMS => 'Номенклатура 1%'] ?>
<?= $form->field($shiftTransfer, 'groups2')->checkboxList($hints2, ['checked' => 1, 'onclick' => '$("#acceptDiv").removeClass("d-none");']) ?>
</div>
- <details>
+ <details <?= !empty($shiftTransfer->groups2) ? 'open' : '' ?> >
<summary>Другие</summary>
<div class="col-9">
<?php $hints1 = ProductsClass::getHints(); unset($hints1['other_items']); ?>
<div class="col-12">
<?= $form->field($shiftTransfer, 'shiftRemainsCopy')->widget(MultipleInput::class, [
'min' => 0,
- 'max' => 100,
+ 'max' => 2000,
'columns' => [
[
'name' => 'product_guid',
'type' => Select2::class,
'options' => [
'data' => $productGuids,
-// ArrayHelper::map(Products1c::find()->select(['id', 'name'])
-// ->where(['tip' => 'products'])->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'),
],
'value' => function($data) {
return $data['product_guid'] ?? '';