2021-10-22 17:02:28 +03:00
|
|
|
<?php
|
|
|
|
|
2021-11-08 12:41:39 +03:00
|
|
|
use backend\modules\questionnaire\models\Question;
|
|
|
|
use common\helpers\AnswerHelper;
|
|
|
|
use common\helpers\StatusHelper;
|
2021-11-09 17:41:44 +03:00
|
|
|
use kartik\select2\Select2;
|
2021-10-22 17:02:28 +03:00
|
|
|
use yii\helpers\Html;
|
|
|
|
use yii\grid\GridView;
|
2021-11-09 17:41:44 +03:00
|
|
|
use yii\widgets\ActiveForm;
|
2021-10-22 17:02:28 +03:00
|
|
|
|
|
|
|
/* @var $this yii\web\View */
|
|
|
|
/* @var $searchModel backend\modules\questionnaire\models\AnswerSearch */
|
|
|
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
|
|
|
|
|
|
|
$this->title = 'Ответы на вопросы';
|
|
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
|
|
?>
|
|
|
|
<div class="answer-index">
|
|
|
|
|
|
|
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<?= Html::a('Создать новый ответ', ['create'], ['class' => 'btn btn-success']) ?>
|
|
|
|
</p>
|
|
|
|
|
2021-11-09 17:41:44 +03:00
|
|
|
<!-- --><?php
|
|
|
|
//
|
|
|
|
// echo Select2::widget([
|
|
|
|
// 'model' => \backend\modules\questionnaire\models\Questionnaire::findOne()->where(['id'=>1]),
|
|
|
|
// 'attribute' => 'state_2',
|
|
|
|
// 'data' => 1,
|
|
|
|
// 'options' => ['placeholder' => 'Select a state ...'],
|
|
|
|
// 'pluginOptions' => [
|
|
|
|
// 'allowClear' => true
|
|
|
|
// ],
|
|
|
|
// ]);
|
|
|
|
//
|
|
|
|
// ?>
|
|
|
|
|
2021-10-22 17:02:28 +03:00
|
|
|
<?= GridView::widget([
|
|
|
|
'dataProvider' => $dataProvider,
|
|
|
|
'filterModel' => $searchModel,
|
|
|
|
'columns' => [
|
|
|
|
['class' => 'yii\grid\SerialColumn'],
|
|
|
|
[
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => Question::find()->select(['question_body', 'id'])->where(['!=', 'question_type_id', '1'])->indexBy('id')->column(),
|
2021-10-22 17:02:28 +03:00
|
|
|
'attribute' => 'question_id',
|
2021-11-08 12:41:39 +03:00
|
|
|
'value' => 'question.question_body'
|
2021-10-22 17:02:28 +03:00
|
|
|
],
|
|
|
|
'answer_body',
|
|
|
|
[
|
|
|
|
'attribute' => 'answer_flag',
|
|
|
|
'format' => 'raw',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => AnswerHelper::answerFlagsList(),
|
2021-10-22 17:02:28 +03:00
|
|
|
'value' => function ($model) {
|
2021-11-09 17:41:44 +03:00
|
|
|
return AnswerHelper::answerFlagLabel($model->answer_flag);
|
2021-10-22 17:02:28 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'status',
|
|
|
|
'format' => 'raw',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => StatusHelper::statusList(),
|
2021-10-29 17:06:09 +03:00
|
|
|
'value' => function($model){
|
2021-11-08 12:41:39 +03:00
|
|
|
return StatusHelper::statusLabel($model->status);
|
2021-10-29 17:06:09 +03:00
|
|
|
}
|
2021-10-22 17:02:28 +03:00
|
|
|
],
|
|
|
|
['class' => 'yii\grid\ActionColumn'],
|
|
|
|
],
|
|
|
|
]); ?>
|
|
|
|
</div>
|