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

@section('title', '| Add Role')
@section('heading', 'Add Role')

@section('scripts')
<script src="{{ asset('js/role_categories.js') }}"></script>
@endsection

@section('content')
  {{ Form::open(array('url' => 'roles')) }}

  <div class='form-group'>
    {{ Form::label('name', 'Name') }}
    {{ Form::text('name', '', array('class' => 'form-control')) }}
  </div>

  <div class='form-group'>
    {{ Form::label('description', 'Description') }}
    {{ Form::textarea('description', '', array('class' => 'form-control')) }}
  </div>

  <br/><h1>Permissions</h1>

  <div class='panel-group' id='accordion'>
  @foreach ($permissions as $key=>$category)
    <div class='panel panel-default'>

      <div class='panel-heading'>
        <h2 class='panel-title'>
          <a data-toggle='collapse' data-parent='#accordion' href='#collapse{{str_replace(' ','',$key)}}'>{{$key}}</a>
        </h2>
      </div>

      <div id='collapse{{str_replace(' ','',$key)}}' class='panel-collapse collapse'>
        <div class='panel-body'>
          @foreach ($category as $permission)
            <div class='col-md-6'>
              <div class='form-group'>
                {{ Form::checkbox('p_'.$permission->id,$permission->id)}}
                {{ Form::label('name', $permission->name) }}
              </div>
            </div>
          @endforeach
        </div>
      </div>
    </div>
  @endforeach
  </div>

  {{ Form::submit('Add', array('class' => 'btn btn-primary')) }}

  {{ Form::close() }}
@endsection
