where('requires_review', true); $openAlertsCount = (clone $openAlertsQuery)->count(); $openAlertsVolume = (clone $openAlertsQuery)->sum('amount'); $avgRisk = round((clone $openAlertsQuery)->avg('risk_score') ?? 0); $watchlistHits = (clone $openAlertsQuery)->where('signals', 'like', '%Sanktionsliste%')->count(); $totalTransactions = Transaction::count(); $falsePositives = Transaction::where('status', Transaction::STATUS_FALSE_POSITIVE)->count(); $automationShare = 100 - (int) round(($falsePositives / max($totalTransactions, 1)) * 100); $automationShare = max(68, min($automationShare, 94)); return [ 'companies' => $totalCompanies, 'open_alerts' => $openAlertsCount, 'open_volume' => $openAlertsVolume, 'avg_risk' => $avgRisk, 'watchlist_hits' => $watchlistHits, 'automation_share' => $automationShare, ]; } #[Computed] public function companies(): Collection { $query = Company::query() ->withCount([ 'transactions as alert_count' => fn($transactions) => $transactions->where('requires_review', true), ]) ->withSum([ 'transactions as alert_volume' => fn($transactions) => $transactions->where('requires_review', true), ], 'amount') ->withAvg([ 'transactions as alert_risk' => fn($transactions) => $transactions->where('requires_review', true), ], 'risk_score') ->with([ 'transactions' => fn($transactions) => $transactions->where('requires_review', true)->latest('executed_at')->limit(1), ]) ->when( $this->search !== '', function ($builder) { $like = '%' . $this->search . '%'; $builder->where(function ($inner) use ($like) { $inner->where('name', 'like', $like) ->orWhere('legal_name', 'like', $like) ->orWhere('ticker', 'like', $like) ->orWhere('sector', 'like', $like); }); } ) ->orderByDesc('alert_volume') ->orderBy('name') ->limit(6); return $query->get(); } }; ?> @php $overview = $this->overview; /** @var \Illuminate\Support\Collection $companies */ $companies = $this->companies; $formatCurrency = static fn (float $value): string => number_format($value, 2, ',', '.') . ' €'; $formatNumber = static fn ($value): string => number_format((float) $value, 0, ',', '.'); @endphp
{{ __('Unternehmensauskunft') }} {{ __('Einfache Suche für Unternehmensdaten und historische Cases') }}

{{ __('Historische Cases') }}

{{ $companies->count() }} {{ __('Treffer') }}
@forelse ($companies as $company) @php $latestAlert = optional($company->transactions->first()); $alertVolume = (float) ($company->alert_volume ?? 0); $alertCount = (int) ($company->alert_count ?? 0); $alertRisk = (int) round($company->alert_risk ?? 0); $riskBadgeClasses = match (Str::lower($company->kyc_risk_level)) { 'high', 'hoch' => 'bg-rose-500/10 text-rose-600 dark:text-rose-300 border border-rose-500/20', 'low', 'niedrig' => 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-300 border border-emerald-500/20', default => 'bg-amber-500/10 text-amber-600 dark:text-amber-300 border border-amber-500/20', }; @endphp

{{ $company->legal_name ?? $company->name }}

{{ $company->ticker }} · {{ $company->sector }}

{{ $company->summary }}

Automatisierungsscore: muss noch eingebaut werden {{ __('Ø Risikoscore') }}: {{ $alertRisk }}

{{ __('Neuester Alert') }}

@if ($latestAlert)

{{ $latestAlert->counterparty }}

{{ $latestAlert->executed_at?->format('d.m.Y H:i') }} · {{ $latestAlert->channel }}

{{ __('Grund') }}: {{ $latestAlert->flagged_reason }}

@else

{{ __('Keine offenen Alerts – Monitoring im grünen Bereich.') }}

@endif
{{ __('Insights') }} {{ __('Generiere automatisch AIM-Summary und investigatives Casefile.') }}
@empty
{{ __('Keine Unternehmen gefunden. Bitte Suchkriterien anpassen oder Seed-Daten neu laden.') }}
@endforelse