@extends('layouts.user') @section('title', 'Global Weather Monitoring') @push('styles') @endpush @section('content') @php // Build enriched data map for the side panel (no extra AJAX needed) $richData = []; foreach ($weatherRecords as $rec) { $c = $rec->country; if (!$c) continue; $code = $rec->weather_code ?? 0; // Determine weather category from weather_code (Open-Meteo WMO standard) if ($code === 0) $cat = 'clear'; elseif (in_array($code, [1, 2])) $cat = 'partly_cloudy'; elseif ($code === 3) $cat = 'overcast'; elseif (in_array($code, [45, 48])) $cat = 'fog'; elseif (in_array($code, [51,53,55,56,57])) $cat = 'drizzle'; elseif (in_array($code, [61,63,65])) $cat = 'rain'; elseif (in_array($code, [66,67])) $cat = 'freezing_rain'; elseif (in_array($code, [71,73,75,77])) $cat = 'snow'; elseif (in_array($code, [80,81,82])) $cat = 'rain_showers'; elseif (in_array($code, [85,86])) $cat = 'snow_showers'; elseif (in_array($code, [95])) $cat = 'thunderstorm'; elseif (in_array($code, [96,99])) $cat = 'severe_thunderstorm'; elseif ($rec->wind_speed !== null && $rec->wind_speed > 60) $cat = 'strong_wind'; elseif ($rec->storm_risk >= 50) $cat = 'thunderstorm'; elseif ($rec->storm_risk >= 20) $cat = 'rain'; else $cat = 'clear'; $richData[$c->name] = [ 'country_id' => $c->id, 'iso2' => $c->iso2, 'capital' => $c->capital ?? 'N/A', 'timezone' => $rec->timezone ?? $c->timezone ?? 'N/A', 'flag' => $c->flag_url, 'status' => $rec->weather_status ?? 'N/A', 'weather_code'=> $code, 'category' => $cat, 'temp' => $rec->temperature, 'humidity' => $rec->humidity, 'pressure' => $rec->pressure, 'wind_speed' => $rec->wind_speed, 'rainfall' => $rec->rainfall, 'storm_risk' => $rec->storm_risk, 'updated' => $rec->recorded_at ? $rec->recorded_at->diffForHumans() : 'N/A', ]; } // Extend mapData with weather category (passed from controller via $mapData) // We'll build a lookup keyed by name for fast JS access @endphp {{-- ── Page Header ──────────────────────────────────────────────── --}}
Interactive map · {{ $coveredCount }} / {{ $totalCountries }} countries with data · Last sync: {{ $lastSynced ? $lastSynced->diffForHumans() : 'never' }}
Select a Country
Click any marker on the map to view real-time weather details.
·
Synced:
Conditions
Weather Impact on Logistics