## Summary - introduce a shared enterprise-detail composition layer for Filament detail pages - migrate BackupSet, BaselineSnapshot, EntraGroup, and OperationRun detail screens to the shared summary-first layout - add regression and unit coverage for section hierarchy, related context, degraded states, and duplicate fact/badge presentation ## Scope - adds shared support classes under `app/Support/Ui/EnterpriseDetail` - adds shared enterprise detail Blade partials under `resources/views/filament/infolists/entries/enterprise-detail` - updates touched Filament resources/pages to use the shared detail shell - includes Spec 133 artifacts under `specs/133-detail-page-template` ## Notes - branch: `133-detail-page-template` - base: `dev` - commit: `fd294c7` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #162
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Ui\EnterpriseDetail;
|
|
|
|
final readonly class PageActionData
|
|
{
|
|
public function __construct(
|
|
public string $label,
|
|
public string $placement = 'header',
|
|
public ?string $url = null,
|
|
public ?string $actionName = null,
|
|
public bool $destructive = false,
|
|
public bool $requiresConfirmation = false,
|
|
public bool $visible = true,
|
|
public ?string $icon = null,
|
|
public bool $openInNewTab = false,
|
|
) {}
|
|
|
|
public function isRenderable(): bool
|
|
{
|
|
return $this->visible
|
|
&& trim($this->label) !== ''
|
|
&& (filled($this->url) || filled($this->actionName));
|
|
}
|
|
|
|
/**
|
|
* @return array{
|
|
* label: string,
|
|
* placement: string,
|
|
* url: ?string,
|
|
* actionName: ?string,
|
|
* destructive: bool,
|
|
* requiresConfirmation: bool,
|
|
* visible: bool,
|
|
* icon: ?string,
|
|
* openInNewTab: bool
|
|
* }
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'label' => $this->label,
|
|
'placement' => $this->placement,
|
|
'url' => $this->url,
|
|
'actionName' => $this->actionName,
|
|
'destructive' => $this->destructive,
|
|
'requiresConfirmation' => $this->requiresConfirmation,
|
|
'visible' => $this->visible,
|
|
'icon' => $this->icon,
|
|
'openInNewTab' => $this->openInNewTab,
|
|
];
|
|
}
|
|
}
|