<?php
    
    use artbox\core\admin\assets\Switchery;
    use yii\helpers\Html;
    use yii\web\View;
    use yii\widgets\ActiveForm;
    
    /* @var $this yii\web\View */
    /* @var $model \common\models\Question */
    /* @var $form yii\widgets\ActiveForm */
    /* @var $doctors \common\models\Doctor[]*/
    Switchery::register($this);
    $js = <<< JS
$('.switchery').each(function(idx, elem) {
  new Switchery(elem, {
    color:'#46b749',
    secondaryColor:'#e2e2e2'
  });
});

$(".select_service").select2();
$(".select_doctors").select2();
JS;
    
    
    $this->registerJs($js, View::POS_READY);
?>

<div class="feedback-form">
    
    <?php $form = ActiveForm::begin(); ?>
    <?=$form->field($model, 'service_id')->dropDownList($services, [
        'class' => 'select_service'
    ])?>
    <?=$form->field($model, 'doctor_id')->dropDownList($doctors, [
        'class' => 'select_doctors'
    ])?>
    <?= $form->field($model, 'name')
             ->textInput([ 'maxlength' => true ]) ?>
    
    <?= $form->field($model, 'email')
             ->textInput([ 'maxlength' => true ]) ?>
    
    <?= $form->field($model, 'question')
             ->textarea([ 'rows' => 6 ]) ?>
  
    <?= $form->field($model, 'answer')
             ->textarea([ 'rows' => 6 ]) ?>
  
    <?= $form->field($model, 'status')
             ->checkbox(
                 [
                     'class' => 'switchery',
                 ]
             ) ?>
    
    <div class="form-group">
        <?= Html::submitButton(
            $model->isNewRecord ? Yii::t('core', 'Create') : Yii::t('core', 'Update'),
            [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
        ) ?>
    </div>
    
    <?php ActiveForm::end(); ?>

</div>
