- 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.
115 lines
7.0 KiB
PHP
115 lines
7.0 KiB
PHP
@extends('layouts.site')
|
|
|
|
@section('title', 'Warenkorb')
|
|
|
|
@section('content')
|
|
<h1>Warenkorb</h1>
|
|
|
|
@if ($errors->any())
|
|
<p class="errors" role="alert">{{ $errors->first() }}</p>
|
|
@endif
|
|
|
|
@if ($review->lines === [])
|
|
<div class="empty">
|
|
<h2>Dein Warenkorb ist leer</h2>
|
|
<p>Wähle auf einer Produktseite eine Lizenzoption und lege sie in den Warenkorb.</p>
|
|
<p><a class="button" href="{{ route('shop') }}">Zum Shop</a></p>
|
|
</div>
|
|
@else
|
|
@if ($holders->count() > 1)
|
|
<form class="shop-holder" method="get" action="{{ route('cart') }}">
|
|
<label for="bestellen_als">Bestellen als</label>
|
|
<select id="bestellen_als" name="bestellen_als">
|
|
@foreach ($holders as $holder)
|
|
<option value="{{ $holder->id }}" @selected($review->holder?->id === $holder->id)>{{ $holder->display_name }} ({{ $holder->type->value === 'person' ? 'Privatperson' : 'Verein oder Organisation' }})</option>
|
|
@endforeach
|
|
</select>
|
|
<button class="button button-secondary" type="submit">Übernehmen</button>
|
|
</form>
|
|
@endif
|
|
|
|
<ul class="shop-lines">
|
|
@foreach ($review->lines as $line)
|
|
<li @class(['shop-line', 'is-owned' => $line->state === 'bereits_erworben', 'is-blocked' => $line->blocks()])>
|
|
<div class="shop-line-main">
|
|
<h2>{{ $line->title() }}</h2>
|
|
<p class="shop-line-option">{{ $line->offer->optionName() }}</p>
|
|
|
|
@if ($line->state === 'bereits_erworben')
|
|
<p class="shop-badge shop-badge-owned">Bereits erworben · Wird nicht mitbestellt</p>
|
|
@if ($review->holder?->type->value === 'organisation')
|
|
<p class="shop-note">Dieser Umfang mit denselben Nutzungsrechten gehört dem Verein bereits. Herunterladen kann nur das Konto, das die Lizenz bestellt hat. Die Position geht nicht in die Summe ein.</p>
|
|
@else
|
|
<p class="shop-note">Dieser Umfang mit denselben Nutzungsrechten liegt bereits in der Bibliothek. Die Position geht nicht in die Summe ein.</p>
|
|
@endif
|
|
@elseif ($line->state === 'zurueckgezogen')
|
|
<p class="shop-badge shop-badge-blocked">Nicht mehr erhältlich</p>
|
|
<p class="shop-note">{{ $line->note }}</p>
|
|
@elseif ($line->state === 'falscher_inhaber')
|
|
<p class="shop-badge shop-badge-blocked">Passt nicht zum Lizenzinhaber</p>
|
|
<p class="shop-note">{{ $line->note }}</p>
|
|
@elseif ($line->state === 'preis_geaendert')
|
|
<p class="shop-badge shop-badge-changed">Preis geändert</p>
|
|
<p class="shop-note">Bisher {{ \App\Domain\Commerce\Money::format($line->seenPriceCents) }}, jetzt {{ \App\Domain\Commerce\Money::format($line->currentPriceCents) }}. Du kannst zum neuen Preis bestellen oder die Position entfernen.</p>
|
|
@elseif ($line->state === 'bedingungen_geaendert')
|
|
<p class="shop-badge shop-badge-changed">Bedingungen aktualisiert</p>
|
|
<p class="shop-note">{{ $line->note }}</p>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="shop-line-side">
|
|
@if ($line->currentPriceCents !== null)
|
|
<p @class(['shop-price', 'is-struck' => $line->state === 'bereits_erworben'])>
|
|
@if ($line->state === 'preis_geaendert')
|
|
<s class="shop-price-old"><span class="sr-only">Bisheriger Preis: </span>{{ \App\Domain\Commerce\Money::format($line->seenPriceCents) }}</s>
|
|
@endif
|
|
<span class="sr-only">{{ $line->state === 'preis_geaendert' ? 'Neuer Preis: ' : 'Preis: ' }}</span>{{ \App\Domain\Commerce\Money::format($line->currentPriceCents) }}
|
|
</p>
|
|
@endif
|
|
<div class="shop-actions">
|
|
@if (in_array($line->state, ['preis_geaendert', 'bedingungen_geaendert'], true))
|
|
<form method="post" action="{{ route('cart.accept', $line->offer) }}">
|
|
@csrf
|
|
<button class="button button-secondary" type="submit">{{ $line->state === 'preis_geaendert' ? 'Neuen Preis übernehmen' : 'Neue Bedingungen übernehmen' }}<span class="sr-only">: {{ $line->offer->optionName() }}</span></button>
|
|
</form>
|
|
@endif
|
|
@if ($line->state === 'bereits_erworben' && $review->holder?->type->value !== 'organisation')
|
|
<a class="button button-secondary" href="{{ route('member.library') }}">Zur Bibliothek</a>
|
|
@endif
|
|
<form method="post" action="{{ route('cart.remove', $line->offer) }}">
|
|
@csrf
|
|
<button class="button button-quiet" type="submit">Entfernen<span class="sr-only">: {{ $line->offer->optionName() }}</span></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
|
|
<div class="shop-total">
|
|
<p><span>Summe</span> <strong>{{ \App\Domain\Commerce\Money::format($review->totalCents()) }}</strong></p>
|
|
<p class="shop-note">Testzahlung. Es wird kein echtes Geld bewegt.</p>
|
|
</div>
|
|
|
|
@if ($review->blocked())
|
|
<p class="shop-note" role="status">Entferne die Positionen, die nicht bestellt werden können, oder wähle einen passenden Lizenzinhaber. Die übrigen Positionen bleiben bestellbar.</p>
|
|
@elseif ($review->empty())
|
|
<p class="shop-note" role="status">Es gibt nichts zu bestellen: Alle Positionen sind bereits erworben. Du kannst sie entfernen oder die Bibliothek öffnen.</p>
|
|
@endif
|
|
|
|
@if (! $review->blocked() && ! $review->empty())
|
|
@auth
|
|
<a class="button" href="{{ route('checkout', array_filter(['bestellen_als' => $review->holder?->id])) }}">Zur Kasse</a>
|
|
@else
|
|
<p class="shop-note">Für die Bestellung brauchst du ein Konto. Dein Warenkorb bleibt dabei erhalten.</p>
|
|
<p class="shop-actions">
|
|
<a class="button" href="{{ route('checkout') }}">Anmelden und zur Kasse</a>
|
|
<a class="button button-secondary" href="{{ route('register') }}">Registrieren</a>
|
|
</p>
|
|
@endauth
|
|
@else
|
|
<button class="button" type="button" disabled aria-disabled="true">Zur Kasse</button>
|
|
@endif
|
|
@endif
|
|
@endsection
|