@foreach($forecasts as $fc)
@php
$dt = \Carbon\Carbon::createFromFormat('Ymd', $fc['date']);
$isToday = ($fc['date'] === $today);
$dayName = $dayNames[$dt->dayOfWeek];
$isSunday = $dt->dayOfWeek === 0;
$isSaturday = $dt->dayOfWeek === 6;
$icon = $fc['icon'] ?? null;
$weatherText = $fc['weather_text'] ?? '';
$tmn = $fc['tmn'];
$tmx = $fc['tmx'];
$pop = $fc['pop'] ?? 0;
$hasData = ($tmn !== null || $tmx !== null || $icon !== null);
// 바 위치 계산 (%)
$barLeft = $tmn !== null ? round(($tmn - $globalMin) / $range * 100) : 0;
$barRight = $tmx !== null ? round(($tmx - $globalMin) / $range * 100) : 100;
$barWidth = max($barRight - $barLeft, 8);
// 강수 여부
$isPrecip = in_array($icon, ['rain', 'snow', 'sleet']);
@endphp
{{-- 요일 --}}
{{ $isToday ? '오늘' : $dayName }}
{{-- 날짜 --}}
{{ $dt->format('m.d') }}
@if($hasData)
{{-- 날씨 아이콘 --}}
@if($icon)
@include('dashboard.partials.weather-icon', ['icon' => $icon])
@else
@endif
{{-- 강수확률 --}}
@if($pop > 0)
{{-- 우산 아이콘 --}}
{{ $pop }}%
@else
@endif
{{-- 기온 바 그래프 --}}
@if($tmx !== null && $tmn !== null)
@endif
{{-- 최고/최저 기온 --}}
@if($tmx !== null)
{{ $tmx }}°
@else
-
@endif
/
@if($tmn !== null)
{{ $tmn }}°
@else
-
@endif
@else
{{-- 데이터 없는 날 --}}
@endif