- Implement OfferOptionAdminTest to validate offer option management, including price display, activation, and cancellation. - Create OrganizationPurchaseTest to ensure correct handling of organization purchases, including access control and order processing. - Add ShopProductPageTest to verify shop product listings, search functionality, and product page details. - Introduce BuildsShop trait for seeding test data related to shop functionality. - Implement MoneyTest to validate money parsing and formatting, ensuring correct handling of euro amounts.
65 lines
3.5 KiB
PHP
65 lines
3.5 KiB
PHP
{{--
|
|
Kaufbare Lizenzoptionen unter dem fachlichen Inhalt einer Produktseite.
|
|
Parameter: $options (ProductOptions), $cart (Cart), $switchTo (Angebotskennung eines ausstehenden Wechsels)
|
|
--}}
|
|
@if ($options !== [])
|
|
<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>
|
|
|
|
@if ($errors->has('shop'))
|
|
<p class="errors" role="alert">{{ $errors->first('shop') }}</p>
|
|
@endif
|
|
|
|
@if ($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="{{ route('public.program', $wanted['offer']->composition_id) }}">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>
|
|
</dl>
|
|
<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 ($cart->has($option['offer']))
|
|
<p class="shop-in-cart">Im Warenkorb. <a href="{{ route('cart') }}">Zum Warenkorb</a></p>
|
|
@else
|
|
<form method="post" action="{{ route('cart.add', $option['offer']) }}">
|
|
@csrf
|
|
<button class="button" type="submit">In den Warenkorb<span class="sr-only">: {{ $option['name'] }}</span></button>
|
|
</form>
|
|
@endif
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
</section>
|
|
@endif
|