{{ __('site.start_activity.current_status') }}
@php
// Prefer statut on the debut record; fallback to the linked projet's statut if needed.
$statusLabel = trans_field($debutActivite->statut, 'statut')
?? trans_field($debutActivite->projet_debut->statut ?? null, 'statut')
?? ($debutActivite->statut?->statut_ar ?? __('site.formation.status.pending'));
@endphp
{{ $statusLabel }}
@php
// prefer DebutActivite.commentaire_motif, otherwise fallback to recent history comment
$currentComment = !empty($debutActivite->commentaire_motif)
? $debutActivite->commentaire_motif
: ($relevantHistory->commentaire ?? null);
// metadata if the comment came from history
$commentFromHistory = empty($debutActivite->commentaire_motif) && isset($relevantHistory) && !empty($relevantHistory->commentaire);
$historyAuthor = $relevantHistory->changer->name ?? $relevantHistory->changed_by ?? null;
$historyAt = isset($relevantHistory->created_at) ? $relevantHistory->created_at->format('Y-m-d H:i') : null;
@endphp
@if(!empty($currentComment))
{{ __('site.start_activity.rejection_reason_label') }}
{{ $currentComment }}
@if($commentFromHistory && ($historyAuthor || $historyAt))
@if($historyAuthor) {{ $historyAuthor }} @endif
@if($historyAuthor && $historyAt) — @endif
@if($historyAt) {{ $historyAt }} @endif
@endif
@endif