new_malcomm_oline/resources/views/profile/partials/update-role-form.blade.php
2026-08-13 17:05:07 +02:00

44 lines
1.7 KiB
PHP

<section>
<header>
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __('Rola użytkownika') }}
</h2>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
{{ __('Wybierz rolę przypisaną do tego konta.') }}
</p>
</header>
<form method="post" action="{{ route('profile.update') }}" class="mt-6 space-y-6">
@csrf
@method('patch')
<div>
<x-input-label for="role" :value="__('Rola')" />
<select id="role" name="role" class="mt-1 block w-full border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm">
@foreach(\App\Enums\UserRole::cases() as $role)
<option value="{{ $role->value }}" {{ old('role', $user->role->value ?? $user->role) === $role->value ? 'selected' : '' }}>
{{ ucfirst($role->value) }}
</option>
@endforeach
</select>
<x-input-error class="mt-2" :messages="$errors->get('role')" />
</div>
<div class="flex items-center gap-4">
<x-primary-button>{{ __('Zapisz') }}</x-primary-button>
@if (session('status') === 'profile-updated')
<p
x-data="{ show: true }"
x-show="show"
x-transition
x-init="setTimeout(() => show = false, 2000)"
class="text-sm text-gray-600 dark:text-gray-400"
>{{ __('Zapisano.') }}</p>
@endif
</div>
</form>
</section>