{{ __('labels.schedule') }}
@php $now = now(); $startedAt = $started_at ? \Carbon\Carbon::parse($started_at) : null; $endedAt = $ended_at ? \Carbon\Carbon::parse($ended_at) : null; $hasStarted = $startedAt && $now->gte($startedAt); $hasEnded = $endedAt && $now->gte($endedAt); $isActive = $hasStarted && !$hasEnded; $isUpcoming = !$hasStarted && $startedAt; $isExpired = $hasEnded; $isUnscheduled = !$startedAt && !$endedAt; $diffInDays = $startedAt->diffInDays($endedAt); $wholeDays = floor($diffInDays); $hours = round(($diffInDays - $wholeDays) * 24); // Determine status and colors if ($isUnscheduled) { $statusText = __('labels.not_scheduled'); $statusIcon = 'fa-calendar-times'; $statusColor = 'text-secondary'; $badgeColor = 'bg-secondary'; } elseif ($isUpcoming) { $statusText = __('labels.upcoming'); $statusIcon = 'fa-clock'; $statusColor = 'text-warning'; $badgeColor = 'bg-warning'; } elseif ($isActive) { $statusText = __('labels.active'); $statusIcon = 'fa-play-circle'; $statusColor = 'text-success'; $badgeColor = 'bg-success'; } elseif ($isExpired) { $statusText = __('labels.ended'); $statusIcon = 'fa-check-circle'; $statusColor = 'text-danger'; $badgeColor = 'bg-danger'; } @endphp {{ $statusText }} {{ $isActive ? __('labels.running') : ($isUpcoming ? __('labels.soon') : '') }}
@if($isActive && $startedAt && $endedAt) @php $totalDuration = $endedAt->diffInSeconds($startedAt); $elapsedDuration = $now->diffInSeconds($startedAt); $progressPercentage = min(100, ($elapsedDuration / $totalDuration) * 100); @endphp
{{ number_format($progressPercentage, 1) }}% {{ __('labels.completed') }} @endif
{{ __('labels.starts_at') }}
{{ $startedAt ? $startedAt->format('d M Y, H:i') : __('labels.not_set') }} @if($isUpcoming) {{ $startedAt->diffForHumans() }} @endif
{{ __('labels.ends_at') }}
{{ $endedAt ? $endedAt->format('d M Y, H:i') : __('labels.not_set') }} @if($isActive && $endedAt) {{ $endedAt->diffForHumans() }} @endif
@if($startedAt && $endedAt)
{{ __('labels.duration') }} {{-- {{ $startedAt->diffInDays($endedAt) }} {{ __('labels.days') }} --}} @if($wholeDays > 0 && $hours > 0) {{ $wholeDays }} {{ __('labels.days') }} {{ $hours }} {{ __('labels.hours') }} @elseif($wholeDays > 0) {{ $wholeDays }} {{ __('labels.days') }} @else {{ round($diffInDays * 24) }} {{ __('labels.hours') }} @endif
@endif