Files
laraundfelix/resources/views/shop/checkout.blade.php
T
LarsandClaude Sonnet 5.5 0154182f3b Führe Rabattcodes, Nutzerkreis der Lizenzoption und Pflichtangaben der Kasse ein
Domäne: Rabattcodes mit Geltungsbereich (Warenkorb oder gewählte Ziele) und
Einlösungsberechtigung (allgemein oder freigeschaltete Konten) unabhängig
voneinander; Prüfung bei Eingabe, in jeder Übersicht und unter Sperre vor
Bestellabschluss (Prüfsumme der Übersicht enthält den Rabatt). Rabatt je
Position, Zwischensumme und Zahlbetrag in der Bestellung; Stripe erhält den
Preis nach Rabatt. Nutzerkreis (Einzel-/Mehrfachlizenz, Trainerzahl) an der
Angebotsfassung, kopiert in Bestellposition und Erwerb, Teil der Prüfung
"Bereits erworben". OfferService::activate lehnt Angebote ohne veröffentlichten
Artikelstand ab. Kasse: Zustimmungen als Pflichtangabe mit Nachweis,
"Zahlungspflichtig bestellen", Rechnungsweg für Organisationen, Erstattung über
Stripe, Widerruf erklären. Produktivfreigabe SHOP_LIVE_RELEASE standardmäßig aus.

Bestandstests geändert (fachlich überholt, Assertions nicht abgeschwächt): die
Schaltfläche heißt "Zahlungspflichtig bestellen" (§ 312j BGB), die Summe heißt
"Zu zahlen", der Vereinshinweis steht als Rollenliste; Bestellungen über die
Kasse senden jetzt die Zustimmungen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 19:42:02 +01:00

195 lines
12 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('layouts.site')
@section('title', 'Bestellübersicht')
@section('content')
@php
$money = fn (?int $cents): string => \App\Domain\Commerce\Money::format($cents);
$live = \App\Domain\Commerce\Shop::live();
$missingLegal = \App\Domain\Commerce\SalesTerms::missingPages();
$holderQuery = array_filter(['bestellen_als' => $review->holder?->id]);
@endphp
<h1>Bestellübersicht</h1>
<p class="lede">Prüfe deine Bestellung. Preis und Bedingungen gelten so, wie sie hier stehen.</p>
@unless ($live)
<p class="shop-note shop-draft" role="note">Testbetrieb: Es wird kein echtes Geld bewegt. Rechtstexte und Steuerangaben sind noch nicht freigegeben.</p>
@endunless
@if (session('status'))
<p class="state" role="status">{{ session('status') }}</p>
@endif
@if ($errors->has('checkout') || $errors->has('zustimmung'))
<p class="errors" role="alert">{{ $errors->first('checkout') ?: $errors->first('zustimmung') }}</p>
@endif
@if ($holders->count() > 1)
<form class="shop-holder" method="get" action="{{ route('checkout') }}">
<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
@if ($review->holder)
<dl class="shop-roles">
<div><dt>Lizenzinhaber</dt><dd>{{ $review->holder->display_name }}@if ($review->holder->type->value === 'organisation') (Verein oder Organisation)@endif</dd></div>
<div><dt>Bestellendes Konto</dt><dd>{{ auth()->user()->name }}</dd></div>
<div><dt>Downloadzugriff aus dieser Bestellung</dt><dd>@if ($review->holder->type->value === 'organisation')Nur dieses Konto, nicht weitere Mitglieder des Vereins.@else Dieses Konto.@endif</dd></div>
</dl>
@endif
<ul class="shop-lines shop-order-summary">
@foreach ($review->lines as $line)
@php
$lineDiscount = $review->discountFor($line);
$licence = $line->version ? \App\Domain\Catalog\LicenceScope::label($line->version->licence_scope, $line->version->trainer_count) : null;
@endphp
<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 ($licence)
<p class="shop-licence"><strong>Nutzerkreis:</strong> {{ $licence }}</p>
@endif
@if ($line->state === 'bereits_erworben')
<p class="shop-badge shop-badge-owned">Bereits erworben · Wird nicht mitbestellt</p>
@elseif ($line->blocks())
<p class="shop-badge shop-badge-blocked">{{ $line->state === 'zurueckgezogen' ? 'Nicht mehr erhältlich' : '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 {{ $money($line->seenPriceCents) }}, jetzt {{ $money($line->currentPriceCents) }}.</p>
@elseif ($line->state === 'bedingungen_geaendert')
<p class="shop-badge shop-badge-changed">Bedingungen aktualisiert</p>
<p class="shop-note">{{ $line->note }}</p>
@endif
@if ($lineDiscount > 0)
<p class="shop-badge shop-badge-discount">Rabatt {{ $review->discount->code->code }}: −{{ $money($lineDiscount) }}</p>
@endif
</div>
<div class="shop-line-side">
@if ($line->currentPriceCents !== null)
<p @class(['shop-price', 'is-struck' => $line->state === 'bereits_erworben'])>
@if ($lineDiscount > 0)
<s class="shop-price-old"><span class="sr-only">Listenpreis: </span>{{ $money($line->currentPriceCents) }}</s>
<span class="sr-only">Preis nach Rabatt: </span>{{ $money($line->currentPriceCents - $lineDiscount) }}
@else
<span class="sr-only">Preis: </span>{{ $money($line->currentPriceCents) }}
@endif
</p>
@endif
</div>
</li>
@endforeach
</ul>
<section class="shop-code" aria-labelledby="shop-code-title">
<h2 id="shop-code-title">Rabattcode</h2>
@if ($review->discount?->applied())
<p class="shop-code-applied" role="status">
<strong>{{ $review->discount->code->code }}</strong> ist angewendet
({{ $review->discount->code->valueLabel() }}{{ $review->discount->code->forSelection() ? ', gilt nur für ausgewählte Angebote' : '' }}).
</p>
<form method="post" action="{{ route('checkout.code.remove') }}">
@csrf
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
<button class="button button-quiet" type="submit">Code entfernen</button>
</form>
@else
@if ($review->discount !== null)
<p class="errors" role="alert">Der Code {{ $review->discount->code?->code }} gilt gerade nicht. {{ $review->discount->message }}</p>
<form method="post" action="{{ route('checkout.code.remove') }}">
@csrf
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
<button class="button button-secondary" type="submit">Code entfernen</button>
</form>
@endif
<form class="shop-code-form" method="post" action="{{ route('checkout.code') }}">
@csrf
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
<label for="rabattcode">{{ $review->discount !== null ? 'Anderen Code eingeben' : 'Hast du einen Rabattcode?' }}</label>
<div class="shop-code-row">
<input id="rabattcode" name="code" type="text" autocomplete="off" autocapitalize="characters" spellcheck="false" maxlength="60" aria-describedby="rabattcode-hinweis @error('code') rabattcode-fehler @enderror" value="{{ old('code') }}">
<button class="button button-secondary" type="submit">Code einlösen</button>
</div>
@error('code')
<p class="errors" id="rabattcode-fehler" role="alert">{{ $message }}</p>
@enderror
<p class="shop-note" id="rabattcode-hinweis">Pro Bestellung gilt höchstens ein Code. Er ändert den Preis, nicht den Nutzungsumfang.</p>
</form>
@endif
</section>
<dl class="shop-total shop-total-table">
@if ($review->discountCents() > 0)
<div><dt>Zwischensumme</dt><dd>{{ $money($review->subtotalCents()) }}</dd></div>
<div><dt>Rabatt ({{ $review->discount->code->code }})</dt><dd>−{{ $money($review->discountCents()) }}</dd></div>
@endif
<div class="shop-total-final"><dt>Zu zahlen</dt><dd><strong>{{ $money($review->totalCents()) }}</strong></dd></div>
</dl>
<p class="shop-note">{{ config('shop.price_note') }}</p>
@if ($review->canOrder())
<form class="shop-order-form" method="post" action="{{ route('checkout.place') }}">
@csrf
<input type="hidden" name="digest" value="{{ $review->digest() }}">
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
@if ($invoice)
<fieldset class="shop-pay">
<legend>Zahlungsweg</legend>
<label><input type="radio" name="zahlungsweg" value="online" @checked(old('zahlungsweg', 'online') === 'online')> {{ \App\Domain\Commerce\Shop::stripe() ? 'Online bezahlen (Stripe)' : 'Testzahlung' }}</label>
<label><input type="radio" name="zahlungsweg" value="rechnung" @checked(old('zahlungsweg') === 'rechnung')> Auf Rechnung (Überweisung, auf Anfrage)</label>
<p class="shop-note">Bei Rechnung erstellen wir die Rechnung manuell und senden sie dir. Die Inhalte werden nach Zahlungseingang freigeschaltet.</p>
</fieldset>
@endif
<fieldset class="shop-legal">
<legend>Dein Vertrag</legend>
<p class="shop-note">
Bitte lies vor dem Bestellen:
@foreach ($legalPages as $key => $page)
@php $url = \App\Domain\Commerce\SalesTerms::url($key); @endphp
@if ($url)<a href="{{ $url }}" target="_blank" rel="noopener">{{ $page['label'] }}</a>@else<span class="shop-legal-missing">{{ $page['label'] }} (noch nicht veröffentlicht)</span>@endif{{ $loop->last ? '.' : ',' }}
@endforeach
</p>
@foreach ($consents as $key => $wording)
<label class="shop-consent">
<input type="checkbox" name="zustimmung[{{ $key }}]" value="1" required @checked(old('zustimmung.'.$key))>
<span>{{ $wording }}</span>
</label>
@endforeach
@unless ($live)
<p class="shop-note shop-draft">Entwurf: Der Wortlaut der Zustimmungen ist noch nicht rechtlich geprüft.@if ($missingLegal !== []) Es fehlen veröffentlichte Seiten: {{ implode(', ', $missingLegal) }}.@endif</p>
@endunless
</fieldset>
<div class="shop-actions">
<button class="button" type="submit">{{ \App\Domain\Commerce\SalesTerms::ORDER_BUTTON }}</button>
<a class="button button-secondary" href="{{ route('cart') }}">Zurück zum Warenkorb</a>
</div>
</form>
@else
<div class="shop-actions">
<button class="button" type="button" disabled aria-disabled="true">{{ \App\Domain\Commerce\SalesTerms::ORDER_BUTTON }}</button>
<a class="button button-secondary" href="{{ route('cart') }}">Zurück zum Warenkorb</a>
</div>
<p class="shop-note" role="status">
@if ($review->holder === null)
Für diesen Lizenzinhaber kannst du nicht bestellen. Wähle oben einen anderen Lizenzinhaber oder bestelle als Privatperson.
@elseif ($review->blocked())
Entferne zuerst die Positionen, die nicht bestellt werden können, oder wähle einen passenden Lizenzinhaber.
@elseif ($review->discountBlocks())
Entferne den Rabattcode oder ändere den Warenkorb, damit er passt. Erst dann kannst du bestellen.
@else
Es gibt nichts zu bestellen. Alle Positionen sind bereits erworben.
@endif
</p>
@endif
@endsection