98 lines
4.1 KiB
PHP
98 lines
4.1 KiB
PHP
|
<?php
|
|||
|
|
|||
|
use yii\helpers\Url;
|
|||
|
use yii\helpers\Html;
|
|||
|
use yii\grid\GridView;
|
|||
|
use yii\widgets\ActiveForm;
|
|||
|
use common\components\schema\models\Schema;
|
|||
|
use common\components\schema\models\search\SchemaSearch;
|
|||
|
|
|||
|
/**
|
|||
|
* @var $this yii\web\View
|
|||
|
* @var $dataProvider yii\data\ActiveDataProvider
|
|||
|
* @var $searchModel Schema
|
|||
|
*/
|
|||
|
|
|||
|
$this->title = Yii::t('schema', 'Стоп-слова');
|
|||
|
$this->params['breadcrumbs'][] = $this->title;
|
|||
|
?>
|
|||
|
|
|||
|
<div class="row">
|
|||
|
<div class="col-xs-12">
|
|||
|
<h1><?= Html::encode($this->title) ?></h1>
|
|||
|
<div class="table">
|
|||
|
<?= Html::a(Yii::t('schema', 'Добавить стоп-слово'), Url::to(['create']), ['class' => 'btn btn-outline-primary btn-sm']) ?>
|
|||
|
</div>
|
|||
|
<?php $form = ActiveForm::begin(['id' => 'schema-form', 'method' => 'get']); ?>
|
|||
|
<div class="row">
|
|||
|
<div class="col-xs-12 col-md-4 col-lg-3">
|
|||
|
<?= $form->field($searchModel, 'name')->textInput() ?>
|
|||
|
</div>
|
|||
|
<div class="col-xs-12 col-md-4 col-lg-3">
|
|||
|
<?= $form->field($searchModel, 'type')->dropDownList(schema::getTypeList(), ['prompt' => Yii::t('schema', 'Все')]) ?>
|
|||
|
</div>
|
|||
|
<div class="col-xs-12 col-md-4 col-lg-3">
|
|||
|
<?= $form->field($searchModel, 'created_at')->widget(DatePicker::class, [
|
|||
|
'language' => 'ru',
|
|||
|
'containerOptions' => ['class' => 'form-group'],
|
|||
|
'options' => ['class' => 'form-control'],
|
|||
|
'dateFormat' => 'php:d.m.Y',
|
|||
|
])->label() ?>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<br/>
|
|||
|
<div class="row">
|
|||
|
<div class="col-xs-12 col-md-6 col-lg-4">
|
|||
|
<?= Html::submitButton(Yii::t('schema', 'Фильтр'), ['class' => 'btn btn-sm btn-success']) ?>
|
|||
|
<?= Html::a(Yii::t('schema', 'Отчистить фильтр'), Url::to(['/bad-word']), ['class' => 'btn btn-outline-dark btn-sm']) ?>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<?php ActiveForm::end(); ?>
|
|||
|
<br/>
|
|||
|
<div class="table-responsive">
|
|||
|
<?= GridView::widget([
|
|||
|
'tableOptions' => ['class' => 'table table-striped table-bordered'],
|
|||
|
'dataProvider' => $dataProvider,
|
|||
|
'pager' => [
|
|||
|
'firstPageLabel' => Yii::t('schema', 'В начало'),
|
|||
|
'lastPageLabel' => Yii::t('schema', 'В конец'),
|
|||
|
],
|
|||
|
'columns' => [
|
|||
|
['class' => yii\grid\SerialColumn::class],
|
|||
|
'name',
|
|||
|
[
|
|||
|
'attribute' => 'type',
|
|||
|
'value' => function ($model) {
|
|||
|
return schema::getTypeList($model->type);
|
|||
|
},
|
|||
|
],
|
|||
|
'created_at:date',
|
|||
|
[
|
|||
|
'class' => yii\grid\ActionColumn::class,
|
|||
|
'template' => '{update}',
|
|||
|
'buttons' => [
|
|||
|
'update' => function ($url, $model, $key) {
|
|||
|
return Html::a(Yii::t('schema', '<span class="fa" aria-hidden="true">{icon}</span>', [
|
|||
|
'icon' => HtmlHelper::ICON_UPDATE,
|
|||
|
]), $url);
|
|||
|
},
|
|||
|
],
|
|||
|
],
|
|||
|
[
|
|||
|
// todo ajax refactor
|
|||
|
'class' => yii\grid\ActionColumn::class,
|
|||
|
'template' => '{delete}',
|
|||
|
'buttons' => [
|
|||
|
'delete' => function ($url, $model, $key) {
|
|||
|
return Html::a(Yii::t('schema', '<span class="fa" aria-hidden="true">{icon}</span>', [
|
|||
|
'icon' => HtmlHelper::ICON_DELETE,
|
|||
|
]), $url, ['id' => "delete-bad-word-$model->id"]);
|
|||
|
},
|
|||
|
],
|
|||
|
],
|
|||
|
],
|
|||
|
]) ?>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|