@extends('layouts.app')
@section('title','Roles & Permissions')
@section('crumbs','<b>Roles & Permissions</b>')
@section('content')
<div class="card"><div class="card-h"><h2>Roles</h2><div class="sp">@if(perm('users.create'))<a class="btn btn-pri btn-sm" href="{{ route('roles.create') }}">+ New role</a>@endif</div></div>
<div class="card-b"><div class="twrap"><table class="tbl"><thead><tr><th>Role</th><th>Description</th><th class="r">Users</th><th class="r">Permissions</th><th class="no-print">Actions</th></tr></thead>
<tbody>@foreach($roles as $r)<tr><td><b>{{ $r->name }}</b> <span class="small muted">{{ $r->slug }}</span> @if($r->is_system)<span class="bdg b-info">system</span>@endif</td>
<td>{{ $r->description }}</td><td class="r">{{ $r->users_count }}</td><td class="r">{{ $r->permissions_count }}</td>
<td class="no-print"><div class="row-actions">
@if(perm('users.edit'))<a class="btn btn-sm btn-ghost" href="{{ route('roles.edit',$r->id) }}">Edit</a>@endif
@if(perm('users.delete') && !$r->is_system)<form method="POST" action="{{ route('roles.destroy',$r->id) }}" data-confirm="Delete role?" style="display:inline">@csrf @method('DELETE')<button class="btn btn-sm btn-danger">Del</button></form>@endif
</div></td></tr>@endforeach</tbody></table></div></div></div>
@endsection
