diff --git a/app/Filament/Support/EditorialCatalog.php b/app/Filament/Support/EditorialCatalog.php index f764ea7..a01872a 100644 --- a/app/Filament/Support/EditorialCatalog.php +++ b/app/Filament/Support/EditorialCatalog.php @@ -761,13 +761,13 @@ public function statusChips(Composition $composition, bool $offered): array $chips[] = ['label' => 'Entwurf offen', 'tone' => 'yellow']; } - $chips[] = $stand['released_number'] !== null - ? ['label' => 'In der Mitgliederbibliothek', 'tone' => 'pine'] - : ['label' => 'Nicht in der Mitgliederbibliothek', 'tone' => 'quiet']; - - if ($stand['released_number'] !== null && $stand['released_number'] !== $stand['number']) { - $chips[] = ['label' => 'Bibliothek zeigt Fassung '.$stand['released_number'], 'tone' => 'pine']; - } + // Zeigt die Bibliothek eine ältere Fassung, nennt der Chip sie; „In der Mitgliederbibliothek“ neben + // „Fassung 2“ läse sich sonst, als wäre Fassung 2 sichtbar. + $chips[] = match (true) { + $stand['released_number'] === null => ['label' => 'Nicht in der Mitgliederbibliothek', 'tone' => 'quiet'], + $stand['released_number'] === $stand['number'] => ['label' => 'In der Mitgliederbibliothek', 'tone' => 'pine'], + default => ['label' => 'Bibliothek zeigt Fassung '.$stand['released_number'], 'tone' => 'pine'], + }; } $chips[] = ['label' => 'Nicht auf der Website', 'tone' => 'quiet']; diff --git a/resources/views/filament/verwaltung/aufbau.blade.php b/resources/views/filament/verwaltung/aufbau.blade.php index 44eab10..1ceec18 100644 --- a/resources/views/filament/verwaltung/aufbau.blade.php +++ b/resources/views/filament/verwaltung/aufbau.blade.php @@ -110,7 +110,7 @@

Verwendung {{ $ort }} „{{ trim($this->displayTitle) !== '' ? $this->displayTitle : $this->designation }}“ · Stelle {{ $auswahl + 1 }}

- +
@if (! empty($gewaehlt['open_url'])) Inhaltsvorschau in neuem Tab diff --git a/tests/Feature/VerwaltungArbeitsplatzTest.php b/tests/Feature/VerwaltungArbeitsplatzTest.php index 8d9c01e..9c70d7f 100644 --- a/tests/Feature/VerwaltungArbeitsplatzTest.php +++ b/tests/Feature/VerwaltungArbeitsplatzTest.php @@ -15,6 +15,7 @@ use App\Filament\Resources\Exercises\Pages\EditExercise; use App\Filament\Resources\LicenseArticles\LicenseArticleResource; use App\Filament\Resources\LicenseArticles\Pages\ViewLicenseArticle; +use App\Filament\Support\EditorialCatalog; use App\Models\User; use Filament\Facades\Filament; use Illuminate\Foundation\Testing\RefreshDatabase; @@ -242,6 +243,10 @@ public function test_the_library_note_names_the_version_members_actually_see(): ->call('showAufbauTab', 'verlauf') ->assertSee('In der Mitgliederbibliothek ist Fassung 1 sichtbar, die neuere Fassung 2 noch nicht.') ->assertDontSee('noch keine Fassung sichtbar'); + + $labels = array_column(app(EditorialCatalog::class)->statusChips($module->fresh(), false), 'label'); + $this->assertContains('Bibliothek zeigt Fassung 1', $labels); + $this->assertNotContains('In der Mitgliederbibliothek', $labels); } public function test_an_expanded_module_stays_expanded_when_it_moves(): void