1fa22312
Mihail
add auto upload a...
|
1
2
3
4
|
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\SerialColumn;
|
1fa22312
Mihail
add auto upload a...
|
5
|
use yii\widgets\Pjax;
|
0cf90b50
Mihail
add modal form by...
|
6
7
|
use yii\bootstrap\Modal;
use yii\helpers\Url;
|
0ade45a9
Mihail
add ajax handler ...
|
8
|
use backend\assets\ParserAsset;
|
1fa22312
Mihail
add auto upload a...
|
9
10
11
12
13
14
15
16
|
/* @var $this yii\web\View */
/* @var $searchModel backend\models\CatalogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Проверка прайсов';
$this->params['breadcrumbs'][] = $this->title;
|
0cf90b50
Mihail
add modal form by...
|
17
|
// зарегистрируем скрипт для обработки загрузки модального окна
|
0ade45a9
Mihail
add ajax handler ...
|
18
|
ParserAsset::register($this);
|
a3a9066a
Mihail
add modal form fo...
|
19
|
Pjax::begin(['id' => 'gridViewContent']);
|
1fa22312
Mihail
add auto upload a...
|
20
21
22
23
24
25
|
?>
<div class="catalog-index">
<h1><?= Html::encode($this->title) ?></h1>
|
0cf90b50
Mihail
add modal form by...
|
26
|
<?= GridView::widget(['dataProvider' => $dataProvider,
|
edfa67b1
Mihail
add delete price ...
|
27
|
'filterModel' => $searchModel,
|
0cf90b50
Mihail
add modal form by...
|
28
29
30
31
32
|
'columns' => [
['class' => SerialColumn::className()],
['content' => function ($model) {
$url = Url::to(['view', 'id' => $model->id, 'date_update' => $model->price_date_update]);
|
edfa67b1
Mihail
add delete price ...
|
33
|
return Html::a('<span class="glyphicon glyphicon-eye-open"> </span>', '#', [
|
6ccb6e69
Mihail
add delete price ...
|
34
|
'class' => 'modalViewButton',
|
0cf90b50
Mihail
add modal form by...
|
35
36
37
|
'value' => $url,
]);
},
|
1fa22312
Mihail
add auto upload a...
|
38
|
],
|
0cf90b50
Mihail
add modal form by...
|
39
|
|
1fa22312
Mihail
add auto upload a...
|
40
|
[
|
0cf90b50
Mihail
add modal form by...
|
41
|
'label' => 'Поставщик',
|
1fa22312
Mihail
add auto upload a...
|
42
|
'value' => function ($data) {
|
0cf90b50
Mihail
add modal form by...
|
43
|
return '№ ' . $data->id . ' ' . $data->name;
|
1fa22312
Mihail
add auto upload a...
|
44
45
|
},
],
|
1fa22312
Mihail
add auto upload a...
|
46
|
|
0cf90b50
Mihail
add modal form by...
|
47
|
['label' => 'Дата обновления',
|
edfa67b1
Mihail
add delete price ...
|
48
49
50
51
52
53
54
55
56
57
58
|
'attribute' => 'price_date_update',
'filter' => \kartik\date\DatePicker::widget([
'model' =>$searchModel,
'language' =>'ru',
'size' =>'xs',
'separator' =>'по',
'attribute' => 'price_date_update',
'type' => \kartik\date\DatePicker::TYPE_RANGE,
'attribute2' => 'date_to',
]),
],
|
0cf90b50
Mihail
add modal form by...
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
['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;
if ($quo_days > 15)
$quo_days = '>15';
return $quo_days;
}
],
|
6ccb6e69
Mihail
add delete price ...
|
75
76
77
78
79
80
81
82
83
84
85
86
87
|
['class' => \yii\grid\ActionColumn::className(),
'template'=>'{delete}',
'buttons' => [
'delete' => function ($url, $model, $key) {
$url = Url::to(['delete', 'id' => $model->id, 'update_date' => $model->price_date_update]);
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
'title' => Yii::t('yii', 'Удалить прайс'),
'data-confirm' => 'Вы уверены что хотите удалить этот прайс?',
'data-method' => 'post',
'data-pjax' => '0',
]);
},
],
|
edfa67b1
Mihail
add delete price ...
|
88
|
],
|
0cf90b50
Mihail
add modal form by...
|
89
90
91
92
93
94
95
96
97
98
99
|
]
]); ?>
<?php
// сюда будем всавлять контент модального окна
Modal::begin([
// 'header'=>'<h4>Прайс</h4>',
'id' => 'modal',
'size' => 'modal-lg',
]);
|
a3a9066a
Mihail
add modal form fo...
|
100
|
echo "<div class='modalContent'></div>";
|
0cf90b50
Mihail
add modal form by...
|
101
|
Modal::end();
|
c6395629
Mihail
add crud models f...
|
102
|
// Pjax::end();
|
0cf90b50
Mihail
add modal form by...
|
103
|
?>
|
1fa22312
Mihail
add auto upload a...
|
104
105
106
|
</div>
|