change time widget in question and questionnaire forms

This commit is contained in:
iIronside
2021-11-02 17:29:15 +03:00
parent 7b8847e1e1
commit f8bacb7b58
23 changed files with 5795 additions and 117 deletions

View File

@ -1,6 +1,7 @@
<?php
use kartik\select2\Select2;
use kartik\time\TimePicker;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
@ -32,21 +33,19 @@ use yii\widgets\ActiveForm;
]
) ?>
<?= $form->field($model, 'time_limit')->dropDownList(
<?= $form->field($model, 'time_limit')->widget(TimePicker::class,
[
'' => 'Не ограничено',
'600' => '10 минут',
'900' => '15 минут',
'1200' => '20 минут',
'1800' => '30 минут',
'2700' => '45 минут',
'3600' => '1 час',
]
)
?>
'name' => 'time_limit_picker',
'pluginOptions' => [
'showSeconds' => false,
'showMeridian' => false,
'minuteStep' => 1,
'defaultTime' => ''
]
]) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
<?= Html::submitButton('Создать', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>

View File

@ -34,12 +34,14 @@ $this->params['breadcrumbs'][] = $this->title;
],
[
'attribute' => 'category_id',
'filter' => \yii\helpers\ArrayHelper::map(common\models\QuestionnaireCategory::find()->all(), 'id', 'title'),
'value' => function($model){
return $model->getCategoryTitle();
}
],
[
'attribute' => 'time_limit',
'format' => 'raw',
'value' => function($model){
return \common\helpers\TimeHelper::limitTime($model->time_limit);
}

View File

@ -50,10 +50,11 @@ $this->params['breadcrumbs'][] = $this->title;
'updated_at',
[
'attribute' => 'time_limit',
'format' => 'raw',
'value' => function($model){
return \common\helpers\TimeHelper::limitTime($model->time_limit);
}
]
],
],
]) ?>
@ -70,7 +71,13 @@ $this->params['breadcrumbs'][] = $this->title;
'filterModel' => $questionSearchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'question_type_id',
[
'attribute' => 'question_type_id',
'filter' => \yii\helpers\ArrayHelper::map(\backend\modules\questionnaire\models\QuestionType::find()->all(), 'id', 'question_type'),
'value' => function($model){
return $model->getQuestionTitle();
}
],
'question_body',
[
'attribute' => 'status',