<?php
    
    use yii\helpers\Html;
    use yii\widgets\ActiveForm;
    
    /* @var $this yii\web\View */
    /* @var $model \common\models\Visit */
    /* @var $form yii\widgets\ActiveForm */
?>

<div class="feedback-form">
    
    <?php $form = ActiveForm::begin(); ?>
    
  
    
    <?= $form->field($model, 'phone')
             ->textInput([ 'maxlength' => true ]) ?>
    <?php
        switch ($model->time){
            case 1:
                echo "<p>В течение 30 минут</p>";
                break;
            case 2:
                echo "<p>C 9.00 до 12.00</p>";
                break;
            case 3:
                echo "<p>C 12.00 до 18.00</p>";
                break;
        }
    ?>
    
    <?= $form->field($model, 'status')
             ->checkbox(
                 [
                     'class' => 'flat',
                 ]
             ) ?>
    <?php
      if (!empty($model->entity)){
        $entity =  call_user_func(array($model->entity, 'find'))->where(['id' => $model->entity_id])->one();
        echo ("<p>".$entity->title."</p>");
      }
    ?>
    <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>
