add answer, time, status helpers

This commit is contained in:
iIronside
2021-10-29 17:06:09 +03:00
parent 34c2998844
commit 7b8847e1e1
42 changed files with 2505 additions and 570 deletions

View File

@ -14,19 +14,13 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<!-- <?//= $form->field($model, 'status')->textInput() ?> -->
<?= $form->field($model, 'status')->dropDownList(
$model->statuses,
\common\helpers\StatusHelper::statusList(),
[
'prompt' => 'Выберите'
]
) ?>
<!-- <?//= $form->field($model, 'created_at')->textInput() ?> -->
<!-- <?//= $form->field($model, 'updated_at')->textInput() ?> -->
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>

View File

@ -1,7 +1,5 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireCategory */
@ -9,11 +7,8 @@ $this->title = 'Создание категории анкеты';
$this->params['breadcrumbs'][] = ['label' => 'Questionnaire Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="questionnaire-categories-create">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<div class="questionnaire-categories-create">
<?= $this->render('_form', [
'model' => $model,

View File

@ -23,25 +23,15 @@ $this->params['breadcrumbs'][] = $this->title;
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// 'id',
'title',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
'filter' => \common\helpers\StatusHelper::statusList(),
'value' => function($model) {
return \common\helpers\StatusHelper::statusLabel($model->status);
},
],
// 'created_at',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>

View File

@ -1,7 +1,5 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireCategory */
@ -12,10 +10,6 @@ $this->params['breadcrumbs'][] = 'Update';
?>
<div class="questionnaire-category-update">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<?= $this->render('_form', [
'model' => $model,
]) ?>

View File

@ -1,6 +1,7 @@
<?php
use yii\helpers\Html;
use yii\web\YiiAsset;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
@ -9,21 +10,17 @@ use yii\widgets\DetailView;
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Questionnaire Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
YiiAsset::register($this);
?>
<div class="questionnaire-categories-view">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'confirm' => 'Вы уверены, что хотите удалить этот элемент?',
'method' => 'post',
],
]) ?>
@ -37,14 +34,9 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
'filter' => \common\helpers\StatusHelper::statusList(),
'value' => function($model) {
return \common\helpers\StatusHelper::statusLabel($model->status);
},
],
'created_at',