use yii\helpers\ArrayHelper;
use yii_app\records\Products1c;
use yii_app\records\ProductsClass;
+use yii_app\records\ShiftTransfer;
-?>
-<?= \kartik\grid\GridView::widget([
+/* @var $shiftTransfer ShiftTransfer */
+
+echo \kartik\grid\GridView::widget([
'dataProvider' => new \yii\data\ArrayDataProvider([
'allModels' => $shiftTransfer->shiftRemains
]),
// 'showFooter' => true,
'columns' => [
- [
- 'attribute' => 'group_label',
- 'label' => 'Название группы',
-// 'footer' => 'Итого:',
- 'pageSummary' => 'Итого:',
- 'value' => function($data) {
- return ProductsClass::getHints()[$data['group_label']] ?? '';
- },
- ],
[
'attribute' => 'product_guid',
'label' => 'Продукт',
+ 'pageSummary' => 'Итого:',
'value' => function($data) {
- $productsClass = ProductsClass::find()->select('category_id')
- ->where(['tip' => $data['group_label'] ?? null])->column();
-
$products = ArrayHelper::map(Products1c::find()->select(['id', 'name'])
- ->where(['parent_id' => $productsClass])->all(), 'id', 'name');
+ ->where(['id' => $data['product_guid']])->all(), 'id', 'name');
return $products[$data['product_guid']] ?? '';
},
],
+ [
+ 'attribute' => 'group_label',
+ 'label' => 'Название группы',
+ 'value' => function($data) {
+ return ProductsClass::getHints()[$data['group_label']] ?? '';
+ },
+ ],
[
'attribute' => 'retail_price',
'label' => 'Розничная цена, руб',