<?php
/* @var $this ScheduleController */
/* @var $model Schedule */
/* @var $form CActiveForm */
?>

<?php
Yii::app()->clientScript->registerScript('', "$(function () {
    $('.checkall').click(function () {
        $(this).parents('').find(':checkbox').attr('checked', this.checked);
    });
});");


$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
            'id' => 'schedule-form',
            'enableAjaxValidation' => false,
        ));


$this->widget('bootstrap.widgets.TbAlert');



echo $form->textFieldRow($model, 'name', array('size' => 60, 'maxlength' => 255));

echo $form->labelEx($model, 'start_time');

$this->widget('application.extensions.timepicker.timepicker', array(
    'model' => $model,
    'name' => 'start_time',
    'select' => 'time',
    'options' => array(
        'timeFormat' => 'hh:mm',
        'showOn' => 'focus',
        'showSecond' => false,
        'changeMonth' => false,
        'changeYear' => false,
        'tabularLevel' => null,
        'regional' => 'nl',
    ),
));

echo $form->error($model, 'start_time');

echo $form->labelEx($model, 'end_time');

$this->widget('application.extensions.timepicker.timepicker', array(
    'model' => $model,
    'name' => 'end_time',
    'select' => 'time',
    'options' => array(
        'timeFormat' => 'hh:mm',
        'showOn' => 'focus',
        'showSecond' => false,
        'changeMonth' => false,
        'changeYear' => false,
        'tabularLevel' => null,
        'regional' => 'nl',
    ),
));

echo $form->error($model, 'end_time');

echo $form->labelEx($model, 'days');
?>
<label class="checkbox" >
    <?php echo CHtml::checkBox(yii::t('default', 'All Days'), false, array('class' => 'checkall')); ?><?php
    echo yii::t('default', 'All');
    ?>
</label>
<?php
    echo $form->checkBoxRow($model, 'sat');

    echo $form->checkBoxRow($model, 'sun');

    echo $form->checkBoxRow($model, 'mon');

    echo $form->checkBoxRow($model, 'tue');

    echo $form->checkBoxRow($model, 'wed');

    echo $form->checkBoxRow($model, 'thu');

    echo $form->checkBoxRow($model, 'fri');

    if ($model->isNewRecord)
    {
        $model->status = 'Active';
    }


    echo $form->radioButtonListInlineRow($model, 'status', array('Active' => Yii::t('default', 'Active'), 'Inactive' => Yii::t('default', 'Inactive')));
?>

    <div class="actions">
<?php echo CHtml::submitButton(Yii::t('default', 'Save'), array('class' => 'btn primary')); ?>
        &ensp;
    <?php echo CHtml::link(Yii::t('default', 'Cancel'), array('index'), array('class' => 'btn primary')); ?>
</div>

<?php $this->endWidget(); ?>
