Files
WitShop/resources/views/admin/admins/form.blade.php
T
marcoandClaude Sonnet 4.6 685bd0fa9f
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 6s
Add admin user management (create, edit, password change, delete)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 18:59:59 +02:00

61 lines
2.7 KiB
PHP

@extends('layouts.admin')
@section('title', $admin ? 'Admin bearbeiten' : 'Neuer Admin')
@section('content')
<div class="max-w-lg">
<h1 class="text-2xl font-bold mb-6">{{ $admin ? 'Admin bearbeiten' : 'Neuer Admin-Benutzer' }}</h1>
<form method="POST" action="{{ $admin ? route('admin.admins.update', $admin) : route('admin.admins.store') }}" class="bg-white border rounded-lg p-6 space-y-4">
@csrf
@if($admin) @method('PUT') @endif
@if($errors->any())
<div class="bg-red-50 border border-red-200 rounded p-3 text-sm text-red-700">
@foreach($errors->all() as $e)<div>• {{ $e }}</div>@endforeach
</div>
@endif
<div>
<label class="block text-sm font-medium mb-1">Name *</label>
<input type="text" name="name" value="{{ old('name', $admin?->name) }}"
class="w-full border rounded px-3 py-2 text-sm" required>
</div>
<div>
<label class="block text-sm font-medium mb-1">E-Mail *</label>
<input type="email" name="email" value="{{ old('email', $admin?->email) }}"
class="w-full border rounded px-3 py-2 text-sm" required>
</div>
<div>
<label class="block text-sm font-medium mb-1">Rolle *</label>
<select name="role" class="w-full border rounded px-3 py-2 text-sm">
<option value="admin" {{ old('role', $admin?->role) === 'admin' ? 'selected' : '' }}>Admin</option>
<option value="super_admin" {{ old('role', $admin?->role) === 'super_admin' ? 'selected' : '' }}>Super-Admin</option>
</select>
</div>
<div class="border-t pt-4">
<label class="block text-sm font-medium mb-1">
{{ $admin ? 'Neues Passwort (leer lassen = unverändert)' : 'Passwort *' }}
</label>
<input type="password" name="password"
class="w-full border rounded px-3 py-2 text-sm"
{{ $admin ? '' : 'required' }}>
</div>
<div>
<label class="block text-sm font-medium mb-1">Passwort bestätigen</label>
<input type="password" name="password_confirmation"
class="w-full border rounded px-3 py-2 text-sm">
</div>
<div class="flex gap-3 pt-2">
<button type="submit" class="bg-blue-600 text-white px-5 py-2 rounded-lg hover:bg-blue-700 text-sm font-medium">
{{ $admin ? 'Speichern' : 'Anlegen' }}
</button>
<a href="{{ route('admin.admins.index') }}" class="px-5 py-2 border rounded-lg text-sm hover:bg-gray-50">Abbrechen</a>
</div>
</form>
</div>
@endsection