<div class="popup_inner_element">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'edit_user-form',
        'enableAjaxValidation' => false,
        'enableClientValidation' => false,
    ));
    ?>
    <ul class="nav nav-tabs company-nav-tabs nav-tab-theme">
        <li class="active"><a href="#users_tab1" data-toggle="tab">General</a></li>
        <li><a href="#users_tab2" data-toggle="tab">Portal</a></li> 
    </ul>
    <div class="tab-content">
        <div class="tab-pane active" id="users_tab1">
            <?php $this->renderPartial('edit_general', array('model' => $model,'model_user'=>$model_user, 'form' => $form)); ?>                
        </div>
        <div class="tab-pane" id="users_tab2">
            <?php $this->renderPartial('edit_users_portal', array('model' => $model,'model_user'=>$model_user, 'form' => $form)); ?>                
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-danger" id="user_edit_close" data-dismiss="modal">Close</button>
        <?php
        $url = Yii::app()->createUrl('users/EditSaveUsers');
        echo CHtml::ajaxSubmitButton('Save', $url, array(
            'dataType' => 'json',
            'type' => 'post',
            'success' => 'function(data) {
                                    $("#loader").hide();
                                    if(data.status=="success"){
                                         t8.success("User Saved Successfully!");
                                         $("#user_edit_close").click();
                                        //location.reload();
                                        reloadTable("#tbl_user_details");
                                    } else {
                                        $("#edit_user-form .user-edit-save-btn").prop("disabled", false);
                                        $("#edit_user-form .user-edit-save-btn").addClass("btn-theme").removeClass("btn_loding");
                                        $.each(data, function(key, val) {
                                                $("#edit_user-form #"+key+"_em_").text(val).show();
                                                t8.error(""+val+"");
                                        });
                                    }
                            }',
            'beforeSend' => 'function(){
                                var users_count=$("#edit_user_details input:checked").size();
                              // if(users_count>0){
                                    $("#loader").show();
//                                    $("#edit_user-form .user-edit-save-btn").prop("disabled", true);
//                                    $("#edit_user-form .edit-user-save-btn").addClass("btn_loding").removeClass("btn-theme");
                                    $(".toast8-error").hide();
                                    return true;
//                                }else{
//                                    t8.error("Please select a Portal"); 
//                                    return false;
//                                }
                            }',
            'complete' => 'function(){
                                $("#loader").hide();

                            }'
                ), array('id' => 'mybtn' . rand(), 'class' => 'user-edit-save-btn btn btn-theme'));
        ?>
    </div>
    <?php $this->endWidget(); ?>
</div>