<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'area-form',
    'enableAjaxValidation' => false,
    'enableClientValidation' => false,
        ));
?>
<div class="tab-content">
    <div class="tab-pane active">
        <ul class="clearfix form-ul material">
            <?php echo $form->hiddenField($model, 'id'); ?>
            <li class="col-sm-4">
                <?php echo $form->textField($model, 'area_name', array('data-label' => 'Area Name <span style="color:red">*</span>', 'data-validation' => 'required')); ?>
            </li> 
            <li class="col-sm-4">
                <?php echo $form->dropdownList($model, 'is_active', array('Y' => 'Yes', 'N' => 'No'), array('data-label' => 'Is Active')); ?>
                <?php echo $form->error($model, 'is_active'); ?>
            </li>
            <li class="col-sm-4">
                   <?php echo $form->textField($model, 'sort_order',array('data-label'=>'Sorting Order <span style="color:red">*</span>')); ?>
            </li>
        </ul>
    </div>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" id="area_close" data-dismiss="modal">Close</button>
    <?php
    $url = Yii::app()->createUrl('masarea/Save');
    echo CHtml::ajaxSubmitButton('Save', $url, array(
        'dataType' => 'json',
        'type' => 'post',
        'success' => 'function(data) {
                                $("#loader").hide();
                                    if(data.status=="success"){  
                                        t8.success("Area Saved Successfully!");
                                        $("#area_close").click();
                                        reloadTable("#tbl_area_details");
                                    } else { 
                                        $("#area-form .area-save-btn").prop("disabled", false);                      
                                        $("#area-form .area-save-btn").addClass("btn-theme").removeClass("btn_loading"); 
                                        $.each(data, function(key, val) {
                                            t8.error(""+val+""); 
                                        }); 
                                    } 
                            }',
        'beforeSend' => 'function(){ 
                               $("#loader").show();
                               $(".toast8-error").hide();
                               $("#area-form .area-save-btn").prop("disabled", true);                      
                               $("#area-form .area-save-btn").addClass("btn_loading").removeClass("btn-theme"); 
                                
                            }'
            ), array('id' => 'mybtn' . rand(), 'class' => 'area-save-btn btn btn-theme'));
    ?>
</div>
<?php $this->endWidget(); ?>
