70 lines
3.8 KiB
PHP
70 lines
3.8 KiB
PHP
<x-layouts::app :title="__('Roles & Permissions')">
|
|
<div class="hd-page-shell space-y-5">
|
|
<section class="hd-page-hero">
|
|
<div>
|
|
<div class="hd-eyebrow">Administration</div>
|
|
<h1>Roles & permissions</h1>
|
|
<p>Create roles, define permissions and assign permissions to roles.</p>
|
|
</div>
|
|
<div class="flex flex-wrap gap-2">
|
|
<a class="hd-action hd-action-blue" href="{{ route('user-management.roles.create') }}"><i class="fa-solid fa-plus"></i> New role</a>
|
|
<a class="hd-action hd-action-green" href="{{ route('user-management.permissions.create') }}"><i class="fa-solid fa-key"></i> New permission</a>
|
|
</div>
|
|
</section>
|
|
|
|
@if(session('status'))<div class="hd-alert hd-alert-success">{{ session('status') }}</div>@endif
|
|
@if($errors->any())<div class="hd-alert hd-alert-danger"><ul>@foreach($errors->all() as $error)<li>{{ $error }}</li>@endforeach</ul></div>@endif
|
|
|
|
<section class="hd-panel overflow-x-auto">
|
|
<div class="p-5 border-b border-zinc-700"><h2 class="text-xl font-semibold">Roles</h2></div>
|
|
<table class="w-full min-w-[760px]">
|
|
<thead><tr><th>Name</th><th>Slug</th><th>Users</th><th>Permissions</th><th class="text-right">Actions</th></tr></thead>
|
|
<tbody>
|
|
@forelse($roles as $role)
|
|
<tr>
|
|
<td><strong>{{ $role->name }}</strong>@if($role->is_system) <span class="hd-badge">System</span>@endif</td>
|
|
<td><code>{{ $role->slug }}</code></td>
|
|
<td>{{ $role->users_count }}</td>
|
|
<td>{{ $role->permissions_count }}</td>
|
|
<td><div class="flex justify-end gap-2">
|
|
<a class="hd-action hd-action-blue" href="{{ route('user-management.roles.edit', $role) }}">Edit</a>
|
|
@unless($role->is_system)
|
|
<form method="POST" action="{{ route('user-management.roles.destroy', $role) }}" onsubmit="return confirm('Delete this role?')">@csrf @method('DELETE')
|
|
<button class="hd-action hd-action-red" type="submit">Delete</button>
|
|
</form>
|
|
@endunless
|
|
</div></td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="5" class="p-5">No roles created.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<section class="hd-panel overflow-x-auto">
|
|
<div class="p-5 border-b border-zinc-700"><h2 class="text-xl font-semibold">Permissions</h2></div>
|
|
<table class="w-full min-w-[760px]">
|
|
<thead><tr><th>Name</th><th>Slug</th><th>Roles</th><th class="text-right">Actions</th></tr></thead>
|
|
<tbody>
|
|
@forelse($permissions as $permission)
|
|
<tr>
|
|
<td><strong>{{ $permission->name }}</strong></td>
|
|
<td><code>{{ $permission->slug }}</code></td>
|
|
<td>{{ $permission->roles_count }}</td>
|
|
<td><div class="flex justify-end gap-2">
|
|
<a class="hd-action hd-action-blue" href="{{ route('user-management.permissions.edit', $permission) }}">Edit</a>
|
|
<form method="POST" action="{{ route('user-management.permissions.destroy', $permission) }}" onsubmit="return confirm('Delete this permission?')">@csrf @method('DELETE')
|
|
<button class="hd-action hd-action-red" type="submit">Delete</button>
|
|
</form>
|
|
</div></td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="4" class="p-5">No permissions created.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
</div>
|
|
</x-layouts::app>
|