use yii\helpers\Html;
use yii\widgets\DetailView;
+use yii_app\records\MarketplaceOrderItems;
use yii_app\records\MarketplaceOrders;
use yii_app\records\WriteOffsErp;
return $model->status1c->status ?? null;
}
],
+ [
+ 'label' => 'Товары',
+ 'format' => 'raw',
+ 'value' => function ($model) {
+ $items = MarketplaceOrderItems::findAll(['order_id' => $model->id]);
+
+ $header = Html::tag('tr',
+ Html::tag('th', 'Артикул')
+ . Html::tag('th', 'Название')
+ . Html::tag('th', 'Цена')
+ . Html::tag('th', 'Действие')
+ );
+
+ $rows = '';
+ foreach ($items as $item) {
+ $checkUrl = ['marketplace-orders/check-item', 'id' => $item->id];
+ $button = Html::a('Проверить', $checkUrl, [
+ 'class' => 'btn btn-sm btn-primary',
+ 'data-method' => 'post',
+ 'data-pjax' => '0',
+ ]);
+
+ $rows .= Html::tag('tr',
+ Html::tag('td', Html::encode($item->offer_id))
+ . Html::tag('td', Html::encode($item->offer_name))
+ . Html::tag('td', Html::encode(Yii::$app->formatter->asDecimal($item->price, 2)))
+ . Html::tag('td', $button)
+ );
+ }
+
+ return Html::tag('table', $header . $rows, ['class' => 'table table-bordered']);
+ },
+ ],
],
]) ?>