Rattacher l'annexe à un lot
@csrf
@php // Filtrer uniquement les lots avec l'état LIBRE $lotsLibres = $program->lots->filter(function($lot) { return $lot->current_state == \App\Enums\ProductState::LIBRE; })->sortBy('number'); @endphp
    @foreach($lotsLibres as $lot) @php try { $lotTypeLabel = $lot->type ? $lot->type->label() : null; } catch (\Throwable $e) { $lotTypeLabel = null; } $lotSurface = $lot->surface; $lotTtcPrice = $lot->prices->firstWhere('type', \App\Enums\PriceType::PRIX_TTC->value); $lotPriceValue = $lotTtcPrice?->value ?? $lot->prices->first()?->value; $lotMeta = collect([ $lotTypeLabel, $lotSurface !== null ? number_format((float) $lotSurface, 0, ',', ' ') . ' m²' : null, $lotPriceValue !== null ? number_format((float) $lotPriceValue, 0, ',', ' ') . '€' : null, ])->filter()->implode(' | '); @endphp
  • @endforeach
Seuls les lots libres sont affichés
@if($lotsLibres->count() === 0)
Aucun lot libre disponible dans ce programme.
@endif