@extends('layouts.app') @section('content') @if(session('success'))
{{ session('success') }}
@endif {{-- ── Stat cards ── --}}
@foreach([ ['Articles', $stats['articles'], 'file-earmark-text', '#00d2ff'], ['Ports', $stats['ports'], 'compass', '#28c76f'], ['Risk Scores', $stats['risk_scores'], 'shield-exclamation','#ffcc33'], ['Watchlist', $stats['watchlist'], 'bookmark-star', '#a78bfa'], ['News Cache', $stats['news_cache'], 'newspaper', '#f97316'], ] as [$label, $val, $icon, $color])
{{ $val }}
{{ $label }}
@endforeach
{{-- ── Tab navigation ── --}} {{-- ── Overview tab ── --}}
{{-- Statistics Overview Charts --}}
System Overview
Risk Distribution
Top Risk Countries
@foreach($riskScores->take(8) as $rs) @endforeach @if($riskScores->isEmpty()) @endif
CountryWeatherInflationNewsTotalLevel
{{ $rs->country_name }} {{ round($rs->weather_risk) }} {{ round($rs->inflation_risk) }} {{ round($rs->news_risk) }} {{ round($rs->total_score, 1) }} {{ $rs->risk_label }}
No risk scores yet.
Recent Ports
@foreach($recentPorts as $port)
{{ $port->port_name }}
{{ $port->country }}
{{ strtoupper($port->risk_level) }}
@endforeach @if($recentPorts->isEmpty())
No ports in database.
@endif
{{-- ── Articles tab ── --}}
Integrasi GNews API
Data artikel sekarang menggunakan GNews API secara langsung dan ditampilkan real-time di menu Berita. Tidak perlu lagi membuat artikel manual — semua berita otomatis ter-update dari sumber global terpercaya dengan sentimen analysis.
Publish Custom Article (Optional)
Fitur ini opsional. Gunakan hanya untuk catatan internal atau analisis khusus yang tidak tersedia dari GNews API.
@csrf
Custom Articles ({{ $stats['articles'] }}) — Manual entries only, GNews articles not shown here
@forelse($recentArticles as $art) @empty @endforelse
TitleCategorySentimentDate
{{ $art->title }} {{ $art->category }} {{ ucfirst($art->sentiment) }} {{ $art->created_at->format('d M') }}
@csrf @method('DELETE')
No custom articles.
All news data now comes from GNews API automatically.
{{-- ── Ports tab ── --}}
Add New Port
@csrf
Port Database ({{ $stats['ports'] }})
@forelse($recentPorts as $port) @empty @endforelse
Port NameCountryLatLngCongestionRisk
{{ $port->port_name }} {{ $port->country }} {{ $port->lat }} {{ $port->lng }} {{ $port->congestion_index }}% {{ strtoupper($port->risk_level) }}
@csrf @method('DELETE')
No ports in database.
{{-- ── Risk tab ── --}}
All Risk Scores ({{ $stats['risk_scores'] }})
@foreach($riskScores as $rs) @endforeach @if($riskScores->isEmpty()) @endif
CountryCodeWeatherInflationNewsCurrencyTotalLevelUpdated
{{ $rs->country_name }} {{ $rs->country_code }} {{ round($rs->weather_risk) }} {{ round($rs->inflation_risk) }} {{ round($rs->news_risk) }} {{ round($rs->currency_risk) }} {{ round($rs->total_score, 1) }} {{ $rs->risk_label }} {{ $rs->updated_at->format('d M H:i') }}
No risk scores calculated yet.
{{-- ── Cache tab ── --}}
Cache Management
News API Cache
{{ $stats['news_cache'] > 0 ? $stats['news_cache'] . ' active cache entries' : 'No active cache' }} · 30-min TTL
@csrf
How it works: News data from GNews API is cached for 30 minutes to reduce API calls. Clearing cache forces a fresh fetch on the next page load.
Cache Status
@if($stats['news_cache'] > 0) ✓ News cache is active
✓ API calls are being optimized
✓ Cache will auto-refresh every 30 minutes @else ⓘ No cache entries yet
ⓘ Cache will be created on first news page visit
ⓘ System is ready to cache API responses @endif
Cache Performance
Cache Hit Rate {{ $stats['news_cache'] > 0 ? '~85%' : '0%' }}
API Call Reduction {{ $stats['news_cache'] > 0 ? '~70%' : '0%' }}
Response Speed {{ $stats['news_cache'] > 0 ? '<50ms' : 'N/A' }}
Performance Tips
• Cache automatically refreshes every 30 minutes
• First load after clear takes ~2-3 seconds
• Subsequent loads are instant (<50ms)
• Clear cache only when data appears stale
@endsection @push('scripts') @endpush