119 lines
6.8 KiB
PHP
119 lines
6.8 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<h2 class="text-xl font-semibold leading-tight text-gray-800">
|
|
{{ __('Role Details') }}
|
|
</h2>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="mx-auto max-w-6xl sm:px-6 lg:px-8 space-y-6">
|
|
@if (session('status'))
|
|
<div class="rounded-md bg-green-50 p-4">
|
|
<p class="text-sm font-medium text-green-800">{{ session('status') }}</p>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="bg-white shadow sm:rounded-lg">
|
|
<div class="px-4 py-5 sm:p-6 flex items-center justify-between">
|
|
<div>
|
|
<h3 class="text-lg font-medium text-gray-900">{{ $role->name }}</h3>
|
|
<p class="mt-1 text-sm text-gray-600">{{ $role->description ?: __('No description') }}</p>
|
|
</div>
|
|
<a href="{{ route('admin.roles.edit', $role) }}" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
|
{{ __('Edit Role') }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white shadow sm:rounded-lg">
|
|
<div class="px-4 py-5 sm:p-6 space-y-4">
|
|
<h3 class="text-lg font-medium text-gray-900">
|
|
{{ __('Assign Users') }}
|
|
</h3>
|
|
<form method="POST" action="{{ route('admin.roles.assign-users', $role) }}" class="space-y-3">
|
|
@csrf
|
|
<label for="user_ids" class="block text-sm font-medium text-gray-700">
|
|
{{ __('Select users to assign') }}
|
|
</label>
|
|
<select name="user_ids[]" id="user_ids" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" multiple size="5">
|
|
@foreach ($availableUsers as $user)
|
|
<option value="{{ $user->id }}">{{ $user->name }} ({{ $user->email }})</option>
|
|
@endforeach
|
|
</select>
|
|
@error('user_ids')
|
|
<p class="text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
<div class="flex justify-end">
|
|
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
|
{{ __('Assign Selected') }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white shadow sm:rounded-lg">
|
|
<div class="px-4 py-5 sm:p-6 space-y-4">
|
|
<div class="flex items-center justify-between">
|
|
<h3 class="text-lg font-medium text-gray-900">
|
|
{{ __('Users with this role') }}
|
|
</h3>
|
|
<form method="GET" action="{{ route('admin.roles.show', $role) }}" class="flex gap-2" role="search">
|
|
<input
|
|
type="text"
|
|
name="search"
|
|
value="{{ $search }}"
|
|
placeholder="{{ __('Search users') }}"
|
|
class="block rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
>
|
|
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-gray-200 px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-300">
|
|
{{ __('Search') }}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-gray-200" role="table">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">{{ __('Name') }}</th>
|
|
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">{{ __('Email') }}</th>
|
|
<th scope="col" class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500"><span class="sr-only">{{ __('Remove') }}</span></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200 bg-white">
|
|
@forelse ($users as $user)
|
|
<tr>
|
|
<td class="px-4 py-3 text-sm text-gray-900">{{ $user->name }}</td>
|
|
<td class="px-4 py-3 text-sm text-gray-900">{{ $user->email }}</td>
|
|
<td class="px-4 py-3 text-right text-sm">
|
|
<form method="POST" action="{{ route('admin.roles.remove-user', [$role, $user]) }}" onsubmit="return confirm('{{ __('Remove this role from the user?') }}');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="text-red-600 hover:text-red-800">
|
|
{{ __('Remove') }}
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="3" class="px-4 py-4 text-sm text-gray-500">
|
|
{{ __('No users assigned to this role.') }}
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div>
|
|
{{ $users->links() }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-app-layout>
|
|
|