TenantAtlas/app/Support/Ui/EnterpriseDetail/SummaryHeaderData.php
ahmido d4fb886de0 feat: standardize enterprise detail pages (#162)
## 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
2026-03-10 23:06:26 +00:00

51 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Support\Ui\EnterpriseDetail;
final readonly class SummaryHeaderData
{
/**
* @param list<array{label: string, color?: string, icon?: ?string, iconColor?: ?string}> $statusBadges
* @param list<array{label: string, value: string, hint?: ?string, badge?: ?array{label: string, color?: string, icon?: ?string, iconColor?: ?string}}> $keyFacts
* @param list<PageActionData> $primaryActions
*/
public function __construct(
public string $title,
public ?string $subtitle = null,
public array $statusBadges = [],
public array $keyFacts = [],
public array $primaryActions = [],
public ?string $descriptionHint = null,
) {}
/**
* @return array{
* title: string,
* subtitle: ?string,
* statusBadges: list<array{label: string, color?: string, icon?: ?string, iconColor?: ?string}>,
* keyFacts: list<array{label: string, value: string, hint?: ?string, badge?: ?array{label: string, color?: string, icon?: ?string, iconColor?: ?string}}>,
* primaryActions: list<array{label: string, placement: string, url: ?string, actionName: ?string, destructive: bool, requiresConfirmation: bool, visible: bool, icon: ?string, openInNewTab: bool}>,
* descriptionHint: ?string
* }
*/
public function toArray(): array
{
return [
'title' => $this->title,
'subtitle' => $this->subtitle,
'statusBadges' => array_values($this->statusBadges),
'keyFacts' => array_values($this->keyFacts),
'primaryActions' => array_values(array_map(
static fn (PageActionData $action): array => $action->toArray(),
array_values(array_filter(
$this->primaryActions,
static fn (PageActionData $action): bool => $action->isRenderable(),
)),
)),
'descriptionHint' => $this->descriptionHint,
];
}
}