Files
SmartHomePHP/modules/admin/views/trigger/index.php
Alex Solomaha aa61a21537 Refactor; Fixes
2017-01-02 18:59:45 +02:00

65 lines
1.9 KiB
PHP

<?php
/* @var $this yii\web\View */
/* @var $searchModel app\modules\admin\models\TriggerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
use app\models\Trigger;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
$this->title = 'Триггеры';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="trigger-index">
<p>
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Обновить на сервере', [
'/api/panel/schedule-triggers',
'access-token' => Yii::$app->user->identity->api_key
], [
'class' => 'btn btn-default ajax-call',
]) ?>
</p>
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'summaryOptions' => ['class' => 'alert alert-info'],
'layout' => '{summary}<div class="table-responsive">{items}</div>{pager}',
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'id',
'contentOptions' => ['style' => 'width: 5%']
],
'name',
[
'filter' => Trigger::getTypes(),
'attribute' => 'type',
'value' => function (Trigger $model) {
return $model->getTypeLabel();
},
],
[
'filter' => [
0 => 'Нет',
1 => 'Да',
],
'format' => 'boolean',
'attribute' => 'active',
],
// 'trig_date',
// 'trig_time',
// 'trig_time_wdays',
// 'trig_item_id',
// 'trig_item_value',
['class' => 'app\components\ActionButtonColumn'],
],
]); ?>
<?php Pjax::end(); ?>
</div>