changing foreign key in user_response from id to uuid, completed add greedy loading, some refactoring
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\questionnaire\models\Question;
|
||||
use backend\modules\questionnaire\models\UserQuestionnaire;
|
||||
use common\helpers\AnswerHelper;
|
||||
use common\models\User;
|
||||
use kartik\select2\Select2;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
@ -15,47 +16,36 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'answer_flag')->dropDownList(
|
||||
<?= $form->field($model, 'user_id')->widget(Select2::className(),
|
||||
[
|
||||
'' => 'Не задано',
|
||||
'0.1' => '10%',
|
||||
'0.2' => '20%',
|
||||
'0.3' => '30%',
|
||||
'0.5' => '50%',
|
||||
'0.7' => '70%',
|
||||
'0.8' => '80%',
|
||||
'0.85' => '85%',
|
||||
'0.9' => '90%',
|
||||
'1' => '100%',
|
||||
'data' => User::find()->select(['username', 'id'])->indexBy('id')->column(),
|
||||
'options' => ['placeholder' => 'Выберите пользователя','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'placeholder' => 'Выберите',
|
||||
'allowClear' => true
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<?= $form->field($model, 'question_id')->widget(Select2::className(),
|
||||
[
|
||||
'data' => Question::find()->select(['question_body', 'id'])->indexBy('id')->column(),
|
||||
'options' => ['placeholder' => 'Выберите пользователя','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'placeholder' => 'Выберите',
|
||||
'allowClear' => true
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<?= $form->field($model, 'response_body')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'answer_flag')->dropDownList(
|
||||
AnswerHelper::answerFlagsList(),
|
||||
[
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $form->field($model, 'user_id')->widget(Select2::class, [
|
||||
'data' => \common\models\User::find()->select(['username','id'] )->indexBy('id')->column(),
|
||||
'options' => ['placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'question_id')->widget(Select2::class,[
|
||||
|
||||
'data' => Question::find()->select(['question_body', 'id'])->indexBy('id')->column(),
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true // 'id != :id', ['id'=>1]
|
||||
],
|
||||
])?>
|
||||
|
||||
<?= $form->field($model, 'user_questionnaire_id')->widget(Select2::class,[
|
||||
'data' => UserQuestionnaire::find()->select(['id', 'id'])->indexBy('id')->column(),
|
||||
'options' => ['placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
])?>
|
||||
|
||||
<?= $form->field($model, 'response_body')->textInput(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, 'user_questionnaire_uuid')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
|
||||
|
Reference in New Issue
Block a user