add filters, refactoring

This commit is contained in:
iIronside
2021-11-08 12:41:39 +03:00
parent 5be69526ac
commit c1c24fc5e4
42 changed files with 12364 additions and 443 deletions

View File

@ -1,5 +1,8 @@
<?php
use backend\modules\questionnaire\models\Question;
use common\helpers\AnswerHelper;
use common\helpers\StatusHelper;
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
@ -14,23 +17,26 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'question_id')->widget(Select2::class, [
'data' => \yii\helpers\ArrayHelper::map(\common\models\Question::find()->where(['!=', 'question_type_id', '1'])->all(), 'id', 'question_body'),
'data' => Question::find()->select(['question_body', 'id'])
->where(['!=', 'question_type_id', '1'])
->indexBy('id')
->column(),
'pluginOptions' => [
'allowClear' => true
'allowClear' => false
],
]) ?>
<?= $form->field($model, 'answer_body')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'answer_flag')->dropDownList(
\common\helpers\AnswerHelper::answerFlagsList(),
AnswerHelper::answerFlagsList(),
[
'prompt' => 'Выберите'
]
) ?>
<?= $form->field($model, 'status')->dropDownList(
\common\helpers\StatusHelper::statusList(),
StatusHelper::statusList(),
[
'prompt' => 'Выберите'
]