Files
laraundfelix/resources/views/shop/optionen.blade.php
T
LarsandClaude Sonnet 5.5 3d76062097
CI Feature / test (push) Successful in 3m23s
Deploy Test / test (push) Successful in 3m22s
Deploy Test / deploy (push) Successful in 30s
Trenne Shop sichtbar und Checkout offen und kaufe nur noch ueber die Kasse
- Zwei Schalter: Shop::visible (SHOP_PUBLIC) und Shop::checkoutOpen; ist der Shop nur sichtbar,
  fuehren Warenkorb, Kasse und Jetzt kaufen auf eine Hinweisseite (noindex), ohne Warenkorb und Bestellung
- Einzelkauf (Checkout::place, Route member.offers.buy) entfernt; Bestellung nur aus dem Warenkorb
- Jetzt kaufen an der Produktseite oeffnet die Bestellübersicht, Bereits erworben auf der Produktseite
- Menuepunkte in den Shop nur bei sichtbarem Shop, /angebote leitet auf /shop, Seeder fuehrt Shop
- Mitgliederseite Angebote zeigt nur kostenlose Angebote zum Uebernehmen
- Middleware EnsureCheckoutOpen laeuft vor der Anmeldepruefung
- Plan und ADR-53, DEPLOYMENT.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-26 07:17:25 +01:00

91 lines
5.3 KiB
PHP

{{--
Kaufbare Lizenzoptionen unter dem fachlichen Inhalt einer Produktseite.
Parameter: $options (ProductOptions), $cart (Cart), $switchTo (Angebotskennung eines ausstehenden Wechsels)
--}}
@if ($options !== [])
@php
// Schalter 2: Ist der Checkout noch nicht freigegeben, führt „Kaufen“ auf die Hinweisseite statt in den Warenkorb.
$open = \App\Domain\Commerce\Shop::checkoutOpen();
$owned = $open ? $cart->ownedAmong(auth()->user(), array_column($options, 'offer')) : [];
@endphp
<section class="shop-options" aria-labelledby="shop-options-title">
<h2 id="shop-options-title">Lizenzoptionen</h2>
<p class="shop-options-lede">Wähle die Lizenz, die zu deiner Nutzung passt. Jede Option ist einzeln kaufbar. Preis und Bedingungen gelten ab dem Bestellabschluss; es wird nichts reserviert.</p>
@unless ($open)
<p class="shop-closed-note ui-notice ui-notice-warning" role="note">Der Kauf ist noch nicht freigeschaltet und startet zum Verkaufsstart. Du kannst dir Umfang und Preise schon ansehen.</p>
@endunless
@if ($errors->has('shop'))
<p class="errors" role="alert">{{ $errors->first('shop') }}</p>
@endif
@if ($open && $switchTo)
@php
$wanted = collect($options)->first(fn ($option) => $option['offer']->id === (int) $switchTo);
$current = $wanted ? $cart->alternativeTo($wanted['offer']) : null;
@endphp
@if ($wanted && $current)
<div class="shop-switch ui-notice ui-notice-warning" role="region" aria-labelledby="shop-switch-title">
<p id="shop-switch-title" class="ui-notice-title">Optionen wechseln?</p>
<p>In deinem Warenkorb liegt bereits „{{ $current->optionName() }}“. Diese Produktseite wird nur mit einer Option bestellt. Möchtest du zu „{{ $wanted['name'] }}“ wechseln?</p>
<div class="shop-actions">
<form method="post" action="{{ route('cart.switch', $wanted['offer']) }}">
@csrf
<button class="button" type="submit">Zu „{{ $wanted['name'] }}“ wechseln</button>
</form>
<a class="button button-secondary" href="{{ app(\App\Domain\Commerce\ProductOptions::class)->pageUrl($wanted['offer']) }}">Bei „{{ $current->optionName() }}“ bleiben</a>
</div>
</div>
@endif
@endif
<ul class="shop-option-list">
@foreach ($options as $option)
<li class="shop-option">
<h3>{{ $option['name'] }}</h3>
<p class="shop-price"><span class="sr-only">Preis: </span>{{ $option['price'] }}</p>
<dl class="shop-facts">
<div><dt>Geeignet für</dt><dd>{{ $option['for'] }}</dd></div>
<div><dt>Laufzeit</dt><dd>{{ $option['term'] }}</dd></div>
<div><dt>Nutzerkreis</dt><dd>{{ $option['licence'] }}</dd></div>
</dl>
@if ($option['licence_note'])
<p class="shop-note">{{ $option['licence_note'] }}</p>
@endif
<h4>Umfang und Nutzungsrechte</h4>
<ul class="shop-scope">
@foreach ($option['scope'] as $item)
<li>
<strong>{{ $item['article'] }}</strong>
<span>{{ $item['purpose'] }}@if ($item['rights'] !== []): {{ implode(', ', $item['rights']) }}@endif</span>
</li>
@endforeach
</ul>
@if (! $open)
<p><a class="button" href="{{ route('shop.closed') }}">Kaufen<span class="sr-only">: {{ $option['name'] }}</span></a></p>
@elseif (isset($owned[$option['offer']->id]))
<p class="shop-badge shop-badge-owned">Bereits erworben · Du findest die Lizenz in deiner Bibliothek.</p>
@else
@if ($cart->has($option['offer']))
<p class="shop-in-cart">Im Warenkorb. <a href="{{ route('cart') }}">Zum Warenkorb</a></p>
@endif
<div class="shop-actions">
<form method="post" action="{{ route('cart.buy', $option['offer']) }}">
@csrf
<button class="button" type="submit">Jetzt kaufen<span class="sr-only">: {{ $option['name'] }}</span></button>
</form>
@unless ($cart->has($option['offer']))
<form method="post" action="{{ route('cart.add', $option['offer']) }}">
@csrf
<button class="button button-secondary" type="submit">In den Warenkorb<span class="sr-only">: {{ $option['name'] }}</span></button>
</form>
@endunless
</div>
@endif
</li>
@endforeach
</ul>
</section>
@endif