<!DOCTYPE html>
<html>
<head>
  @include('title')
  @include('headtag')
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  @include('headertag')
  <!-- Left side column. contains the logo and sidebar -->
  @include('leftside')
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
      <!-- Content Header (Page header) -->
      <section class="content-header">
        <h1>
          Update Role
        </h1>
        <ol class="breadcrumb">
          <li><a href="{{route('role.index')}}"><i class="fa fa-dashboard"></i> Role</a></li>
          <li class="active"><a href="{{route('role.index')}}">List</a></li>
        </ol>
      </section>

             @if(Session::has('exist')) 
              <div class="box-header with-border">
                <div class="alert alert-danger alert-dismissible">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                Role Already Added...!!
                </div>
              </div>
             @endif
      
      <!-- Main content -->
      <section class="content">
        
        <!-- Main row -->
        <div class="row">
          <!-- Left col -->
          <section class="col-lg-12 connectedSortable">
            <!-- Custom tabs (Charts with tabs)-->
            <div class="nav-tabs-custom">
              <!-- Tabs within a box -->
              
              <div class="tab-content no-padding">
               <!-- right column -->
        
       <!-- Horizontal Form -->
             <div class="box box-info">
              <div class="box-header with-border">
                <h3 class="box-title"></h3>
                
              </div>
            <!-- /.box-header -->
            <!-- form start -->
            
             <form class="form-horizontal" action="{{route('role.update')}}" method="POST">
             <input type="hidden" name="_token" value="{{ csrf_token() }}">
             <input type="hidden" name="role_id" id="role_id" value="{{$role->id}}">
              <div class="box-body">
                <div class="form-group">
                  <label for="inputcategory" class="col-sm-2 control-label">Role<font color="red">*</font></label>
                    <div class="col-sm-4">
                    <input type="text" class="form-control" id="role" name="role" value="{{$role->name}}" placeholder="Role name" required="" @if($role->flag == '1') disabled="disabled" @endif>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputcategory" class="col-sm-2 control-label">Description<font color="red">*</font></label>
                    <div class="col-sm-4">
                    <input type="text" class="form-control" id="description" name="description" placeholder="Description" value="{{$role->description}}" required="" @if($role->flag == '1') disabled="disabled" @endif>
                  </div>
                </div>
                
                <div class="form-group">
                  <label for="inputcategory" class="col-sm-2 control-label">Permissions<font color="red">*</font></label>
                    <div class="col-sm-4">
                     @foreach($permissions as $permission)
                      <div class="checkbox">
                      @if(in_array($permission->id,$list))
                      <label>
                      <input type="checkbox" name="permisssion[]" value="{{$permission->id}}" checked="">
                                {{$permission->display_name}}
                      </label>
                      @else
                      <label>
                      <input type="checkbox" name="permisssion[]" value="{{$permission->id}}" >
                                {{$permission->display_name}}
                      </label>
                      @endif
                     </div>
                  @endforeach
                  </div>
                </div>
              </div>
              <!-- /.box-body -->
              <div class="box-footer">
                <button type="reset" class="btn btn-default pull-left">Refresh</button>
                <button type="submit" class="btn btn-info pull-left" style="margin-left: 8px;">Update</button>
              </div>
              <!-- /.box-footer -->
            </form>
          </div>
          <!-- /.box --> 
                
          </div>
          </div>

          
            <!-- /.nav-tabs-custom -->

            <!-- Chat box -->
            
            <!-- /.box (chat box) -->

            
            <!-- quick email widget -->
          </section>
          <!-- /.Left col -->
          
        </div>
        <!-- /.row (main row) -->

      </section>
      <!-- /.content -->
    </div>
  <!-- /.content-wrapper -->
  
  @include('footertag')

  <!-- Control Sidebar -->
  @include('rightside')
  <!-- /.control-sidebar -->

  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

@include('dashjq')

</body>
</html>
