@extends('layouts.default')
@extends('content_wrappers.md-10')

@section('title', '| Roles')
@section('heading', 'Role Administration')

@section('content')
  <div class="table-responsive">
    <table class="table table-bordered table-striped">

      <thead>
        <tr>
          <th>Name</th>
          <th>Description</th>
          <th>Operations</th>
        </tr>
      </thead>

      <tbody>
        @foreach ($roles as $role)
        <tr>

          <td>{{ $role->name }}</td>
          <td>{{ $role->description }}</td>
          <td>

          @if(in_array('EditRole',$allperms))
            <a href="{{ route('roles.edit', $role->id) }}" class="btn btn-info pull-left" style="margin-right: 3px;">Edit</a>
          @endif

          @if(in_array('DeleteRole',$allperms))
            {!! Form::open(['method' => 'DELETE', 'route' => ['roles.destroy', $role->id] ]) !!}
            {!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
            {!! Form::close() !!}
          @endif
          </td>
        </tr>
        @endforeach
      </tbody>
    </table>
  </div>

  @if(in_array('CreateRole',$allperms))
    <a href="{{ route('roles.create') }}" class="btn btn-success">Add Role</a>
  @endif
@endsection