<?php
/* @var $this categorytypeController */
/* @var $model MascategoryType */
/* @var $form CActiveForm */
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'mas-category-type-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-12">
                <?php echo $form->textField($model, 'category_type_name', array('data-label' => 'Category Type')); ?>
            </li> 
		
        </ul>
    </div>

</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" id="categorytype_close" data-dismiss="modal">Close</button>
    <?php
    $url = Yii::app()->createUrl('categorytype/Save');
    echo CHtml::ajaxSubmitButton('Save', $url, array(
        'dataType' => 'json',
        'type' => 'post',
        'success' => 'function(data) {
                                $("#loader").hide();
                                    if(data.status=="success"){  
                                        t8.success("Type Saved Successfully!");
                                        $("#categorytype_close").click();
                                        reloadTable("#tbl_categorytype_details");
                                    } else { 
                                        $("#categorytype-form .categorytype-save-btn").prop("disabled", false);                      
                                        $("#categorytype-form .categorytype-save-btn").addClass("btn-theme").removeClass("btn_loading"); 
                                        $.each(data, function(key, val) {
                                            t8.error(""+val+""); 
                                        }); 
                                    } 
                            }',
        'beforeSend' => 'function(){ 
                               $("#loader").show();
                               $(".toast8-error").hide();
                               $("#categorytype-form .categorytype-save-btn").prop("disabled", true);                      
                               $("#categorytype-form .categorytype-save-btn").addClass("btn_loading").removeClass("btn-theme"); 
                                
                            }'
            ), array('id' => 'mybtn' . rand(), 'class' => 'categorytype-save-btn btn btn-theme'));
    ?>
</div>

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

</div><!-- form -->