<?php
/* @var $model Locations */

$form = $this->beginWidget('CActiveForm', array(
    'id' => 'Locations-form',
    'enableAjaxValidation' => false,
    'enableClientValidation' => false,
));
?>

<div class="tab-content">
    <div class="tab-pane active">
        <ul class="clearfix form-ul material">

            <li class="col-sm-12">
                <input type="hidden" name="from" id="from" value="<?php echo $from; ?>">
                <?php echo $form->hiddenField($model, 'id'); ?>

                <?php echo $form->textField(
                    $model,
                    'location_name',
                    array(
                        'data-label' => 'Location Name'
                    )
                ); ?>

                <?php echo $form->error($model, 'location_name'); ?>
            </li>

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

<div class="modal-footer">

    <button type="button" class="btn btn-default" data-dismiss="modal">
        Close
    </button>

    <?php
    $url = Yii::app()->createUrl('Locations/SaveLocations');

    echo CHtml::ajaxSubmitButton(
        'Save',
        $url,
        array(
            'type' => 'post',
            'dataType' => 'json',
            'beforeSend' => 'function(){
                $("#loader").show();
            }',
            'success' => 'function(data){
                $("#loader").hide();
                if(data.status=="success"){
                    t8.success("Location Saved Successfully!");
                    $(".x.close").click();
                    reloadTable("#tbl_Locations");
                }else{
                    $.each(data,function(k,v){
                        t8.error(v);
                    });
                }
            }'
        ),
        array(
            'class' => 'btn btn-theme',
            'id'    => 'btn-save-Locations'
        )
    );
    ?>

</div>

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

<style>
ul.form-ul li { margin-bottom:15px; }
input[readonly] { background:#f7f7f7; }
</style>
