Zeige den Medienbestand als Kacheln und Liste mit Fassung, Freigabe und Verwendung.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8a6678aad7
commit
3e56314cf9
8 files changed
+1511
-1
No files matched your search
@@ -3,11 +3,18 @@
|
||||
namespace App\Filament\Resources\ContentElements\Pages;
|
||||
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Support\MediaLibrary;
|
||||
use App\Filament\Support\MediumForm;
|
||||
use App\Filament\Support\ReportsDomainRules;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Schemas\Components\RenderHook;
|
||||
use Filament\Schemas\Components\View;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Livewire\Attributes\Url;
|
||||
|
||||
class ListContentElements extends ListRecords
|
||||
{
|
||||
@@ -15,9 +22,141 @@ class ListContentElements extends ListRecords
|
||||
|
||||
protected static string $resource = ContentElementResource::class;
|
||||
|
||||
#[Url(as: 'suche', except: '')]
|
||||
public string $suche = '';
|
||||
|
||||
#[Url(as: 'ansicht', except: 'kacheln')]
|
||||
public string $ansicht = 'kacheln';
|
||||
|
||||
#[Url(as: 'art', except: '')]
|
||||
public string $art = '';
|
||||
|
||||
#[Url(as: 'freigabe', except: '')]
|
||||
public string $freigabe = '';
|
||||
|
||||
#[Url(as: 'entwurf', except: '')]
|
||||
public string $entwurf = '';
|
||||
|
||||
#[Url(as: 'fassung', except: '')]
|
||||
public string $fassung = '';
|
||||
|
||||
#[Url(as: 'nutzung', except: '')]
|
||||
public string $nutzung = '';
|
||||
|
||||
#[Url(as: 'saeule', except: '')]
|
||||
public string $saeule = '';
|
||||
|
||||
#[Url(as: 'einordnung', except: '')]
|
||||
public string $einordnung = '';
|
||||
|
||||
#[Url(as: 'verarbeitung', except: '')]
|
||||
public string $verarbeitung = '';
|
||||
|
||||
#[Url(as: 'archiv', except: 'aktiv')]
|
||||
public string $archiv = 'aktiv';
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Die Dateien und Texte. Eine Übung, ein Kurs oder eine fachliche Kombination verweist darauf; die Datei wird nicht für jede Verwendung neu hochgeladen.';
|
||||
return 'Die Dateien und Texte. Ein Modul oder ein Programm verweist auf eine Fassung; die Datei wird nicht für jede Verwendung neu hochgeladen.';
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string|null
|
||||
{
|
||||
return Width::Full;
|
||||
}
|
||||
|
||||
public function content(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
$this->getTabsContentComponent(),
|
||||
RenderHook::make(PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE),
|
||||
View::make('filament.media.library'),
|
||||
RenderHook::make(PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_AFTER),
|
||||
]);
|
||||
}
|
||||
|
||||
public function showingList(): bool
|
||||
{
|
||||
return $this->ansicht === 'liste';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function cards(): array
|
||||
{
|
||||
return app(MediaLibrary::class)->cards($this->libraryFilters(), ContentElementResource::editor());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{value: string, label: string}>
|
||||
*/
|
||||
public function typeOptions(): array
|
||||
{
|
||||
return app(MediaLibrary::class)->types();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, name: string}>
|
||||
*/
|
||||
public function pillarOptions(): array
|
||||
{
|
||||
return app(MediaLibrary::class)->pillars();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, label: string}>
|
||||
*/
|
||||
public function classificationOptions(): array
|
||||
{
|
||||
return app(MediaLibrary::class)->classifications();
|
||||
}
|
||||
|
||||
public function filtersActive(): bool
|
||||
{
|
||||
return trim($this->suche) !== ''
|
||||
|| $this->art !== ''
|
||||
|| $this->freigabe !== ''
|
||||
|| $this->entwurf !== ''
|
||||
|| $this->fassung !== ''
|
||||
|| $this->nutzung !== ''
|
||||
|| $this->saeule !== ''
|
||||
|| $this->einordnung !== ''
|
||||
|| $this->verarbeitung !== ''
|
||||
|| $this->archiv !== 'aktiv';
|
||||
}
|
||||
|
||||
public function resetFilters(): void
|
||||
{
|
||||
$this->suche = '';
|
||||
$this->art = '';
|
||||
$this->freigabe = '';
|
||||
$this->entwurf = '';
|
||||
$this->fassung = '';
|
||||
$this->nutzung = '';
|
||||
$this->saeule = '';
|
||||
$this->einordnung = '';
|
||||
$this->verarbeitung = '';
|
||||
$this->archiv = 'aktiv';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private function libraryFilters(): array
|
||||
{
|
||||
return [
|
||||
'suche' => $this->suche,
|
||||
'art' => $this->art,
|
||||
'freigabe' => $this->freigabe,
|
||||
'entwurf' => $this->entwurf,
|
||||
'fassung' => $this->fassung,
|
||||
'nutzung' => $this->nutzung,
|
||||
'saeule' => $this->saeule,
|
||||
'einordnung' => $this->einordnung,
|
||||
'verarbeitung' => $this->verarbeitung,
|
||||
'archiv' => $this->archiv,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
||||
Reference in new issue
Block a user