<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
   <section class="content-header">
      <div class="container-fluid">
         <div class="row mb-2">
            <div class="col-sm-6">
               <h4>Edit Permission</h4>
            </div>
            <div class="col-sm-6">
               <ol class="breadcrumb float-sm-right">
                  <li class="breadcrumb-item"><a href="#">Home</a></li>
                  <li class="breadcrumb-item active">Edit Permission</li>
               </ol>
            </div>
         </div>
      </div>
      <!-- /.container-fluid -->
   </section>
   <section class="content">
      <div class="container">
         <div class="row"> 
            <div class="col-md-12 col-lg-12">
               <div class="container-fluid">
                  
                  <div class="card card-default">
                     <div class="card-header">
                     <h3 class="card-title">Edit Role</h3>
                     <span style="float: right;"><a href="<?php echo base_url() ?>/admin/user/role_permission"><button class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i>
                     &nbsp;Add Role</button></a></span>
                  </div>
                  <?php echo form_open('admin/user/update_role_permission/'.$permission->id); ?>
                     <div class="card-body">
                        <div class="tab-content">
                           <!--Application Details-->
                           <div class="tab-pane active" id="general_setting">
                              <div class="form-group row">
                                 <label for="inputName" class="col-sm-12 col-form-label">Role Name</label>
                                 <div class="col-sm-12">
                                    <input type="text" name="role_name" class="form-control" id="inputName" placeholder="Enter Role Name" value="<?php echo $permission->role_name ?>" required="required" <?php if($permission->role_name == 'Teacher'){echo 'readonly';} ?>>
                                 </div>
                              </div>
                              <input type="hidden" name="role_id" value="<?php echo $permission->id ?>">
                              <div class="form-group row d-none">
                                 <label for="inputEmail" class="col-sm-12 col-form-label">Permission Details</label>
                                 <div class="col-sm-12">
                                    <table>
                                       <tr>
                                          <div class="selectgroup selectgroup-pills">
                                          <?php 
                                            foreach ($tables as $table){ 
                                             if($table != 'is_emp'): ?>
                                            <label class="selectgroup-item">
                                              <input type="checkbox" name="<?php echo $table  ?>" value="1" class="selectgroup-input" <?php if($permission->$table == 1){echo 'checked';} ?>>
                                              <span style="display: <?php if($table == 'id' || $table == 'role_name' || $table == 'show'){echo 'none';} ?>;" class="selectgroup-button"><?php echo ucwords(str_replace("_", " ", $table)); ?></span>
                                            </label>
                                              <?php endif; } ?>
                                          </div>
                                       </tr>
                                    </table>
                                 </div>
                              </div>
                              <div class="form-group row">
                                 <div class="offset-sm-2 col-sm-10">
                                    <button style="float: right;" type="submit" class="btn btn-success setting-submit" name="submit">Save</button>
                                 </div>
                              </div>
                           </div>
                        </div>
                     </div>
                     
                     <?php echo form_close(); ?>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
   
</section>
</div>
<style type="text/css">
  .selectgroup-pills .selectgroup-item {
    margin-right: .5rem;
    -ms-flex-positive: 0;
    flex-grow: 0;
}
.selectgroup-item {
    -ms-flex-positive: 1;
    flex-grow: 1;
    position: relative;
    font-weight: 400!important;
}
.selectgroup-input {
    opacity: 0;
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
}
.selectgroup-item:not(:last-child) .selectgroup-button {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.selectgroup-item:not(:first-child) .selectgroup-button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
body[data-background-color=dark] .selectgroup-button {
    border: 1px solid #2f374b;
}
.selectgroup-pills .selectgroup-button {
    border-radius: 50px!important;
}
.selectgroup-button {
    display: block;
    border: 1px solid rgba(0,40,100,.12);
    text-align: center;
    padding: .375rem 1rem;
    position: relative;
    cursor: pointer;
    border-radius: 3px;
    color: #9aa0ac;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-size: 14px;
    line-height: 1.5rem;
    min-width: 2.375rem;
}
.selectgroup-input:checked+.selectgroup-button {
    border-color: #1572e8;
    z-index: 1;
    color: #1572e8;
    background: rgba(21,114,232,.15);
}
</style>
