@extends('admin.base')

@section('content')
<div class="row page-heading">
  <div class="col-md-12 h3">{{$role->description}}</div>
</div>
<div class="section-heading row">
  <div class="col-md-6 h4">Usuarios</div>
  <div class="col-md-6 h4 text-right"><a href="{{url('', ['p' => 'admin', 'a' => 'add_user_role', 'role' => $role->id])}}"><span class="glyphicon glyphicon-plus"></span></a></div>
</div>
<table class="table">
  @foreach ($role->users() as $user)
  <tr>
    <td><a href="{{nUrl('admin', 'user', ['user' => $user->id])}}">{{$user->name}}</a></td>
    <td><a href="{{url('', ['p' => 'admin', 'a' => 'remove_user_role', 'user' => $user->id, 'role' => $role->id])}}"><span class="glyphicon glyphicon-minus"></span></a></td>
  </tr>
  @endforeach
</table>
<div class="row section-heading">
  <div class="col-md-6 h4">Permisos</div>
  <div class="col-md-6 h4 text-right"><a href="{{nUrl('admin', 'add_role_permissions', ['role' => $role->id])}}"><span class="glyphicon glyphicon-plus"></span></a></div>
</div>
@if ($role->permissions())
<table class="table table-striped">
  <thead>
    <tr>
      <th>Acci&oacute;n</th>
      <th>Estado</th>
      <th>Heredado</th>
    </tr>
  </thead>
  <tbody>
    @foreach ($permissions as $permission)
    <tr>
      <td>{{$permission->description}}</td>
      <td style="color:
      @if ($permission->status)
        #00ff00
      @else
        #ff0000
      @endif
      ;">
        @if ($permission->status) Permitido @else Denegado @endif
      </td>
      <td style="color:
      @if ($permission->inherited)
        #00ff00
      @else
        #ff0000
      @endif
      ;">
        @if ($permission->inherited)
          Si
        @else
          No
        @endif
      </td>
    </tr>
    @endforeach
  </tbody>
</table>
@endif
@endsection
