<?php if($this->session->flashdata('success')): ?>
    <div class="row">
        <div class="alert alert-block alert-success" style="margin-bottom: 5px">
            <button type="button" class="close" data-dismiss="alert">
                <i class="ace-icon fa fa-times"></i>
            </button>
            <i class="ace-icon fa fa-check green"></i>
            <?php echo $this->session->flashdata('success'); ?>
        </div>
    </div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
    <div class="row">
        <div class="alert alert-block alert-danger" style="margin-bottom: 5px">
            <button type="button" class="close" data-dismiss="alert">
                <i class="ace-icon fa fa-times"></i>
            </button>
            <i class="ace-icon fa fa-times"></i>
            <?php echo $this->session->flashdata('error'); ?>
        </div>
    </div>
<?php endif; ?>
<div class="row">
    <div class="widget-box">
        <div class="widget-header">
            <p class="widget-title">Gán quyền cho User</p>
        </div>
        <div class="widget-body">
            <div class="widget-main">
                <?php
                $attributes = array('class' => 'form-horizontal', 'id' => 'myform');
                echo form_open(base_url().'backend/cmsSetting/assignPermissionUserAdmin/'.$userAdminById[0]['id'].'/'.$userAdminById[0]['group_id'], $attributes);
                ?>
                <div class="form-group">
                    <label class="col-lg-3">Thuộc nhóm người dùng</label>
                    <div class="col-lg-3">
                        <?php echo ': '.$userAdminById[0]['groupDescription'].' ('.$userAdminById[0]['groupName'].')'; ?>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3">Họ và tên</label>
                    <div class="col-lg-3">
                        <?php echo ': '.$userAdminById[0]['fullname']; ?>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3">Tên tài khoản</label>
                    <div class="col-lg-3">
                        <?php echo ': '.$userAdminById[0]['username']; ?>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3">Email</label>
                    <div class="col-lg-3">
                        <?php echo ': '.$userAdminById[0]['email']; ?>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3">Kích hoạt</label>
                    <div class="col-lg-3">
                        <input name="is_active" type="checkbox" <?php if($userAdminById[0]['is_active'] == 1) echo 'checked' ?> disabled>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3">Gán quyền truy cập Action cho User</label>
                    <div class="col-lg-9">
                        <div class="row">
                            <?php
                            if(count($controllerList) > 0):
                            foreach($controllerList as $controllerItem): ?>
                            <div class="col-lg-12">
                                <h3 class="header blue lighter smaller" style="font-size: 15px"><i class="ace-icon fa fa-desktop smaller-90"></i>
                                    <?php echo $controllerItem['name'].' ('.$controllerItem['description'].')'?>
                                </h3>
                                <?php
                                foreach($actionList as $actionItem):
                                    if($controllerItem['id'] == $actionItem['controller_id']):
                                    ?>
                                    <div class="col-lg-6">
                                        <label>
                                            <?php $adminAccessActionList = ($admin_access_action_submit) ? $admin_access_action_submit : $admin_access_action ?>
                                            <input name="admin_access_action[]" type="checkbox" value="<?php echo $actionItem['id']; ?>" <?php if($adminAccessActionList && in_array($actionItem['id'], $adminAccessActionList)) echo 'checked' ?>/>
                                            <?php echo $actionItem['name'].' ('.$actionItem['description'].')'; ?>
                                        </label>
                                    </div>
                                <?php
                                    endif;
                                    endforeach;
                                ?>
                            </div>
                            <?php
                                endforeach;
                                else:
                            ?>
                            <div class="col-lg-12">: (Chưa gán quyền cho Nhóm)</div>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-lg-3">
                        <a href="<?php echo base_url().'backend/cmsSetting/listUserAdmin'?>" onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')">
                            <button type="button" class="btn btn-sm btn-default">
                                <i class="ace-icon fa fa-arrow-left"></i>Quay lại
                            </button>
                        </a>
                    </div>
                    <div class="col-lg-4">
                        <button class="btn btn-sm btn-primary" type="submit" name="btnSave">
                            <i class="ace-icon fa fa-check bigger-110"></i>Lưu lại
                        </button>
                        <button class="btn btn-sm" type="reset">
                            <i class="ace-icon fa fa-undo bigger-110"></i>Xóa form
                        </button>
                    </div>
                </div>
                <?php echo form_close(); ?>
            </div>
        </div>
    </div>
</div><!-- /.row -->