<?php

use common\modules\event\modelAndView\CreateEventModelAndView;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\Event */
/* @var $form yii\widgets\ActiveForm */
/* @var $modelAndView CreateEventModelAndView */

$event = $modelAndView->event;
?>

<div class="event-form">
    <div class="row">
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">

            <?php $form = ActiveForm::begin(); ?>

            <?= $form->field($event, 'startDateString')->widget(\kartik\widgets\DateTimePicker::class, [
                'pluginOptions' => [
                    'autoclose' => true,
                    'format' => 'yyyy.mm.dd hh:ii'
                ],
                'options' => [
                    'autocomplete' => 'off'
                ]
            ]);
            ?>

            <?= $form->field($event, 'endDateString')->widget(\kartik\widgets\DateTimePicker::class, [
                'pluginOptions' => [
                    'autoclose' => true,
                    'format' => 'yyyy.mm.dd hh:ii'
                ],
                'options' => [
                    'autocomplete' => 'off'
                ]
            ])
            ?>
            <?= $form->field($event, 'seat_count')->textInput() ?>

            <?= $form->field($event, 'id_room')->dropDownList(\common\models\Room::roomOptions(false, true)) ?>

            <?= $form->field($event, 'id_trainer')->dropDownList(\common\models\Trainer::trainerOptions(false, true, $modelAndView->trainers)) ?>

            <?= $form->field($event, 'id_event_type')->dropDownList(\common\models\EventType::eventTypeOptions(false, true)) ?>

            <div class="form-group">
                <?= Html::submitButton($event->isNewRecord ? Yii::t('event', 'Create') : Yii::t('event', 'Update'), ['class' => $event->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
            </div>

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

        </div>
    </div>
</div>
