From 4f2be1e0a8f84ee3fafdbdc6db1950083f239216 Mon Sep 17 00:00:00 2001 From: Kevin Adametz Date: Mon, 13 Jul 2026 13:23:07 +0000 Subject: [PATCH] PM-Uebersicht: Rubrik unter Portal, Boost-moeglich-Hinweis, gruener Haken - Rubrik (lokalisiert) direkt unter den Portal-Pills; Kategorie wird in accessiblePageFor() eager geladen (kein N+1) - Status-Spalte: laeuft kein Boost, wirbt eine veroeffentlichte gruene PM mit "Boost moeglich ->" (Link zur PM-Seite mit den Add-ons) - Gruen geprueft: kleiner gruener Haken neben dem Titel (Tooltip "Inhaltspruefung: Gruen") Co-Authored-By: Claude Fable 5 --- app/Models/PressRelease.php | 3 +- .../customer/press-releases/index.blade.php | 33 ++++++++++++++++--- tests/Feature/PressReleaseShowAddonsTest.php | 32 ++++++++++++++++-- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/app/Models/PressRelease.php b/app/Models/PressRelease.php index ddf944ed..c4f7478b 100644 --- a/app/Models/PressRelease.php +++ b/app/Models/PressRelease.php @@ -575,7 +575,8 @@ class PressRelease extends Model $models = static::query()->withoutGlobalScopes() ->whereKey($pageIds) - ->with('company:id,name') + // Kategorie fürs Listen-Rendering (localizedCategoryName, 13.07.). + ->with(['company:id,name', 'category.translations']) // Für das Einreichungs-Modal je Zeile: ohne eigenes Bild entfällt // die Bildrechte-Bestätigung. ->withCount('images') diff --git a/resources/views/livewire/customer/press-releases/index.blade.php b/resources/views/livewire/customer/press-releases/index.blade.php index 6b006bfd..525eb4bf 100644 --- a/resources/views/livewire/customer/press-releases/index.blade.php +++ b/resources/views/livewire/customer/press-releases/index.blade.php @@ -442,6 +442,9 @@ new #[Layout('components.layouts.app'), Title('Meine Pressemitteilungen')] class @foreach ($pressReleases as $pr) @php $status = $pr->status->value; + // Grün geprüft = boostbar (Gate im BoostService); der Haken + // zeigt das Prüfergebnis auch abseits des Boost-Hinweises. + $isGreen = $pr->classification === \App\Enums\PressReleaseClassification::Green; $rowClass = match ($status) { 'review' => 'is-row-warn', 'rejected' => 'is-row-err', @@ -492,14 +495,30 @@ new #[Layout('components.layouts.app'), Title('Meine Pressemitteilungen')] class {{ __('Boost bis :date', ['date' => $boostEndsAt->format('d.m.Y')]) }} + @elseif ($status === 'published' && $isGreen) + {{-- Boostbar (veröffentlicht + grün): Hinweis auf das Add-on (13.07.). --}} + @endif - - {{ $pr->title }} - +
+ + {{ $pr->title }} + + @if ($isGreen) + {{-- Grüner Haken = Inhaltsprüfung mit Ergebnis Grün (13.07.). --}} + + + + @endif +
PM-{{ $pr->id }}
@@ -514,6 +533,12 @@ new #[Layout('components.layouts.app'), Title('Meine Pressemitteilungen')] class businessportal24 @endif + @if ($categoryName = $pr->localizedCategoryName()) + {{-- Rubrik direkt unter den Portal-Pills (13.07.). --}} +
+ {{ $categoryName }} +
+ @endif
diff --git a/tests/Feature/PressReleaseShowAddonsTest.php b/tests/Feature/PressReleaseShowAddonsTest.php index 22e5ac92..51d24d5b 100644 --- a/tests/Feature/PressReleaseShowAddonsTest.php +++ b/tests/Feature/PressReleaseShowAddonsTest.php @@ -298,15 +298,43 @@ test('the press release list shows a hint with end date for an active boost', fu $this->actingAs($customer); + // Ohne laufenden Boost wirbt die grüne, veröffentlichte PM für das Add-on. LivewireVolt::test('customer.press-releases.index') - ->assertDontSee('Boost bis'); + ->assertDontSee('Boost bis') + ->assertSee('Boost möglich'); Boost::factory()->for($pr)->create([ 'ends_at' => now()->addDays(7)->setTime(9, 0), ]); LivewireVolt::test('customer.press-releases.index') - ->assertSee('Boost bis '.now()->addDays(7)->format('d.m.Y')); + ->assertSee('Boost bis '.now()->addDays(7)->format('d.m.Y')) + ->assertDontSee('Boost möglich'); +}); + +test('the list shows the category under the portal and a green check for green releases', function () { + /** @var TestCase $this */ + ['customer' => $customer, 'pr' => $pr] = publishedGreenPrForOwner(); + + $pr->category->translations()->create(['locale' => 'de', 'name' => 'Energie & Klima', 'slug' => 'energie-klima']); + + $this->actingAs($customer); + + LivewireVolt::test('customer.press-releases.index') + ->assertSee('Energie & Klima') + ->assertSee('Inhaltsprüfung: Grün'); +}); + +test('a non-green release shows neither the green check nor the boost hint', function () { + /** @var TestCase $this */ + ['customer' => $customer, 'pr' => $pr] = publishedGreenPrForOwner(); + $pr->update(['classification' => PressReleaseClassification::Yellow->value]); + + $this->actingAs($customer); + + LivewireVolt::test('customer.press-releases.index') + ->assertDontSee('Inhaltsprüfung: Grün') + ->assertDontSee('Boost möglich'); }); test('an expired boost shows no hint in the press release list', function () {