TenantAtlas/resources/views/filament/infolists/entries/enterprise-detail/header.blade.php
2026-03-11 00:05:33 +01:00

107 lines
4.9 KiB
PHP

@php
use App\Support\Ui\EnterpriseDetail\FactPresentation;
$header = $header ?? [];
$header = is_array($header) ? $header : [];
$statusBadges = array_values(array_filter($header['statusBadges'] ?? [], 'is_array'));
$keyFacts = array_values(array_filter($header['keyFacts'] ?? [], 'is_array'));
$primaryActions = array_values(array_filter($header['primaryActions'] ?? [], 'is_array'));
@endphp
<div class="rounded-2xl border border-gray-200 bg-white/90 p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900/80">
<div class="flex flex-col gap-5 xl:flex-row xl:items-start xl:justify-between">
<div class="space-y-3">
@if ($statusBadges !== [])
<div class="flex flex-wrap items-center gap-2">
@foreach ($statusBadges as $badge)
<x-filament::badge
:color="$badge['color'] ?? 'gray'"
:icon="$badge['icon'] ?? null"
:icon-color="$badge['iconColor'] ?? null"
>
{{ $badge['label'] ?? 'State' }}
</x-filament::badge>
@endforeach
</div>
@endif
<div class="space-y-1">
<div class="text-2xl font-semibold tracking-tight text-gray-950 dark:text-white">
{{ $header['title'] ?? 'Detail' }}
</div>
@if (filled($header['subtitle'] ?? null))
<div class="text-sm text-gray-600 dark:text-gray-300">
{{ $header['subtitle'] }}
</div>
@endif
@if (filled($header['descriptionHint'] ?? null))
<div class="max-w-3xl text-sm text-gray-600 dark:text-gray-300">
{{ $header['descriptionHint'] }}
</div>
@endif
</div>
</div>
@if ($primaryActions !== [])
<div class="flex flex-wrap items-center gap-2">
@foreach ($primaryActions as $action)
@if (filled($action['url'] ?? null))
<a
href="{{ $action['url'] }}"
@if (($action['openInNewTab'] ?? false) === true) target="_blank" rel="noreferrer noopener" @endif
class="inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-sm font-medium transition {{ ($action['destructive'] ?? false) === true ? 'border-rose-300 bg-rose-50 text-rose-700 hover:bg-rose-100 dark:border-rose-500/40 dark:bg-rose-500/10 dark:text-rose-200' : 'border-gray-300 bg-gray-50 text-gray-700 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800' }}"
>
@if (filled($action['icon'] ?? null))
<x-filament::icon :icon="$action['icon']" class="h-4 w-4" />
@endif
{{ $action['label'] }}
</a>
@endif
@endforeach
</div>
@endif
</div>
@if ($keyFacts !== [])
<div class="mt-5 grid gap-3 sm:grid-cols-2 xl:grid-cols-4">
@foreach ($keyFacts as $fact)
@php
$displayValue = FactPresentation::value($fact);
$badge = is_array($fact['badge'] ?? null) ? $fact['badge'] : null;
@endphp
<div class="rounded-xl border border-gray-200 bg-gray-50/80 px-4 py-3 dark:border-gray-800 dark:bg-gray-950/40">
<div class="text-xs font-semibold uppercase tracking-[0.16em] text-gray-500 dark:text-gray-400">
{{ $fact['label'] ?? 'Fact' }}
</div>
<div class="mt-2 flex flex-wrap items-center gap-2 text-sm font-medium text-gray-900 dark:text-white">
@if ($displayValue !== null)
<span>{{ $displayValue }}</span>
@endif
@if ($badge !== null)
<x-filament::badge
:color="$badge['color'] ?? 'gray'"
:icon="$badge['icon'] ?? null"
:icon-color="$badge['iconColor'] ?? null"
size="sm"
>
{{ $badge['label'] ?? 'State' }}
</x-filament::badge>
@endif
</div>
@if (filled($fact['hint'] ?? null))
<div class="mt-1 text-xs text-gray-500 dark:text-gray-400">
{{ $fact['hint'] }}
</div>
@endif
</div>
@endforeach
</div>
@endif
</div>