@php $currentTaskReservation = $reservation->taskReservations ->where('state', \App\Enums\TaskState::EN_COURS) ->first(); $prixTTC = null; if ($reservation->option && $reservation->option->product) { $lot = $reservation->option->product; if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixTTC = $lot->getPrixLotTTC(); } $dateConfirmationOption = null; if ($reservation->option && $reservation->option->relationLoaded('states')) { $dateConfirmationOption = $reservation->option->states ->where('type', \App\Enums\OptionState::CONFIRMED->value) ->first()?->created_at; } elseif ($reservation->option) { $dateConfirmationOption = $reservation->option->states() ->where('type', \App\Enums\OptionState::CONFIRMED->value) ->first()?->created_at; } @endphp
@php $client = $reservation->client ?? ($reservation->option?->client); @endphp @if($client) @php $firstInitial = strtoupper(substr($client->firstname ?? '', 0, 1)); $lastInitial = strtoupper(substr($client->lastname ?? '', 0, 1)); $initials = $firstInitial . $lastInitial; @endphp @if($initials) {{ $initials }} @endif {{ $client->fullName() }} @else - @endif
@if($reservation->option && $reservation->option->product && $reservation->option->product->program) {{ $reservation->option->product->program->name }}
@if($reservation->option->product) {{ $reservation->option->product->name }} @endif @else - @endif @if($reservation->option) {{ $reservation->option->fiscalite_label() }} @else - @endif @if($reservation->option && $reservation->option->product) {{ $reservation->option->product->number }}
{{ $reservation->option->product->type ?? '-' }} @else - @endif @if($prixTTC) {{ number_format($prixTTC, 2, ',', ' ') }} € @else - @endif @if($reservation->option && $reservation->option->user) {{ $reservation->option->user->fullName() }} @else - @endif @if($currentTaskReservation && $currentTaskReservation->task) {{ $currentTaskReservation->task->name }} @elseif($currentTaskReservation) Tâche #{{ $currentTaskReservation->task_id }} @else Aucune tâche en cours @endif @if($reservation->signed_by_clients_at) {{ \Carbon\Carbon::parse($reservation->signed_by_clients_at)->format('d/m/Y à H:i') }} @elseif($dateConfirmationOption) {{ \Carbon\Carbon::parse($dateConfirmationOption)->format('d/m/Y à H:i') }} @elseif($reservation->created_at) {{ \Carbon\Carbon::parse($reservation->created_at)->format('d/m/Y à H:i') }} @else - @endif