<?php
+use yii_app\records\Admin;
use yii_app\records\MarketplacePricesLog;
use yii\helpers\Html;
use yii\helpers\Url;
['class' => 'yii\grid\SerialColumn'],
'id',
- 'marketplace_prices_id',
- 'action',
- 'price_before',
- 'price_after',
- 'old_price_before',
- 'old_price_after',
+
+ [
+ 'attribute' => 'marketplace_prices_id',
+ 'label' => 'Товар',
+ 'format' => 'raw',
+ 'value' => function ($model) {
+ $mpPrice = \yii_app\records\MarketplacePrices::find()
+ ->where(['id' => $model->marketplace_prices_id])->one();
+
+ return \yii_app\records\MatrixErp::find()->select('articule')
+ ->where(['id' => $mpPrice->matrix_erp_id])->scalar();
+ },
+ ],
+ [
+ 'attribute' => 'action',
+ 'label' => 'Действие',
+ 'value' => function ($model) {
+ return $model->action == 1 ? 'Создание' : 'Изменение';
+ },
+ ],
+ [
+ 'attribute' => 'price_before',
+ 'label' => 'Цена до',
+ ],
+ [
+ 'attribute' => 'price_after',
+ 'label' => 'Цена после',
+ ],
+ [
+ 'attribute' => 'old_price_before',
+ 'label' => 'Старая Цена до',
+ ],
+ [
+ 'attribute' => 'old_price_after',
+ 'label' => 'Старая Цена после',
+ ],
'changed_at',
- 'changed_by',
+ [
+ 'attribute' => 'changed_by',
+ 'label' => 'Кем изменено',
+ 'format' => 'raw',
+ 'value' => function ($model) {
+ return Admin::find()->select('name')->where(['id' => $model->changed_by])->scalar();
+ },
+ ],
],
]); ?>
<?= $form->field($model, 'old_price')->textInput() ?>
- <?= $form->field($model, 'created_at')->textInput() ?>
-
- <?= $form->field($model, 'updated_at')->textInput() ?>
-
<div class="form-group">
- <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
+ <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
['class' => 'yii\grid\SerialColumn'],
'id',
- 'matrix_erp_id',
- 'marketplace_id',
+ [
+ 'attribute' => 'matrix_erp_id',
+ 'label' => 'Артикул товара',
+ 'format' => 'raw',
+ 'value' => function ($model) {
+ $matrixProduct = \yii_app\records\MatrixErp::find()
+ ->where(['id' => $model->matrix_erp_id])->one();
+ return Html::a($matrixProduct->articule, '/matrix-erp/update?id=' . $model->matrix_erp_id);
+
+ },
+ ],
+ [
+ 'attribute' => 'matrix_erp_id',
+ 'label' => 'Наименование товара',
+ 'format' => 'raw',
+ 'value' => function ($model) {
+ $matrixProduct = \yii_app\records\MatrixErp::find()
+ ->where(['id' => $model->matrix_erp_id])->one();
+ return Html::a($matrixProduct->name, '/matrix-erp/update?id=' . $model->matrix_erp_id);
+
+ },
+ ],
+ [
+ 'attribute' => 'marketplace_id',
+ 'label' => 'Маркетплейс',
+ 'value' => function ($model) {
+ return $model->marketplace_id == 1 ? 'ЯндексМаркет' : 'Flowwow';
+ },
+ ],
'marketplace_alias',
'price',
'old_price',