@php $i = 0; @endphp @foreach ($activity as $year => $months) @foreach ($months as $month => $dates) @php $i++ @endphp @endforeach @endforeach {{-- Output a table containing columns for days 1-7, 8-14, 15-21, 22-28, 29-31 (if applicable) --}} @for ($row = 0; $row < 7; $row++) @foreach ($activity as $year => $months) @foreach ($months as $month => $dates) @php $day1 = $row + 1; $day2 = $row + 8; $day3 = $row + 15; $day4 = $row + 22; $day5 = $row + 29; @endphp @if (ceil($month_days[$year][$month] / 7) >= 1) @if ($day1 <= $month_days[$year][$month]) @if (isset($dates[$day1]) && $dates[$day1] > 0) @else @endif @else @endif @endif @if (ceil($month_days[$year][$month] / 7) >= 2) @if ($day2 <= $month_days[$year][$month]) @if (isset($dates[$day2]) && $dates[$day2] > 0) @else @endif @else @endif @endif @if (ceil($month_days[$year][$month] / 7) >= 3) @if ($day3 <= $month_days[$year][$month]) @if (isset($dates[$day3]) && $dates[$day3] > 0) @else @endif @else @endif @endif @if (ceil($month_days[$year][$month] / 7) >= 4) @if ($day4 <= $month_days[$year][$month]) @if (isset($dates[$day4]) && $dates[$day4] > 0) @else @endif @else @endif @endif @if (ceil($month_days[$year][$month] / 7) >= 5) @if ($day5 <= $month_days[$year][$month]) @if (isset($dates[$day5]) && $dates[$day5] > 0) @else @endif @else @endif @endif @endforeach @endforeach @endfor
{{ $month }}@if ($i == 0 || $i == 12 || $month == 'Jan')
{{ $year }}@endif