@php $bandwidth = $this->bandwidth(); $tasks = $this->tasks(); $unestimatedCount = $this->unestimatedTasksCount(); if($this->period === 'month') { $weeks = $this->weeklyBreakdown(); } $pointsTotal = $this->pointsTotal(); $pointsByDay = $this->pointsHeatmap(); $heatmapStart = \Illuminate\Support\Carbon::now()->subYear()->startOfWeek(\Illuminate\Support\Carbon::MONDAY); $heatmapEnd = \Illuminate\Support\Carbon::now()->endOfWeek(\Illuminate\Support\Carbon::SUNDAY); $heatmapWeeks = []; $heatmapCursor = $heatmapStart->copy(); $heatmapMonthLabels = []; while ($heatmapCursor <= $heatmapEnd) { $week = []; for ($d = 0; $d < 7; $d++) { $dateKey = $heatmapCursor->toDateString(); $week[] = [ 'date' => $heatmapCursor->copy(), 'points' => (int) ($pointsByDay[$dateKey] ?? 0), 'future' => $heatmapCursor->isAfter(\Illuminate\Support\Carbon::now()), ]; $heatmapCursor->addDay(); } $heatmapMonthLabels[] = $week[0]['date']->day <= 7 ? $week[0]['date']->translatedFormat('M') : null; $heatmapWeeks[] = $week; } $heatmapBucket = function (int $points): string { return match (true) { $points <= 0 => 'bg-gray-100 dark:bg-white/5', $points <= 2 => 'bg-success-100 dark:bg-success-900', $points <= 10 => 'bg-success-300 dark:bg-success-700', $points <= 20 => 'bg-success-500 dark:bg-success-500', default => 'bg-success-700 dark:bg-success-300', }; }; @endphp
{{ $this->periodLabel() }}
@foreach (['week' => 'Semaine', 'month' => 'Mois'] as $key => $label) @endforeach
@if (! $bandwidth)
Aucune donnée disponible
@else @php $pillClasses = [ 'warning' => 'bg-warning-50 text-warning-600 dark:bg-warning-500/10 dark:text-warning-400', 'ok' => 'bg-success-50 text-success-600 dark:bg-success-500/10 dark:text-success-400', 'over' => 'bg-danger-50 text-danger-600 dark:bg-danger-500/10 dark:text-danger-400', ]; $barClasses = [ 'warning' => 'bg-warning-500', 'ok' => 'bg-success-500', 'over' => 'bg-danger-500', ]; $labels = ['warning' => 'Limite', 'ok' => 'Équilibrée', 'over' => 'Surchargée']; @endphp @if($period === 'week') @php $percent = $bandwidth['capacity'] > 0 ? min(100, (int) round($bandwidth['hours'] / $bandwidth['capacity'] * 100)) : 0; @endphp
{{ rtrim(rtrim(number_format($bandwidth['hours'], 1), '0'), '.') }}h / {{ rtrim(rtrim(number_format($bandwidth['capacity'], 1), '0'), '.') }}h cette semaine
{{ $labels[$bandwidth['status']] }}
@if ($unestimatedCount > 0) {{ $unestimatedCount }} tâches non estimées. @endif @else
Semaines
@foreach ($weeks as $week)
{{ $week['start']->translatedFormat('d') }} – {{ $week['end']->translatedFormat('d M') }}
{{ rtrim(rtrim(number_format($week['hours'], 1), '0'), '.') }}h / {{ rtrim(rtrim(number_format($week['capacity'], 1), '0'), '.') }}h
@php $weekPercent = $week['capacity'] > 0 ? min(100, (int) round($week['hours'] / $week['capacity'] * 100)) : 0; @endphp
@endforeach
@endif @endif
Jours travaillés
@foreach([1 => 'L', 2 => 'M', 3 => 'M', 4=>'J', 5=>'V', 6=>'S', 7=> 'D'] as $key => $day) @endforeach
Heures / jour
Points
{{ $pointsTotal }} au total
@forelse ($tasks as $task) @php $isDone = $task->status->category === 'done'; $projectColor = $task->projectColorOrNeutral(); $isEstimated = $task->estimated_effort_hours !== null; @endphp
@php $isMeeting = $task->type->code === 'meeting'; @endphp @if ($isDone) @else @endif @if ($projectColor) {{ $task->projectCodeOrUnfiled() }} @else {{ $task->projectCodeOrUnfiled() }} @endif $isDone, 'text-gray-700 dark:text-gray-200' => ! $isDone, ]) x-tooltip="{ content: @js($task->title), theme: $store.theme, placement: 'bottom' }" > {{ $task->title }} @if ($task->type->code === 'milestone') {{ $this->milestoneKindLabel($task->milestone->milestone_kind) }} @else {{ $task->type->label }} @endif @if($task->completed_at) Terminé le {{ $task->completed_at->translatedFormat('d/m/Y') }} @else {{ $this->relativeDateLabel($task->due_date) ?? '—' }} @endif @if($isEstimated) $isDone, 'text-gray-700 dark:text-gray-200' => ! $isDone, ])> {{ ($task->estimated_effort_hours + 0) . "h"}} @else $isDone, 'text-warning-600 dark:text-warning-400' => ! $isDone, ])> n.c. @endif
@empty
Aucune tâche à faire.
@endforelse
@if ($tasks->hasPages())
{{-- Réutilise l'algorithme de fenêtrage (avec "…") de Laravel plutôt que d'en réécrire un — même array que celui que lit en interne. --}} @foreach ($tasks->render()->offsetGet('elements') as $element) @if (is_string($element)) … @endif @if (is_array($element)) @foreach ($element as $page => $url) @endforeach @endif @endforeach
@endif
Points gagnés par jour
Moins Plus
@foreach ($heatmapWeeks as $week)
{{ $heatmapMonthLabels[$loop->index] }}
@endforeach
L M V
@foreach ($heatmapWeeks as $week)
@foreach ($week as $day)
$day['future'], $heatmapBucket($day['points']) => ! $day['future'], ]) @unless ($day['future']) x-tooltip="{ content: '{{ $day['points'] }} point{{ $day['points'] > 1 ? 's' : '' }} le {{ $day['date']->translatedFormat('d M Y') }}', theme: $store.theme, placement: 'top' }" @endunless >
@endforeach
@endforeach