guild/backend/modules/questionnaire/views/answer/_form.php

52 lines
1.3 KiB
PHP
Raw Normal View History

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-10-22 17:02:28 +03:00
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Answer */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="answer-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'question_id')->widget(Select2::class, [
2021-11-08 12:41:39 +03:00
'data' => Question::find()->select(['question_body', 'id'])
->where(['!=', 'question_type_id', '1'])
->indexBy('id')
->column(),
2021-10-22 17:02:28 +03:00
'pluginOptions' => [
2021-11-08 12:41:39 +03:00
'allowClear' => false
2021-10-22 17:02:28 +03:00
],
]) ?>
<?= $form->field($model, 'answer_body')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'answer_flag')->dropDownList(
2021-11-08 12:41:39 +03:00
AnswerHelper::answerFlagsList(),
2021-10-22 17:02:28 +03:00
[
'prompt' => 'Выберите'
]
) ?>
<?= $form->field($model, 'status')->dropDownList(
2021-11-08 12:41:39 +03:00
StatusHelper::statusList(),
2021-10-22 17:02:28 +03:00
[
'prompt' => 'Выберите'
]
) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>