Reihenfolge

This commit is contained in:
Stefan Zwischenbrugger 2026-03-29 21:46:26 +02:00
parent 635a0ec28a
commit 42f86e9a2e
2 changed files with 73 additions and 72 deletions

View File

@ -26,6 +26,7 @@ DB_CONNECTION=sqlite
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
# Nach Umstellung auf mysql: einmal "php artisan migrate" (sonst fehlen u.a. shopping_lists).
SESSION_DRIVER=database
SESSION_LIFETIME=120

View File

@ -28,78 +28,6 @@
</div>
@endif
<div class="bg-white overflow-hidden shadow-sm sm:rounded-xl p-4 sm:p-6">
<h3 class="text-lg font-semibold mb-2">Aktuelle Liste</h3>
<p class="text-sm text-gray-600 mb-3">
<span class="font-medium text-gray-800">{{ $currentList->name }}</span>
@if($currentList->owner_id === auth()->id())
<span class="text-gray-500">(du bist Besitzer)</span>
@else
<span class="text-gray-500">(geteilt von {{ $currentList->owner->name }})</span>
@endif
</p>
@if($accessibleLists->count() > 1)
<form method="POST" action="{{ route('shopping-lists.switch', $currentList) }}" id="shopping-list-switch-form" class="flex flex-col sm:flex-row gap-2 items-stretch sm:items-center sm:flex-wrap">
@csrf
<label for="list-switch" class="text-sm text-gray-600 shrink-0">Wechseln zu:</label>
<select
id="list-switch"
class="rounded-md border-gray-300 text-sm min-h-[44px] max-w-md flex-1"
onchange="this.form.action = '{{ url('/shopping-lists') }}/' + this.value + '/switch'; this.form.requestSubmit();"
>
@foreach($accessibleLists as $list)
<option value="{{ $list->id }}" @selected($list->id === $currentList->id)>
{{ $list->name }} @if($list->owner_id === auth()->id()) (Besitzer) @else ({{ $list->owner->name }}) @endif
</option>
@endforeach
</select>
</form>
<p class="text-xs text-gray-500 mt-2">Nach Auswahl wird die Seite neu geladen.</p>
@endif
</div>
@can('manageMembers', $currentList)
<div class="bg-white overflow-hidden shadow-sm sm:rounded-xl p-4 sm:p-6">
<h3 class="text-lg font-semibold mb-2">Liste teilen</h3>
<p class="text-sm text-gray-600 mb-3">Weitere Personen koennen dieselbe Liste bearbeiten. Sie muessen bereits ein Konto registriert haben.</p>
<form method="POST" action="{{ route('shopping-lists.members.store', $currentList) }}" class="flex flex-col sm:flex-row gap-2 mb-6">
@csrf
<input
type="email"
name="email"
value="{{ old('email') }}"
placeholder="E-Mail-Adresse des Benutzers"
class="flex-1 rounded-md border-gray-300 shadow-sm min-h-[44px] text-base"
autocomplete="email"
>
<button type="submit" class="shrink-0 rounded-md bg-indigo-600 text-white px-5 min-h-[44px] text-base font-medium hover:bg-indigo-700">
Einladen
</button>
</form>
<h4 class="text-sm font-semibold text-gray-800 mb-2">Mitglieder</h4>
<ul class="divide-y divide-gray-100 border border-gray-200 rounded-lg">
@foreach($members as $member)
<li class="flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm">
<div>
<span class="font-medium text-gray-900">{{ $member->name }}</span>
<span class="text-gray-500">{{ $member->email }}</span>
@if($member->id === $currentList->owner_id)
<span class="ml-2 text-xs text-gray-500">Besitzer</span>
@endif
</div>
@if($member->id !== $currentList->owner_id)
<form method="POST" action="{{ route('shopping-lists.members.destroy', [$currentList, $member]) }}" onsubmit="return confirm('Zugriff entfernen?');">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-800 text-sm font-medium">Entfernen</button>
</form>
@endif
</li>
@endforeach
</ul>
</div>
@endcan
<div class="bg-white overflow-hidden shadow-sm sm:rounded-xl p-4 sm:p-6">
<h3 class="text-lg font-semibold mb-3">Neuer Eintrag</h3>
<p class="text-sm text-gray-600 mb-3">Nur Namen eingeben, mit <kbd class="px-1 bg-gray-100 rounded text-xs">Enter</kbd> speichern.</p>
@ -257,6 +185,78 @@
<span>{{ number_format((float) $totalAll, 2, ',', '.') }} EUR</span>
</div>
</div>
<div class="bg-white overflow-hidden shadow-sm sm:rounded-xl p-4 sm:p-6">
<h3 class="text-lg font-semibold mb-2">Aktuelle Liste</h3>
<p class="text-sm text-gray-600 mb-3">
<span class="font-medium text-gray-800">{{ $currentList->name }}</span>
@if($currentList->owner_id === auth()->id())
<span class="text-gray-500">(du bist Besitzer)</span>
@else
<span class="text-gray-500">(geteilt von {{ $currentList->owner->name }})</span>
@endif
</p>
@if($accessibleLists->count() > 1)
<form method="POST" action="{{ route('shopping-lists.switch', $currentList) }}" id="shopping-list-switch-form" class="flex flex-col sm:flex-row gap-2 items-stretch sm:items-center sm:flex-wrap">
@csrf
<label for="list-switch" class="text-sm text-gray-600 shrink-0">Wechseln zu:</label>
<select
id="list-switch"
class="rounded-md border-gray-300 text-sm min-h-[44px] max-w-md flex-1"
onchange="this.form.action = '{{ url('/shopping-lists') }}/' + this.value + '/switch'; this.form.requestSubmit();"
>
@foreach($accessibleLists as $list)
<option value="{{ $list->id }}" @selected($list->id === $currentList->id)>
{{ $list->name }} @if($list->owner_id === auth()->id()) (Besitzer) @else ({{ $list->owner->name }}) @endif
</option>
@endforeach
</select>
</form>
<p class="text-xs text-gray-500 mt-2">Nach Auswahl wird die Seite neu geladen.</p>
@endif
</div>
@can('manageMembers', $currentList)
<div class="bg-white overflow-hidden shadow-sm sm:rounded-xl p-4 sm:p-6">
<h3 class="text-lg font-semibold mb-2">Liste teilen</h3>
<p class="text-sm text-gray-600 mb-3">Weitere Personen koennen dieselbe Liste bearbeiten. Sie muessen bereits ein Konto registriert haben.</p>
<form method="POST" action="{{ route('shopping-lists.members.store', $currentList) }}" class="flex flex-col sm:flex-row gap-2 mb-6">
@csrf
<input
type="email"
name="email"
value="{{ old('email') }}"
placeholder="E-Mail-Adresse des Benutzers"
class="flex-1 rounded-md border-gray-300 shadow-sm min-h-[44px] text-base"
autocomplete="email"
>
<button type="submit" class="shrink-0 rounded-md bg-indigo-600 text-white px-5 min-h-[44px] text-base font-medium hover:bg-indigo-700">
Einladen
</button>
</form>
<h4 class="text-sm font-semibold text-gray-800 mb-2">Mitglieder</h4>
<ul class="divide-y divide-gray-100 border border-gray-200 rounded-lg">
@foreach($members as $member)
<li class="flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm">
<div>
<span class="font-medium text-gray-900">{{ $member->name }}</span>
<span class="text-gray-500">{{ $member->email }}</span>
@if($member->id === $currentList->owner_id)
<span class="ml-2 text-xs text-gray-500">Besitzer</span>
@endif
</div>
@if($member->id !== $currentList->owner_id)
<form method="POST" action="{{ route('shopping-lists.members.destroy', [$currentList, $member]) }}" onsubmit="return confirm('Zugriff entfernen?');">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-800 text-sm font-medium">Entfernen</button>
</form>
@endif
</li>
@endforeach
</ul>
</div>
@endcan
</div>
</div>
</x-app-layout>