<?php
$cs = Yii::app()->getClientScript();
$baseUrl = Yii::app()->baseUrl;
$cs->registerScript("loadUsergroup", '$(document).ready(function() {
        var table_id ="#tbl_usergroup_details";
        var table = $(table_id).DataTable({
            scrollY         : "380px",
            // scrollX         : "true",
            // scrollCollapse  : true,
            pageLength      : 50,
            processing: true,
            ajax: {
                url: "' . Yii::app()->createUrl('usergroup/GetUserGroupList') . '",
                type: "POST",
                cache : false,
            },
            serverSide:     true,
            fixedColumns:   true,
            processing: true,
            fixedHeader: {
            headerOffset: $("header.main").outerHeight()
            }
        } );
        $(".dataTables_scrollFoot").hide();
});', CClientScript::POS_HEAD);
$cs->registerScript("deleteUserGroup", "
    function deleteUserGroup(id) {
        var r = confirm('Are you sure to delete this?');
        if (r == true)
        {
            jQuery.ajax({
                'type': 'post',
                'data': 'id=' + id,
                'url': $('#liveSite').val() + 'index.php?r=usergroup/DeleteUserGroup',
                'cache': false,
                'success': function (data) {
                    if (data == 'fail') {
                        alert('Error while Delete', 'Alert');
                    } else {
                        reloadTable('#tbl_usergroup_details');
                        t8.success('User Group Deleted SuccessFully');
                    }
                }
            });
        }
    }", CClientScript::POS_HEAD);
?>




<section class="panel">
    <header class="panel-heading clearfix panel-theame">
        <i class="fa fa-user-md"></i> User Groups
        <div class="pull-right">
            <?php //if (isset(Yii::app()->user->havePermissionOn['admin_usergroup_add']) || Yii::app()->user->authorised_user == 1) { ?>

            <button class="btn btn-sm btn-theme_1" onclick="loadPopupModal('usergroup/create', 'Add User Group', 'xl')"><i class="fa fa-plus"></i> ADD</button>
<!--             <button class="btn btn-sm btn-theme" onclick="loadPopupModal('usergroup/create_new','Add User Group','lg')"><i class="fa fa-plus"></i> ADD</button>  -->
            <?php // } ?></div>

    </header>
    <div class="panel-body">
        <div class="custom-data-table">
            <table class="table table-hover table-bordered personal-task" id="tbl_usergroup_details">
                <thead>
                    <tr>
                        <th>Group Name</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th>Group Name</th>
                        <th>Actions</th>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
</section>