title = 'Проверка прайсов';
$this->params['breadcrumbs'][] = $this->title;
// зарегистрируем скрипт для обработки загрузки модального окна
ParserAsset::register($this);
Pjax::begin(['id' => 'gridViewContent']);
?>
= Html::encode($this->title) ?>
= GridView::widget(['dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => SerialColumn::className()],
['content' => function ($model) {
$url = Url::to(['view', 'id' => $model->id, 'date_update' => $model->price_date_update]);
return Html::a('
', '#', [
'class' => 'modalViewButton',
'value' => $url,
]);
},
],
[
'label' => 'Поставщик',
'attribute' => 'id',
'value' => function ($data) {
return '№ ' . $data->id . ' ' . $data->name;
},
],
['label' => 'Дата обновления',
'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',
]),
],
['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;
}
],
['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('
', $url, [
'title' => Yii::t('yii', 'Удалить прайс'),
'data-confirm' => 'Вы уверены что хотите удалить этот прайс?',
'data-method' => 'post',
'data-pjax' => '0',
]);
},
],
],
]
]); ?>
'
Прайс
',
'id' => 'modal',
'size' => 'modal-lg',
]);
echo "
";
Modal::end();
// Pjax::end();
?>