66 lines
3.4 KiB
PHP
66 lines
3.4 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
|
{{ __('Edit User') }}: {{ $user->name }}
|
|
</h2>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
|
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
|
<div class="max-w-xl">
|
|
<section>
|
|
<header>
|
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
{{ __('Assign Roles') }}
|
|
</h2>
|
|
|
|
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
{{ __('Select the roles to assign to this user.') }}
|
|
</p>
|
|
</header>
|
|
|
|
<form method="post" action="{{ route('users.update', $user) }}" class="mt-6 space-y-6">
|
|
@csrf
|
|
@method('put')
|
|
|
|
<div class="space-y-3">
|
|
@forelse ($roles as $role)
|
|
<label class="flex items-start gap-3 cursor-pointer">
|
|
<input
|
|
type="checkbox"
|
|
name="roles[]"
|
|
value="{{ $role->id }}"
|
|
{{ $user->roles->contains($role) ? 'checked' : '' }}
|
|
class="mt-0.5 rounded border-gray-300 dark:border-gray-700 text-indigo-600 shadow-sm focus:ring-indigo-500 dark:focus:ring-indigo-600 dark:bg-gray-900"
|
|
/>
|
|
<div>
|
|
<span class="text-sm font-medium text-gray-900 dark:text-gray-100">{{ $role->name }}</span>
|
|
@if ($role->description)
|
|
<p class="text-xs text-gray-500 dark:text-gray-400">{{ $role->description }}</p>
|
|
@endif
|
|
</div>
|
|
</label>
|
|
@empty
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">{{ __('No roles available. Create one first.') }}</p>
|
|
@endforelse
|
|
</div>
|
|
|
|
<x-input-error class="mt-2" :messages="$errors->get('roles')" />
|
|
<x-input-error class="mt-2" :messages="$errors->get('roles.*')" />
|
|
|
|
<div class="flex items-center gap-4">
|
|
<x-primary-button>{{ __('Save Roles') }}</x-primary-button>
|
|
|
|
<a href="{{ route('users.index') }}" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 underline">
|
|
{{ __('Cancel') }}
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-app-layout>
|