<?php 
$role_resources_ids = $this->Xin_model->user_role_resource();
$cookie_name = $this->Xin_model->get_cookie_name();
$session = $this->session->userdata($cookie_name);?>

<div class="add-form">
  <div class="box box-block bg-white p-3">
    
    <div class="row m-b-1">
      <div class="col-md-12">
        <form action="<?php echo site_url("roles/add_role") ?>" method="post" name="add_role" id="xin-form">
          <input type="hidden" name="_user" value="<?php echo $session['user_id'];?>">
          <div class="bg-white p-3">
            <div class="box-block">
              <div class="row">
                <div class="col-md-4">
                  <div class="row">
                    <div class="col-md-12">
                      <div class="form-group">
                        <label for="role_name">Role Name</label>
                        <input class="form-control" placeholder="Role Name" name="role_name" type="text" value="">
                      </div>
                    </div>
                  </div>
                  <div class="row">
                    <input type="checkbox" name="role_resources[]" value="0" checked style="display:none;"/>
                    <div class="col-md-12">
                      <div class="form-group">
                        <label for="role_access">Select Access</label>
                        <select class="form-control custom-select" id="role_access" data-plugin="select_hrm" name="role_access"  data-placeholder="Select Access">
                          <option value="">&nbsp;</option>
                          <option value="1">All Menu Access</option>
                          <option value="2">Custom Menu Access</option>
                        </select>
                      </div>
                    </div>
                  </div>
                  <div class="row">
                    <div class="col-md-12">
                      <div class="form-group">
                        <button type="submit" class="btn btn-primary save">Save</button>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="row">
                    <div class="col-md-12">
                      <div class="form-group">
                        <label for="resources">Resources</label>
                        <div id="all_resources">
                          <div class="demo-section k-content">
                            <div>
                              <div id="treeview_r1"></div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="row">
                    <div class="col-md-12">
                      <div class="form-group">
                        <div id="all_resources">
                          <div class="demo-section k-content">
                            <div>
                              <div id="treeview_r2"></div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
<div class="box box-block bg-white p-3">
  
    <div class="row p-2">
      <div class="col-md-6">
          <h5><strong>List All</strong> Roles</h5>
      </div>
      <?php if(in_array('26',$role_resources_ids)) {?>
      <div class="col-md-6">
          <div class="add-record-btn float-right">
            <button class="btn btn-sm btn-primary add-new-form"><i class="fa fa-plus icon"></i> Set New Role</button>
          </div>
      </div>
      <?php }?>
    </div>
    
  <div class="table-responsive" data-pattern="priority-columns">
    <table class="table table-striped table-bordered dataTable" id="xin_table" style="width:100%;">
      <thead>
        <tr>
          <th>Action</th>
          <th>Role ID</th>
          <th>Role Name</th>
          <th>Menu Permission</th>
          <th>Added Date</th>
        </tr>
      </thead>
    </table>
  </div>
</div>
<style type="text/css">
.k-in { display:none !important; }
</style>