## Summary - introduce a shared operator outcome taxonomy with semantic axes, severity bands, and next-action policy - apply the taxonomy to operations, evidence/review completeness, baseline semantics, and restore semantics - harden badge rendering, tenant-safe filtering/search behavior, and operator-facing summary/notification wording - add the spec kit artifacts, reference documentation, and regression coverage for diagnostic-vs-primary state handling ## Testing - focused Pest coverage for taxonomy registry and badge guardrails - operations presentation and notification tests - evidence, baseline, restore, and tenant-scope regression tests ## Notes - Livewire v4.0+ compliance is preserved in the existing Filament v5 stack - panel provider registration remains unchanged in bootstrap/providers.php - no new globally searchable resource was added; adopted resources remain tenant-safe and out of global search where required - no new destructive action family was introduced; existing actions keep their current authorization and confirmation behavior - no new frontend asset strategy was introduced; existing deploy flow with filament:assets remains unchanged Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #186
83 lines
4.0 KiB
PHP
83 lines
4.0 KiB
PHP
@php
|
|
use App\Support\Badges\BadgeDomain;
|
|
use App\Support\Badges\BadgeRenderer;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
$rows = isset($rows) ? $rows : (isset($getState) ? $getState() : []);
|
|
$rows = is_array($rows) ? $rows : [];
|
|
|
|
$formatTimestamp = static function (?string $value): string {
|
|
if (! is_string($value) || trim($value) === '') {
|
|
return '—';
|
|
}
|
|
|
|
try {
|
|
return Carbon::parse($value)->toDayDateTimeString();
|
|
} catch (\Throwable) {
|
|
return $value;
|
|
}
|
|
};
|
|
@endphp
|
|
|
|
<div class="space-y-3">
|
|
@if ($rows === [])
|
|
<div class="rounded-lg border border-dashed border-gray-300 px-4 py-6 text-sm text-gray-600 dark:border-gray-700 dark:text-gray-300">
|
|
No captured policy types are available in this snapshot.
|
|
</div>
|
|
@else
|
|
<div class="overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-700">
|
|
<table class="min-w-full divide-y divide-gray-200 text-left text-sm dark:divide-gray-700">
|
|
<thead class="bg-gray-50 dark:bg-gray-900/50">
|
|
<tr class="text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400">
|
|
<th class="px-4 py-3">Policy type</th>
|
|
<th class="px-4 py-3">Items</th>
|
|
<th class="px-4 py-3">Fidelity</th>
|
|
<th class="px-4 py-3">Coverage state</th>
|
|
<th class="px-4 py-3">Latest evidence</th>
|
|
<th class="px-4 py-3">Notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100 dark:divide-gray-800">
|
|
@foreach ($rows as $row)
|
|
@php
|
|
$fidelitySpec = BadgeRenderer::spec(BadgeDomain::BaselineSnapshotFidelity, $row['fidelity'] ?? null);
|
|
$gapState = (($row['gapCount'] ?? 0) > 0) ? 'gaps_present' : 'clear';
|
|
$gapSpec = BadgeRenderer::spec(BadgeDomain::BaselineSnapshotGapStatus, $gapState);
|
|
@endphp
|
|
|
|
<tr class="align-top">
|
|
<td class="px-4 py-3 font-medium text-gray-900 dark:text-white">
|
|
{{ $row['label'] ?? ($row['policyType'] ?? 'Policy type') }}
|
|
</td>
|
|
<td class="px-4 py-3 text-gray-700 dark:text-gray-200">
|
|
{{ (int) ($row['itemCount'] ?? 0) }}
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<x-filament::badge :color="$fidelitySpec->color" :icon="$fidelitySpec->icon" size="sm">
|
|
{{ $fidelitySpec->label }}
|
|
</x-filament::badge>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<div class="flex items-center gap-2">
|
|
<x-filament::badge :color="$gapSpec->color" :icon="$gapSpec->icon" size="sm">
|
|
{{ $gapSpec->label }}
|
|
</x-filament::badge>
|
|
<span class="text-xs text-gray-500 dark:text-gray-400">
|
|
{{ (int) ($row['gapCount'] ?? 0) }}
|
|
</span>
|
|
</div>
|
|
</td>
|
|
<td class="px-4 py-3 text-gray-700 dark:text-gray-200">
|
|
{{ $formatTimestamp($row['capturedAt'] ?? null) }}
|
|
</td>
|
|
<td class="px-4 py-3 text-gray-600 dark:text-gray-300">
|
|
{{ $row['coverageHint'] ?? '—' }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|