id = $id; $pr = $this->getMyPR(); $this->authorize('view', $pr); } public function submitForReview(): void { $pr = $this->getMyPR(); $this->authorize('submitForReview', $pr); try { app(PressReleaseService::class)->submitForReview($pr); } catch (BlacklistViolationException $e) { Flux::modal('confirm-submit-review')->close(); Flux::toast( heading: __('Automatisch abgelehnt'), text: __('Unzulässiges Wort gefunden: ":word". Bitte überarbeiten.', ['word' => $e->word]), variant: 'danger', duration: 8000, ); return; } catch (BookingRequiredException|QuotaExceededException $e) { Flux::modal('confirm-submit-review')->close(); Flux::toast( heading: __('Nicht eingereicht'), text: $e->getMessage(), variant: 'warning', duration: 8000, ); return; } Flux::modal('confirm-submit-review')->close(); Flux::toast( heading: __('Eingereicht'), text: __('Die Redaktion prüft die Pressemitteilung typischerweise innerhalb von 24 h.'), variant: 'success', ); } public function generateShareLink(MagicLinkGenerator $generator): void { $pr = $this->getMyPR(); $this->authorize('view', $pr); $share = $generator->createPressReleaseShareLink($pr, auth()->user()); $this->shareUrl = $share['url']; $this->shareExpiresAt = $share['expires_at']->format('d.m.Y H:i'); Flux::toast(text: __('Vorschau-Link wurde erzeugt.'), variant: 'success'); } /** * Boost (Platzierung) aus der Wallet buchen — nur veröffentlichte, grüne * PMs sind boostbar (Gate im BoostService). */ public function buyBoost(int $days): void { $pr = $this->getMyPR(); $this->authorize('view', $pr); try { app(BoostService::class)->boost(auth()->user(), $pr, $days); Flux::toast( heading: __('Boost gebucht'), text: __('Ihre Pressemitteilung wird jetzt auf Start- und Branchenseite hervorgehoben.'), variant: 'success', ); } catch (InsufficientCreditsException $e) { Flux::toast( heading: __('Nicht genügend Credits'), text: __('Der Boost kostet :need Credits, Ihr Guthaben beträgt :have. Laden Sie unter „Buchungen & Add-ons" auf.', ['need' => $e->required, 'have' => $e->available]), variant: 'warning', duration: 8000, ); } catch (BoostNotAllowedException $e) { Flux::toast(text: $e->getMessage(), variant: 'warning', duration: 8000); } } /** * Veröffentlichungsnachweis-PDF kaufen (3 Credits, einmalig je PM). Danach * steht der Download über die Nachweis-Route bereit. */ public function buyProof(): void { $pr = $this->getMyPR(); $this->authorize('downloadProof', $pr); try { app(ProofPdfService::class)->purchase(auth()->user(), $pr); Flux::toast( heading: __('Nachweis gekauft'), text: __('Der Veröffentlichungsnachweis steht jetzt zum Download bereit.'), variant: 'success', ); } catch (InsufficientCreditsException $e) { Flux::toast( heading: __('Nicht genügend Credits'), text: __('Der Nachweis kostet :need Credits, Ihr Guthaben beträgt :have.', ['need' => $e->required, 'have' => $e->available]), variant: 'warning', duration: 8000, ); } } public function with(): array { $pr = $this->getMyPR(); $this->authorize('view', $pr); $categoryName = $pr->category?->translations->firstWhere('locale', 'de')?->name ?? '–'; $latestRejection = null; if ($pr->status->value === 'rejected') { $latestRejection = $pr->statusLogs ->firstWhere(fn ($log) => $log->to_status?->value === 'rejected'); } $cover = app(PressReleaseCoverImage::class); $user = auth()->user(); $company = $pr->company?->loadCount(['pressReleases', 'contacts']); $boostService = app(BoostService::class); $proofService = app(ProofPdfService::class); return [ 'pr' => $pr, 'creditBalance' => $user->creditBalance(), 'canBoost' => $boostService->canBoost($pr), 'isBoosted' => $boostService->isBoosted($pr), 'boostedUntil' => $boostService->activeUntil($pr), 'boostOptions' => app(CreditPricingService::class)->boostOptions(), 'proofPrice' => $proofService->priceCredits(), 'proofPurchased' => $proofService->hasPurchased($user, $pr), 'companyLogoUrl' => $company?->logoUrl(), 'companyInitials' => $this->companyInitials($company?->name), 'companyMetaLine' => $this->companyMetaLine($company), 'categoryName' => $categoryName, 'coverUrl' => $cover->coverUrl($pr, 'cover'), 'coverIsPlaceholder' => $cover->coverIsPlaceholder($pr), 'titleImage' => $pr->images()->orderByDesc('is_preview')->orderBy('sort_order')->orderBy('id')->first(), 'quotaTotal' => $user->pressReleaseQuotaTotal(), 'quotaRemaining' => $user->pressReleaseQuotaRemaining(), 'canEdit' => auth()->user()->can('update', $pr) && in_array($pr->status->value, ['draft', 'rejected']), // Einreichen zur Prüfung ist hinter eine bezahlte Buchung gegated // (Decision-Update §5.1, Schalter billing.enforce_booking). 'hasActiveBooking' => $user->hasActiveBooking(), 'latestRejection' => $latestRejection, 'contacts' => $pr->contacts, 'statusLogs' => $pr->statusLogs, 'statusColor' => match($pr->status->value) { 'published' => 'green', 'review' => 'yellow', 'rejected' => 'red', 'archived' => 'blue', default => 'zinc', }, ]; } /** * Initialen für die Logo-Kachel (analog zur Firmenübersicht). */ private function companyInitials(?string $name): string { $name = trim((string) $name); if ($name === '') { return '–'; } $letters = collect(preg_split('/\s+/u', $name) ?: []) ->map(fn (string $word): string => mb_substr($word, 0, 1)) ->filter() ->take(2) ->implode(''); return mb_strtoupper($letters ?: mb_substr($name, 0, 2)); } /** * Kompakte Meta-Zeile: Ort (letzte Adresszeile) · Firmentyp. */ private function companyMetaLine(?\App\Models\Company $company): string { if (! $company) { return ''; } $parts = []; $lastAddressLine = collect(preg_split('/\r?\n/', trim((string) $company->address)) ?: []) ->map(fn ($line) => trim((string) $line)) ->filter() ->last(); if (is_string($lastAddressLine) && $lastAddressLine !== '') { $parts[] = $lastAddressLine; } if ($company->type?->label()) { $parts[] = $company->type->label(); } return implode(' · ', $parts); } private function getMyPR(): PressRelease { $user = auth()->user(); return PressRelease::withoutGlobalScopes() ->where(function ($q) use ($user): void { $q->where('user_id', $user->id); $companyIds = $user->accessibleCompanyIds(); if ($companyIds !== []) { $q->orWhereIn('company_id', $companyIds); } }) ->with([ 'company:id,name,email,phone,address,portal,logo_path,legacy_portal,is_active,type', 'category.translations', 'contacts' => fn ($query) => $query ->withoutGlobalScopes() ->orderBy('last_name') ->orderBy('first_name') ->select(['contacts.id', 'contacts.company_id', 'contacts.first_name', 'contacts.last_name', 'contacts.responsibility', 'contacts.email', 'contacts.phone']), 'statusLogs.changedBy:id,name,email', ]) ->findOrFail($this->id); } }; ?>
@php $statusClass = match ($pr->status->value) { 'published' => 'ok', 'review' => 'warn', 'rejected' => 'err', default => 'hub', }; @endphp {{-- Flash-Banner ersetzt durch im Layout. --}} {{-- ============== PAGE HEADER ============== --}} {{-- ============== SHARE-LINK ERFOLG ============== --}} @if ($shareUrl)
{{ __('Öffentlicher Vorschau-Link erstellt') }} {{ __('gültig bis :date', ['date' => $shareExpiresAt]) }}
@endif {{-- ============== REJECTION-HINWEIS ============== --}} @if ($pr->status === PressReleaseStatus::Rejected && $latestRejection)
{{ __('Diese Pressemitteilung wurde abgelehnt') }} {{ __('Handlung erforderlich') }}
@if ($latestRejection->reason) {{ __('Begründung') }}: {{ $latestRejection->reason }} @else {{ __('Bitte überarbeiten Sie den Inhalt und reichen Sie die Pressemitteilung erneut ein.') }} @endif {{ __('Abgelehnt am') }} {{ $latestRejection->created_at->format('d.m.Y H:i') }}
@endif {{-- ============== STATUS-WORKFLOW (oben, farblich abgehoben) ============== --}} @if ($pr->status === PressReleaseStatus::Draft || $pr->status === PressReleaseStatus::Rejected)
{{ __('Status-Workflow') }} status === PressReleaseStatus::Rejected ? 'err' : 'hub'])> {{ $pr->status === PressReleaseStatus::Rejected ? __('Überarbeiten') : __('Entwurf') }}
@unless ($hasActiveBooking) {{-- Veröffentlichungs-Gate: Einreichen zur Prüfung setzt eine bezahlte Option voraus. Speichern als Entwurf bleibt frei. --}}
{{ __('Noch keine Buchung.') }} {{ __('Den Entwurf können Sie frei speichern. Zum Einreichen und Veröffentlichen benötigen Sie eine bezahlte Option (Tarif, Einzel-PM oder Extra-PM aus Guthaben).') }}
@endunless

{{ $pr->status === PressReleaseStatus::Rejected ? __('Sie können den Text bearbeiten und erneut zur Prüfung einreichen.') : __('Reichen Sie den Entwurf ein, sobald er vollständig ist.') }}

@if ($canEdit) {{ __('Bearbeiten') }} @endif @if ($hasActiveBooking) {{ $pr->status === PressReleaseStatus::Rejected ? __('Erneut einreichen') : __('Zur Prüfung einreichen') }} @else {{ __('Buchung wählen') }} @endif
@endif @if ($pr->status === PressReleaseStatus::Published)
{{ __('Status-Workflow') }} {{ __('Live') }}

{{ __('Diese Pressemitteilung ist veröffentlicht (seit :date).', ['date' => $pr->published_at?->format('d.m.Y H:i') ?? '–']) }}

@endif {{-- ============== ADD-ONS (Boost + Veröffentlichungsnachweis) ============== --}} @if ($pr->status === PressReleaseStatus::Published)
{{ __('Add-ons') }} {{ __(':n Credits Guthaben', ['n' => $creditBalance]) }}
{{-- Boost --}}

{{ __('Boost — Platzierung') }}

{{ __('Hervorhebung auf Start- und Branchenseite.') }}

@if ($isBoosted)
{{ __('Aktiv bis :date', ['date' => $boostedUntil?->copy()->setTimezone(\App\Models\PressRelease::DISPLAY_TIMEZONE)->format('d.m.Y H:i')]) }}
@endif @if ($canBoost)
@foreach ($boostOptions as $days => $credits) {{ __(':days Tage · :credits Credits', ['days' => $days, 'credits' => $credits]) }} @endforeach
@if ($isBoosted)

{{ __('Ein weiterer Kauf verlängert die Laufzeit.') }}

@endif @else

{{ __('Nur grün geprüfte Pressemitteilungen sind boostbar.') }}

@endif
{{-- Veröffentlichungsnachweis --}}

{{ __('Veröffentlichungsnachweis') }}

{{ __('PDF mit Datum, Portal und URL — :credits Credits.', ['credits' => $proofPrice]) }}

@if ($proofPurchased) {{ __('Nachweis herunterladen') }} @else {{ __('Für :credits Credits kaufen', ['credits' => $proofPrice]) }} @endif
@endif @if ($pr->status === PressReleaseStatus::Review)
{{ __('Status-Workflow') }} {{ __('Geduld bitte') }}

{{ __('Ihre Pressemitteilung wird gerade geprüft. Sie werden benachrichtigt, sobald eine Entscheidung vorliegt.') }}

@endif {{-- ============== KONTAKTE + STATUS/VERLAUF ============== --}}
{{ __('Firma & Pressekontakt') }}
{{-- Firma der Pressemitteilung — gleiche Kachel wie in der Firmenübersicht --}} @if ($pr->company)
@if ($pr->company->is_active) {{ __('Aktiv') }} @else {{ __('Inaktiv') }} @endif

{{ $pr->company->name }}

@if (filled($companyMetaLine))
{{ $companyMetaLine }}
@endif
@if ($pr->company->email) {{ $pr->company->email }} @endif @if ($pr->company->phone) {{ $pr->company->phone }} @endif
@if ($pr->company->portal === \App\Enums\Portal::Both) presseecho businessportal24 @elseif ($pr->company->portal === \App\Enums\Portal::Presseecho) presseecho @elseif ($pr->company->portal === \App\Enums\Portal::Businessportal24) businessportal24 @endif
{{ number_format($pr->company->press_releases_count ?? 0, 0, ',', '.') }} {{ __('PMs') }}
{{ number_format($pr->company->contacts_count ?? 0, 0, ',', '.') }} {{ __('Kontakte') }}
@endif {{-- Pressekontakt(e) direkt darunter --}}
@forelse ($contacts as $contact)
{{ trim(($contact->first_name ?? '').' '.($contact->last_name ?? '')) ?: __('Kontakt ohne Name') }}
{{ $contact->responsibility ?: __('Keine Rolle hinterlegt') }}
@if ($contact->email) {{ $contact->email }} @endif @if ($contact->phone) {{ $contact->phone }} @endif
@empty
{{ __('Dieser Pressemitteilung ist noch kein Pressekontakt zugeordnet.') }} @if ($pr->company) {{ __('Kontakte in der Firma prüfen.') }} @endif
@endforelse
{{ __('Status & Verlauf') }} {{ $pr->status->label() }}
{{ __('Aktueller Status') }}
{{ $pr->status->label() }}
{{ __('Erstellt') }}
{{ $pr->created_at?->format('d.m.Y H:i') ?? '–' }}
{{ __('Veröffentlicht') }}
{{ $pr->published_at?->format('d.m.Y H:i') ?? '–' }}
{{ __('Aufrufe') }}
{{ number_format($pr->hits, 0, ',', '.') }}
@if ($pr->scheduled_at)
{{ __('Geplante Veröffentlichung') }}
{{ $pr->scheduledAtLocal()->format('d.m.Y H:i') }}
@endif @if ($pr->embargo_at)
{{ __('Sperrfrist bis') }}
{{ $pr->embargoAtLocal()->format('d.m.Y H:i') }}
@endif
{{ __('Portal') }}
{{ $pr->portal?->label() ?? '–' }} {{ strtoupper($pr->language) }}
{{ __('Kategorie') }}
{{ $categoryName }}
@if (filled($pr->keywords))
{{ __('Themen') }}
@foreach (array_filter(array_map('trim', explode(',', $pr->keywords))) as $keyword) {{ $keyword }} @endforeach
@endif @if ($pr->backlink_url)
{{ __('Backlink') }}
{{ $pr->backlink_url }}
@endif @if ($pr->no_export)
{{ __('Kein Export aktiv (PM wird nicht über Feeds verteilt).') }}
@endif
@if ($statusLogs->isNotEmpty())
    @foreach ($statusLogs as $log)
  1. @php $logClass = match ($log->to_status?->value) { 'published' => 'ok', 'review' => 'warn', 'rejected' => 'err', default => 'hub', }; @endphp {{ $log->to_status?->label() }} {{ $log->created_at->format('d.m.Y H:i') }} @if ($log->changedBy) {{ __('durch :name', ['name' => $log->changedBy->name]) }} @endif
    @if ($log->reason)

    {{ $log->reason }}

    @endif
  2. @endforeach
@else

{{ __('Noch keine Statusänderungen protokolliert.') }}

@endif
{{-- ============== TITELBILD (Hero) ============== --}} {{-- Harte Obergrenze 1280x580 px: Container deckelt Breite und Seitenverhältnis, damit das Bild auf großen Screens nicht über die Detailgröße hinauswächst. --}}
{{ $pr->title }}
@if ($coverIsPlaceholder)
{{ __('Platzhalter-Titelbild — laden Sie im Editor ein eigenes Bild hoch.') }}
@elseif ($titleImage && ($titleImage->copyright || $titleImage->is_ai_generated)) {{-- Bildnachweis + KI-Kennzeichnung (Art. 50 EU AI Act) --}}
@if ($titleImage->is_ai_generated) {{ __('KI-generiert') }} @endif {{ $titleImage->copyright ?? __('Bild: KI-generiert') }}
@endif
{{-- ============== INHALT ============== --}}
{{ __('Inhalt') }}
{!! $pr->renderedText() !!}
{{-- ============== VERÖFFENTLICHUNGS-MODAL ============== --}} @if ($pr->status === PressReleaseStatus::Draft || $pr->status === PressReleaseStatus::Rejected) @endif {{-- ============== BOILERPLATE-OVERRIDE ============== --}} @if ($pr->boilerplate_override)
{{ __('Eigener Abbinder (Boilerplate)') }} {{ __('Override') }}

{{ __('Dieser Text wird für diese Pressemitteilung anstelle des Standard-Abbinders der Firma verwendet.') }}

{{ $pr->boilerplate_override }}
@endif