@extends('tracker::layouts.master') @section('title','Calendar') @push('styles') @endpush @section('content') @php $monthCap = 3; // issues shown per day in month view before "+N more" $title = $view === 'month' ? $grids[0]['month']->format($grids[0]['month']->year === $grids[1]['month']->year ? 'F' : 'F Y') . ' – ' . $grids[1]['month']->format('F Y') : $start->format($start->year === $end->year ? 'M j' : 'M j, Y') . ' – ' . $end->format('M j, Y'); // Months on screen — a greyed-out overflow day whose month has its own grid here leaves its // issues to that grid, so nothing shows up twice where the two month grids share a week. $shownMonths = collect($grids)->pluck('month')->filter()->map->format('Y-m')->all(); // Switching views keeps you in the same period: month → the current week if this is the // current month, otherwise the month's first week; week → the month the viewed date is in. $weekToggleDate = $view === 'month' ? ($date->isSameMonth(today()) ? today() : $date->copy()->startOfMonth()) : $date; $statuses = \Modules\Tracker\Models\Issue::statuses(); @endphp

Calendar — {{ $trackerCurrentProject->name ?? 'All Projects' }}

Issues are placed on their due date
{{ $title }}
@if($undatedCount) {{ $undatedCount }} open {{ Str::plural('issue', $undatedCount) }} without a due date @endif
@foreach($statuses as $key => $label) {{ $label }} @endforeach Overdue
@foreach($grids as $grid) @php $days = $grid['days']; @endphp
@if($grid['month'])
{{ $grid['month']->format('F Y') }}
@endif
@foreach($days->take(7) as $d)
{{ $d->format('D') }}@if($view === 'week') {{ $d->format('M j') }}@endif
@endforeach @foreach($days as $d) @php $dayIssues = $issues->get($d->toDateString(), collect()); $outside = $grid['month'] && !$d->isSameMonth($grid['month']); if ($outside && in_array($d->format('Y-m'), $shownMonths, true)) $dayIssues = collect(); @endphp
@if($view === 'month')
{{ $d->day }}
@elseif($d->isToday())
Today
@endif @foreach($dayIssues as $n => $issue) @php $overdue = $issue->status !== 'done' && $issue->due_date->lt(today()); @endphp {{ $issue->issue_key }} {{ $issue->title }} @if($view === 'week')
{{ ucfirst($issue->priority) }} {{ $issue->assignee->name ?? 'Unassigned' }}
{{ $statuses[$issue->status] ?? $issue->status }} @if($overdue)Overdue@endif
@endif
@endforeach @if($view === 'month' && $dayIssues->count() > $monthCap) @endif
@endforeach
@endforeach @endsection @push('scripts') @endpush