Hinweise werden zu Bannern mit Website, Erscheinungsbildern, Prioritaet und optionalem Sonderangebot (Text, Termin und Link aus dem Angebot, sichtbar nur solange es beworben wird). Sonderangebote lassen sich mit einem Klick als Banner zeigen; die Liste nennt das heute sichtbare Banner. Banner-Texte der Erscheinungsbilder werden zu saisonalen Bannern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1016 B
PHP
37 lines
1016 B
PHP
<?php
|
||
|
||
namespace App\Filament\Resources\Notices\Pages;
|
||
|
||
use App\Filament\Resources\Notices\NoticeResource;
|
||
use Filament\Actions\CreateAction;
|
||
use Filament\Resources\Pages\ListRecords;
|
||
|
||
class ListNotices extends ListRecords
|
||
{
|
||
protected static string $resource = NoticeResource::class;
|
||
|
||
/**
|
||
* Which banner the website shows today – the answer to "why do I see this banner?".
|
||
*/
|
||
public function getSubheading(): ?string
|
||
{
|
||
$today = NoticeResource::bannersToday();
|
||
if ($today === []) {
|
||
return null;
|
||
}
|
||
|
||
return collect($today)->map(function (array $entry) use ($today): string {
|
||
$prefix = count($today) > 1 ? $entry['site']->name.': ' : '';
|
||
|
||
return $prefix.($entry['banner'] ? 'Heute sichtbar: „'.$entry['banner']->text.'“' : 'Heute ist kein Banner sichtbar.');
|
||
})->implode(' · ');
|
||
}
|
||
|
||
protected function getHeaderActions(): array
|
||
{
|
||
return [
|
||
CreateAction::make(),
|
||
];
|
||
}
|
||
}
|