2fb5a757
Mihail
add menu and chec...
|
1
2
3
4
|
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\SerialColumn;
|
1c9309e1
Mihail
add view for deta...
|
5
6
|
use yii\grid\ActionColumn;
use yii\widgets\Pjax;
|
2fb5a757
Mihail
add menu and chec...
|
7
8
9
10
11
12
|
/* @var $this yii\web\View */
/* @var $searchModel backend\models\CatalogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
|
dd6fce49
Mihail
add migration for...
|
13
|
$this->title = 'Проверка прайсов';
|
2fb5a757
Mihail
add menu and chec...
|
14
15
16
17
18
19
|
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="catalog-index">
<h1><?= Html::encode($this->title) ?></h1>
|
1c9309e1
Mihail
add view for deta...
|
20
|
|
2fb5a757
Mihail
add menu and chec...
|
21
22
|
<?= GridView::widget( ['dataProvider' => $dataProvider,
'columns' => [['class' => SerialColumn::className()],
|
3b7211a0
Mihail
change query for ...
|
23
|
[
|
1c9309e1
Mihail
add view for deta...
|
24
25
26
27
28
29
30
|
'class' => ActionColumn::className(),
'template'=>'{view}',
'contentOptions' => function ($model, $key, $index, $column){
return ['data' => ['id' => $model->id, 'date' => $model->price_date_update]];
}
],
[
|
3b7211a0
Mihail
change query for ...
|
31
32
|
'label' =>'Поставщик',
'value' => function ($data) {
|
387be185
Mihail
add all needs col...
|
33
|
return '№ ' .$data->id . ' ' . $data->name;
|
3b7211a0
Mihail
change query for ...
|
34
35
36
|
},
],
['label' =>'Дата обновления',
|
387be185
Mihail
add all needs col...
|
37
38
39
40
41
42
43
44
45
|
'attribute' => 'price_date_update' ],
['label' => 'Кол-во дней',
'value' => function ($data) {
$date1 = new DateTime("now");
$date2 = new DateTime( $data->price_date_update );
$quo_days = $date2->diff($date1)->format('%R%a');
// уберем первый символ - там знак "+"
$quo_days = substr( $quo_days, 1, strlen($quo_days) );
$quo_days = (int) $quo_days;
|
1c9309e1
Mihail
add view for deta...
|
46
|
|
387be185
Mihail
add all needs col...
|
47
48
49
50
51
|
if($quo_days > 15)
$quo_days = '>15';
return $quo_days;
}
|
1c9309e1
Mihail
add view for deta...
|
52
|
],
|
387be185
Mihail
add all needs col...
|
53
|
]] );?>
|
2fb5a757
Mihail
add menu and chec...
|
54
|
|
1c9309e1
Mihail
add view for deta...
|
55
56
57
|
|
2fb5a757
Mihail
add menu and chec...
|
58
|
</div>
|