## Summary - harden findings and finding-exception Filament surfaces so workflow state, governance validity, overdue urgency, and next action are operator-first - add tenant stats widgets, segmented tabs, richer governance warnings, and baseline/dashboard attention propagation for overdue and lapsed governance states - add Spec 166 artifacts plus regression coverage for findings, badges, baseline summaries, tenantless operation viewer behavior, and critical table standards ## Verification - `vendor/bin/sail bin pint --dirty --format agent` - `vendor/bin/sail artisan test --compact` ## Filament Notes - Livewire v4.0+ compliance: yes, implementation stays on Filament v5 / Livewire v4 APIs only - Provider registration: unchanged, Laravel 12 panel/provider registration remains in `bootstrap/providers.php` - Global search: unchanged in this slice; `FindingExceptionResource` stays not globally searchable, no new globally searchable resource was introduced - Destructive actions: existing revoke/reject/approve/renew/workflow mutations remain capability-gated and confirmation-gated where already defined - Asset strategy: no new assets added; existing deploy process remains unchanged, including `php artisan filament:assets` when registered assets are used - Testing plan delivered: findings list/detail, exception register, dashboard attention, baseline summary, badge semantics, and tenantless operation viewer coverage Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #197
77 lines
2.8 KiB
PHP
77 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Resources\FindingExceptionResource\Pages;
|
|
|
|
use App\Filament\Resources\FindingExceptionResource;
|
|
use App\Filament\Resources\FindingResource;
|
|
use App\Filament\Widgets\Tenant\FindingExceptionStatsOverview;
|
|
use App\Models\FindingException;
|
|
use Filament\Actions\Action;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
use Filament\Schemas\Components\Tabs\Tab;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
class ListFindingExceptions extends ListRecords
|
|
{
|
|
protected static string $resource = FindingExceptionResource::class;
|
|
|
|
protected function getHeaderWidgets(): array
|
|
{
|
|
return [
|
|
FindingExceptionStatsOverview::class,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, Tab>
|
|
*/
|
|
public function getTabs(): array
|
|
{
|
|
$stats = FindingExceptionResource::exceptionStatsForCurrentTenant();
|
|
$needsAction = $stats['pending'] + $stats['expiring'] + $stats['expired'];
|
|
|
|
return [
|
|
'all' => Tab::make('All')
|
|
->icon('heroicon-m-list-bullet'),
|
|
'needs_action' => Tab::make('Needs action')
|
|
->icon('heroicon-m-exclamation-triangle')
|
|
->modifyQueryUsing(fn (Builder $query) => $query->whereIn('status', [
|
|
FindingException::STATUS_PENDING,
|
|
FindingException::STATUS_EXPIRING,
|
|
FindingException::STATUS_EXPIRED,
|
|
]))
|
|
->badge($needsAction > 0 ? $needsAction : null)
|
|
->badgeColor('warning'),
|
|
'active' => Tab::make('Active')
|
|
->icon('heroicon-m-check-badge')
|
|
->modifyQueryUsing(fn (Builder $query) => $query->where('status', FindingException::STATUS_ACTIVE)),
|
|
'historical' => Tab::make('Historical')
|
|
->icon('heroicon-m-archive-box')
|
|
->modifyQueryUsing(fn (Builder $query) => $query->whereIn('status', [
|
|
FindingException::STATUS_REJECTED,
|
|
FindingException::STATUS_REVOKED,
|
|
FindingException::STATUS_SUPERSEDED,
|
|
])),
|
|
];
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Action::make('open_findings')
|
|
->label('Open findings')
|
|
->icon('heroicon-o-arrow-top-right-on-square')
|
|
->color('gray')
|
|
->url(FindingResource::getUrl('index')),
|
|
Action::make('open_approval_queue')
|
|
->label('Open approval queue')
|
|
->icon('heroicon-o-arrow-top-right-on-square')
|
|
->color('gray')
|
|
->visible(fn (): bool => FindingExceptionResource::canAccessApprovalQueueForTenant())
|
|
->url(fn (): ?string => FindingExceptionResource::approvalQueueUrl()),
|
|
];
|
|
}
|
|
}
|