105 lines
5.2 KiB
PHP
105 lines
5.2 KiB
PHP
@php
|
|
$layout = isset($roles) ? 'app-layout' : 'guest-layout';
|
|
@endphp
|
|
|
|
<x-dynamic-component :component="$layout">
|
|
@if(isset($roles))
|
|
<x-slot name="header">
|
|
<div class="flex items-center justify-between">
|
|
<h2 class="font-semibold text-xl text-gray-800 dark:text-white leading-tight">
|
|
{{ __('Dodaj użytkownika') }}
|
|
</h2>
|
|
<a href="{{ route('users.index') }}"
|
|
class="inline-flex items-center px-4 py-2 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-800 dark:text-white text-sm font-medium rounded-md shadow-sm transition ease-in-out duration-150 gap-2">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
|
|
</svg>
|
|
<span>{{ __('Powrót do listy') }}</span>
|
|
</a>
|
|
</div>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="max-w-2xl mx-auto sm:px-6 lg:px-8">
|
|
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg border border-gray-200 dark:border-gray-700/50 p-6 text-gray-900 dark:text-white">
|
|
@endif
|
|
|
|
<form method="POST" action="{{ isset($roles) ? route('users.store') : route('register') }}">
|
|
@csrf
|
|
|
|
<!-- Name -->
|
|
<div>
|
|
<x-input-label for="name" :value="__('Imię')" />
|
|
<x-text-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus autocomplete="name" />
|
|
<x-input-error :messages="$errors->get('name')" class="mt-2" />
|
|
</div>
|
|
|
|
<!-- Surname -->
|
|
<div class="mt-4">
|
|
<x-input-label for="surname" :value="__('Nazwisko')" />
|
|
<x-text-input id="surname" class="block mt-1 w-full" type="text" name="surname" :value="old('surname')" required autocomplete="family-name" />
|
|
<x-input-error :messages="$errors->get('surname')" class="mt-2" />
|
|
</div>
|
|
|
|
<!-- Email Address -->
|
|
<div class="mt-4">
|
|
<x-input-label for="email" :value="__('Email')" />
|
|
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autocomplete="username" />
|
|
<x-input-error :messages="$errors->get('email')" class="mt-2" />
|
|
</div>
|
|
|
|
<!-- Select Role (Dynamic) -->
|
|
@isset($roles)
|
|
<div class="mt-4">
|
|
<x-input-label for="role" :value="__('Rola')" />
|
|
|
|
<select id="role" name="role" class="block mt-1 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" required>
|
|
<option value="" disabled {{ old('role') ? '' : 'selected' }}>-- Wybierz rolę --</option>
|
|
@foreach($roles as $role)
|
|
<option value="{{ $role->name }}" {{ old('role') === $role->name ? 'selected' : '' }}>
|
|
{{ ucfirst($role->name) }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
|
|
<x-input-error :messages="$errors->get('role')" class="mt-2" />
|
|
</div>
|
|
@endisset
|
|
|
|
<!-- Password -->
|
|
<div class="mt-4">
|
|
<x-input-label for="password" :value="__('Hasło')" />
|
|
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
|
|
<x-input-error :messages="$errors->get('password')" class="mt-2" />
|
|
</div>
|
|
|
|
<!-- Confirm Password -->
|
|
<div class="mt-4">
|
|
<x-input-label for="password_confirmation" :value="__('Powtórz Hasło')" />
|
|
<x-text-input id="password_confirmation" class="block mt-1 w-full" type="password" name="password_confirmation" required autocomplete="new-password" />
|
|
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
|
|
</div>
|
|
|
|
<div class="flex items-center justify-end mt-6 gap-4">
|
|
@if(!isset($roles))
|
|
<a class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800" href="{{ route('login') }}">
|
|
{{ __('Already registered?') }}
|
|
</a>
|
|
@else
|
|
<a href="{{ route('users.index') }}" class="inline-flex items-center px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md font-semibold text-xs text-gray-700 dark:text-gray-300 uppercase tracking-widest shadow-sm hover:bg-gray-50 dark:hover:bg-gray-700 transition">
|
|
{{ __('Anuluj') }}
|
|
</a>
|
|
@endif
|
|
|
|
<x-primary-button>
|
|
{{ __('Zapisz') }}
|
|
</x-primary-button>
|
|
</div>
|
|
</form>
|
|
|
|
@if(isset($roles))
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</x-dynamic-component> |