Biete in der Shopliste Auswahl, Reihenfolge, Listenansicht und Seiten
CI Feature / test (push) Successful in 6m4s

- ShopCatalog::listing mit Auswahl nach Thema, Materialart, Eignung und Nutzerkreis, Reihenfolge, Ansicht und Seiten
- Listenansicht shop/zeile, gemeinsame Liste fuer Shopseite und Widget (Variante Liste, Einstellung Auswahl fuer Besucher)
- Werte aus dem Abfragetext werden gegen vorhandene Werte geprueft, Felder als Liste und Zahlen ausserhalb des Bereichs sind harmlos
- Suchfeld heisst nach dem Umbau Zurücksetzen statt Suche zuruecksetzen (Test bewusst angepasst)
- ADR-57

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-26 08:35:33 +01:00
1 parent 95a888d1ca
commit f0ffb47210
15 files changed
+651 -73

No files matched your search

+1 -22
View File
@@ -6,26 +6,5 @@
<h1>Shop</h1>
<p class="lede">Hier findest du kaufbare Produkte und Pakete. Jede Kachel öffnet die Produktseite mit Inhalt und den verfügbaren Lizenzoptionen.</p>
<form class="shop-search" method="get" action="{{ route('shop') }}" role="search">
<label for="shop-suche">Shop durchsuchen</label>
<input id="shop-suche" type="search" name="suche" value="{{ $term }}" autocomplete="off">
<button class="button" type="submit">Suchen</button>
@if ($term !== '')
<a class="button button-quiet" href="{{ route('shop') }}">Suche zurücksetzen</a>
@endif
</form>
@if ($cards === [])
<div class="empty">
<h2>{{ $term !== '' ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h2>
<p>{{ $term !== '' ? 'Zu „'.$term.'“ gibt es keine kaufbaren Produkte. Prüfe die Schreibweise oder setze die Suche zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
</div>
@else
<p class="shop-count" role="status">{{ count($cards) }} {{ count($cards) === 1 ? 'Produkt' : 'Produkte' }}</p>
<ul class="shop-tiles">
@foreach ($cards as $card)
@include('shop.kachel', ['card' => $card])
@endforeach
</ul>
@endif
@include('shop.liste', ['listing' => $listing, 'action' => route('shop'), 'uid' => 'seite'])
@endsection
+89
View File
@@ -0,0 +1,89 @@
{{--
Die Produktliste des Shops: Suche, Auswahl (Säule, Materialart, Eignung, Nutzerkreis), Reihenfolge, Ansicht und Seiten.
Parameter: $listing (ShopCatalog::listing), $action (Adresse der Seite, an die das Formular sendet), $uid (Kennung
für die Feldnamen). Die Auswahl steht im Abfragetext; ohne Script bleibt alles bedienbar.
--}}
@php
$keep = ['suche', 'saeule', 'art', 'eignung', 'kreis', 'sort', 'ansicht'];
$link = fn (array $extra): string => $action.'?'.http_build_query(array_filter(array_merge(request()->only($keep), $extra), fn ($value): bool => $value !== null && $value !== ''));
$chosen = $listing['chosen'];
$facets = $listing['facets'];
$active = count(array_filter($chosen, fn ($value): bool => $value !== null)) + ($listing['term'] !== '' ? 1 : 0);
@endphp
@if ($listing['filters'])
<form class="shop-search shop-filter" method="get" action="{{ $action }}" role="search" aria-label="Shop durchsuchen und filtern">
<div class="shop-filter-field shop-filter-search">
<label for="shop-suche-{{ $uid }}">Shop durchsuchen</label>
<input id="shop-suche-{{ $uid }}" type="search" name="suche" value="{{ $listing['term'] }}" maxlength="100" autocomplete="off">
</div>
@foreach ([['saeule', 'pillar', 'Thema'], ['art', 'kind', 'Materialart'], ['eignung', 'holder', 'Geeignet für'], ['kreis', 'scope', 'Nutzerkreis']] as [$name, $facet, $label])
@if ($facets[$facet] !== [])
<div class="shop-filter-field">
<label for="shop-{{ $name }}-{{ $uid }}">{{ $label }}</label>
<select id="shop-{{ $name }}-{{ $uid }}" name="{{ $name }}">
<option value="">Alle</option>
@foreach ($facets[$facet] as $value => $text)
<option value="{{ $value }}" @selected((string) ($chosen[$facet] ?? '') === (string) $value)>{{ $text }}</option>
@endforeach
</select>
</div>
@endif
@endforeach
<div class="shop-filter-field">
<label for="shop-sort-{{ $uid }}">Reihenfolge</label>
<select id="shop-sort-{{ $uid }}" name="sort">
<option value="">Standard</option>
@foreach (\App\Domain\Commerce\ShopCatalog::SORTS as $value => $text)
<option value="{{ $value }}" @selected(($listing['sort'] ?? '') === $value)>{{ $text }}</option>
@endforeach
</select>
</div>
<input type="hidden" name="ansicht" value="{{ $listing['view'] }}">
<div class="shop-filter-actions">
<button class="button" type="submit">Anwenden</button>
@if ($active > 0)
<a class="button button-quiet" href="{{ $action }}?ansicht={{ $listing['view'] }}">Zurücksetzen</a>
@endif
</div>
</form>
<div class="shop-viewbar">
<p class="shop-count" role="status">{{ $listing['total'] }} {{ $listing['total'] === 1 ? 'Produkt' : 'Produkte' }}@if ($listing['pages'] > 1), Seite {{ $listing['page'] }} von {{ $listing['pages'] }}@endif</p>
<p class="shop-view" aria-label="Ansicht">
<a href="{{ $link(['ansicht' => 'kacheln', 'seite' => null]) }}" @if ($listing['view'] === 'kacheln') aria-current="true" @endif>Kacheln</a>
<a href="{{ $link(['ansicht' => 'liste', 'seite' => null]) }}" @if ($listing['view'] === 'liste') aria-current="true" @endif>Liste</a>
</p>
</div>
@elseif ($listing['cards'] !== [])
<p class="shop-count" role="status">{{ $listing['total'] }} {{ $listing['total'] === 1 ? 'Produkt' : 'Produkte' }}</p>
@endif
@if ($listing['cards'] === [])
<div class="empty">
<h3>{{ $active > 0 ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h3>
<p>{{ $active > 0 ? 'Zu dieser Auswahl gibt es keine kaufbaren Produkte. Ändere die Auswahl oder setze sie zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
</div>
@elseif ($listing['view'] === 'liste')
<ul class="shop-rows">
@foreach ($listing['cards'] as $card)
@include('shop.zeile', ['card' => $card])
@endforeach
</ul>
@else
<ul class="shop-tiles">
@foreach ($listing['cards'] as $card)
@include('shop.kachel', ['card' => $card])
@endforeach
</ul>
@endif
@if ($listing['pages'] > 1)
<nav class="shop-pages" aria-label="Seiten">
@if ($listing['page'] > 1)
<a href="{{ $link(['seite' => $listing['page'] - 1]) }}" rel="prev">Zurück</a>
@endif
<span>Seite {{ $listing['page'] }} von {{ $listing['pages'] }}</span>
@if ($listing['page'] < $listing['pages'])
<a href="{{ $link(['seite' => $listing['page'] + 1]) }}" rel="next">Weiter</a>
@endif
</nav>
@endif
+31
View File
@@ -0,0 +1,31 @@
{{--
Ein Produkt in der Listenansicht. Die Zeile trägt dieselben Angaben wie die Kachel: kleines Bild oder Symbol, Art,
Marker mit Wort, Titel als Link, Kurztext, Themen und Preis.
--}}
<li class="shop-row">
<div class="shop-row-media @if ($card['image'] === null) is-placeholder @endif" aria-hidden="true">
@if ($card['image'] !== null)
<img src="{{ $card['image']['url'] }}" alt="" loading="lazy" decoding="async">
@elseif ($card['symbol'] !== null)
<x-brand.symbol :name="$card['symbol']" class="shop-row-symbol" />
@endif
</div>
<div class="shop-row-body">
<p class="shop-tile-kind">
@if ($card['kind_label'] !== '')<span>{{ $card['kind_label'] }}</span>@endif
@foreach ($card['markers'] as $marker)
<span class="shop-marker shop-marker-{{ $marker['key'] }}">{{ $marker['label'] }}</span>
@endforeach
</p>
<h2><a href="{{ $card['url'] }}">{{ $card['title'] }}</a></h2>
@if ($card['teaser'] !== '')<p class="shop-tile-teaser">{{ $card['teaser'] }}</p>@endif
@if ($card['pillars'] !== [])
<ul class="shop-tile-pillars" aria-label="Themen">
@foreach (array_slice($card['pillars'], 0, 3) as $pillar)
<li>{{ $pillar }}</li>
@endforeach
</ul>
@endif
</div>
<p class="shop-row-price">ab {{ $card['from'] }}<span>{{ $card['count'] }} {{ $card['count'] === 1 ? 'Lizenzoption' : 'Lizenzoptionen' }}</span></p>
</li>