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

<div class="booking-form">
    <?php $form = ActiveForm::begin([
        'id' => 'booking-form',
        'enableAjaxValidation' => true,
    ]); ?>

    <div class="row">
        <div class="col-md-6">
            <?= $form->field($model, 'customer_name')->textInput(['maxlength' => true, 'placeholder' => 'Enter customer name']) ?>

            <?= $form->field($model, 'customer_email')->input('email', ['maxlength' => true, 'placeholder' => 'Enter email address']) ?>

            <?= $form->field($model, 'customer_phone')->textInput(['maxlength' => true, 'placeholder' => 'Enter phone number']) ?>

            <?= $form->field($model, 'sport_id')->dropDownList([], [
                'prompt' => 'Select sport...',
                'class' => 'form-control',
                'id' => 'booking-sport_id'
            ]) ?>

            <?= $form->field($model, 'instructor_id')->dropDownList(
                ArrayHelper::map(Instructor::find()->where(['status' => 'active'])->all(), 'id', 'name'),
                ['prompt' => 'Select instructor...', 'class' => 'form-control', 'id' => 'booking-instructor_id']
            ) ?>
        </div>
        
        <div class="col-md-6">
            <?= $form->field($model, 'lesson_date')->input('date', ['class' => 'form-control']) ?>

            <?= $form->field($model, 'start_time')->dropDownList([], [
                'prompt' => 'Select time...',
                'id' => 'booking-start_time'
            ]) ?>

            <?= $form->field($model, 'duration_minutes')->dropDownList([
                '30' => '30 minutes',
                '60' => '1 hour',
                '90' => '1.5 hours',
                '120' => '2 hours'
            ], ['prompt' => 'Select duration...', 'class' => 'form-control']) ?>

            <?= $form->field($model, 'participants')->input('number', [
                'min' => 1,
                'max' => 10,
                'class' => 'form-control',
                'placeholder' => 'Number of participants'
            ]) ?>
        </div>
    </div>

    <div class="form-group mt-3">
        <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>
</div>
