if ($model->validate()) {
$model->save();
- $model->update([
- 'number' => 'ЕРП_ПС_' . date("Y-m-d_H-i") . $model->id,
- ]);
+ $model->updateAttributes(['number' => 'ЕРП_ПС_' . date("Y-m-d_H-i") . $model->id]);
ReplacementInvoiceProducts::setData($model, $shiftTransfer);
} else {
var_dump($model->getErrors());
use yii\helpers\Html;
use yii\grid\GridView;
+use yii_app\records\CityStore;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
-
- 'id',
- 'guid',
- 'store_id',
+ [
+ 'attribute' => 'guid',
+ 'value' => function ($model) {
+ return \yii\helpers\Html::a($model->guid, ['view', 'id' => $model->id]);
+ },
+ 'format' => 'raw',
+ ],
+ [
+ 'attribute' => 'store_id',
+ 'value' => function ($model) {
+ return CityStore::findOne(\yii_app\records\ExportImportTable::findOne(['export_val' => $model->store_guid])->entity_id)->name;
+ }
+ ],
'number',
'date',
- 'status',
- 'active',
'created_at',
+ [
+ 'attribute' => 'created_admin_id',
+ 'value' => function ($model) {
+ return $model->createdAdmin->name_full;
+ }
+ ],
+
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view}', // кнопка просмотра
[
'attribute' => 'store_id',
'value' => function ($model) {
- // Для отображения магазина с учетом связанной таблицы
return CityStore::findOne(\yii_app\records\ExportImportTable::findOne(['export_val' => $model->store_id])->entity_id)->name;
}
],
[
'attribute' => 'shift_id',
'value' => function ($model) {
- // Если требуется вывести ссылку на смену
return Html::a("Передача смены #$model->shift_id", ['shift-transfer/view', 'id' => $model->shift_id]);
},
- 'format' => 'raw', // Позволяет выводить HTML, то есть ссылку
+ 'format' => 'raw',
],
'date',
'amount',