149 lines
6.1 KiB
PHP
149 lines
6.1 KiB
PHP
@extends('layouts.admin')
|
|
|
|
@section('title', 'Neuer Benutzer')
|
|
|
|
@section('content')
|
|
<div class="max-w-2xl mx-auto">
|
|
<div class="mb-8">
|
|
<h1 class="text-3xl font-bold text-gray-900">Neuer Benutzer</h1>
|
|
<p class="text-gray-600 mt-2">Erstellen Sie einen neuen Benutzer für das System</p>
|
|
</div>
|
|
|
|
<div class="bg-white shadow rounded-lg p-6">
|
|
<form action="{{ route('admin.users.store') }}" method="POST" class="space-y-6">
|
|
@csrf
|
|
|
|
<!-- Name -->
|
|
<div>
|
|
<label for="name" class="block text-sm font-medium text-gray-700">
|
|
Name *
|
|
</label>
|
|
<input type="text"
|
|
id="name"
|
|
name="name"
|
|
value="{{ old('name') }}"
|
|
required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
@error('name')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- E-Mail -->
|
|
<div>
|
|
<label for="email" class="block text-sm font-medium text-gray-700">
|
|
E-Mail-Adresse *
|
|
</label>
|
|
<input type="email"
|
|
id="email"
|
|
name="email"
|
|
value="{{ old('email') }}"
|
|
required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
@error('email')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Passwort -->
|
|
<div>
|
|
<label for="password" class="block text-sm font-medium text-gray-700">
|
|
Passwort *
|
|
</label>
|
|
<input type="password"
|
|
id="password"
|
|
name="password"
|
|
required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
@error('password')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Passwort bestätigen -->
|
|
<div>
|
|
<label for="password_confirmation" class="block text-sm font-medium text-gray-700">
|
|
Passwort bestätigen *
|
|
</label>
|
|
<input type="password"
|
|
id="password_confirmation"
|
|
name="password_confirmation"
|
|
required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
</div>
|
|
|
|
<!-- Rolle -->
|
|
<div>
|
|
<label for="role" class="block text-sm font-medium text-gray-700">
|
|
Rolle *
|
|
</label>
|
|
<select id="role"
|
|
name="role"
|
|
required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Rolle auswählen</option>
|
|
<option value="tenant_admin" {{ old('role') === 'tenant_admin' ? 'selected' : '' }}>
|
|
Mandanten-Admin
|
|
</option>
|
|
<option value="super_admin" {{ old('role') === 'super_admin' ? 'selected' : '' }}>
|
|
Super Admin
|
|
</option>
|
|
</select>
|
|
@error('role')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Mandant -->
|
|
<div>
|
|
<label for="tenant_id" class="block text-sm font-medium text-gray-700">
|
|
Mandant
|
|
</label>
|
|
<select id="tenant_id"
|
|
name="tenant_id"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Kein Mandant (nur für Super Admins)</option>
|
|
@foreach($tenants as $tenant)
|
|
<option value="{{ $tenant->id }}" {{ old('tenant_id') == $tenant->id ? 'selected' : '' }}>
|
|
{{ $tenant->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
<p class="mt-1 text-sm text-gray-500">
|
|
Mandanten-Admins benötigen einen Mandanten, Super Admins können alle Mandanten verwalten
|
|
</p>
|
|
@error('tenant_id')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Buttons -->
|
|
<div class="flex items-center justify-end space-x-4 pt-4 border-t">
|
|
<a href="{{ route('admin.users.index') }}"
|
|
class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors">
|
|
Abbrechen
|
|
</a>
|
|
<button type="submit"
|
|
class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors">
|
|
Benutzer erstellen
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('role').addEventListener('change', function() {
|
|
const tenantSelect = document.getElementById('tenant_id');
|
|
const isTenantAdmin = this.value === 'tenant_admin';
|
|
|
|
if (isTenantAdmin) {
|
|
tenantSelect.required = true;
|
|
tenantSelect.parentElement.querySelector('label').innerHTML = 'Mandant *';
|
|
} else {
|
|
tenantSelect.required = false;
|
|
tenantSelect.parentElement.querySelector('label').innerHTML = 'Mandant';
|
|
}
|
|
});
|
|
</script>
|
|
@endsection |