@extends('layouts.dashboard') @section('title', 'Dashboard — Global Risk Intelligence') @push('styles') @endpush @section('content') {{-- ========================= --}} {{-- PAGE HEADER --}} {{-- ========================= --}} {{-- ========================= --}} {{-- KPI STRIP --}} {{-- ========================= --}}
{{-- Countries --}}
Global
{{ number_format($totalCountries) }}
Countries Monitored
{{-- Avg Risk --}}
{{ $avgRisk > 50 ? 'Above avg' : 'Normal' }}
{{ number_format($avgRisk, 1) }}
Average Risk Score
{{-- High Risk --}}
Alert
{{ $highRiskCount }}
High Risk Countries
{{-- Critical --}}
Critical
{{ $criticalCount }}
Critical Alerts
{{-- Ports --}}
All regions
{{ number_format($totalPorts) }}
Ports Tracked
{{-- ========================= --}} {{-- WORLD MAP + SIDEBAR --}} {{-- ========================= --}}
{{-- WORLD MAP --}}
Global Risk Map
{{-- Tile layer toggle --}}
{{-- Risk filter --}}
{{-- Loading Overlay --}}
Loading risk data...
{{-- Map --}}
{{-- Map Legend --}}
Risk Level
Low
Medium
High
Critical
{{-- Hidden counter text to prevent JS errors --}} {{-- Country Popup Panel --}}
—
—
{{-- Risk Score Row --}}
Risk Score
—
—
—
{{-- Economic Indicators — sourced from economic_caches --}}
Economic Data
GDP
—
Inflation
—
Population
—
Exports
—
{{-- Imports — full-width card --}}
Imports
—
{{-- RISK SIDEBAR --}}
{{-- Top Risk Countries --}}
Top Risk Countries
View All
@forelse($topRiskCountries->take(8) as $i => $rs)
{{ $i + 1 }}
{{ $rs->country?->country_name ?? '—' }}
{{ number_format($rs->total_score, 1) }}
{{ $rs->risk_level }}
@empty
No risk scores yet.
View countries
@endforelse
{{-- Region Risk --}} @if($regionRisk->isNotEmpty())
Risk by Region
@foreach($regionRisk->take(6) as $region) @if($region->region) @php $rScore = $region->avg_risk ?? 0; $rColor = $rScore > 75 ? '#EF4444' : ($rScore > 50 ? '#F97316' : ($rScore > 25 ? '#F59E0B' : '#10B981')); @endphp
{{ $region->region }} {{ number_format($rScore, 1) }}
@endif @endforeach
@endif
{{-- ========================= --}} {{-- CHARTS ROW --}} {{-- ========================= --}}
{{-- Risk Distribution Donut --}}
Risk Distribution
All Countries
{{ $totalCountries }}
Countries
@php $lowCount = $topRiskCountries->where('risk_level', 'Low')->count(); $mediumCount = $topRiskCountries->where('risk_level', 'Medium')->count(); $highCount = $topRiskCountries->where('risk_level', 'High')->count(); $critCount = $topRiskCountries->where('risk_level', 'Critical')->count(); // For the full counts via model $allLow = \App\Models\RiskScore::where('risk_level', 'Low')->count(); $allMedium = \App\Models\RiskScore::where('risk_level', 'Medium')->count(); $allHigh = \App\Models\RiskScore::where('risk_level', 'High')->count(); $allCritical = \App\Models\RiskScore::where('risk_level', 'Critical')->count(); $withScore = $allLow + $allMedium + $allHigh + $allCritical; $noData = $totalCountries - $withScore; @endphp
Low Risk {{ $allLow }}
Medium Risk {{ $allMedium }}
High Risk {{ $allHigh }}
Critical {{ $allCritical }}
@if($noData > 0)
No Data {{ $noData }}
@endif
{{-- Region Bar Chart --}}
Avg Risk by Region
Top {{ $regionRisk->count() }} Regions
{{-- ========================= --}} {{-- TOP RISK TABLE --}} {{-- ========================= --}}
Risk Leaderboard
All Countries
@if($topRiskCountries->isNotEmpty())
@foreach($topRiskCountries as $i => $rs) @endforeach
# Country Region Risk Score Status Components Action
{{ $i + 1 }}
{{ $rs->country?->country_name ?? '—' }}
{{ $rs->country?->country_code ?? '' }}
{{ $rs->country?->region ?? '—' }}
{{ number_format($rs->total_score, 1) }}
{{ $rs->risk_level }}
@if($rs->weather_score) 🌡️ {{ number_format($rs->weather_score, 0) }} @endif @if($rs->inflation_score) 📈 {{ number_format($rs->inflation_score, 0) }} @endif @if($rs->news_score) 📰 {{ number_format($rs->news_score, 0) }} @endif
Detail
@else
No risk scores available. Go to Countries
@endif
{{-- ========================= --}} {{-- INTELLIGENCE FEED --}} {{-- ========================= --}} @if($recentNews->isNotEmpty())
Intelligence Feed
All Intelligence
@foreach($recentNews as $n) @php $cardClass = match($n->sentiment) { 'Negative' => 'sentiment-negative-card', 'Positive' => 'sentiment-positive-card', default => 'sentiment-neutral-card', }; @endphp
{{ $n->title }}
@if($n->country) @endif {{ $n->sentiment ?? 'Neutral' }} @if($n->source) {{ Str::limit($n->source, 20) }} @endif {{ $n->published_at?->diffForHumans() }}
@endforeach
@endif @endsection @push('scripts') @endpush