@php // Filtrer uniquement les produits catégorie 'annexe' qui sont priceable $priceableAnnexes = $program->annexes()->get()->filter(function($annexe) { return $annexe->type && $annexe->type->priceable(); }); @endphp
| Type | Numéro | Surface | Prix vente | Prix loyer | État | Lot rattaché | Actions |
|---|---|---|---|---|---|---|---|
| @php try { $annexeType = $annexe->type; $annexeTypeValid = $annexeType && $annexeType !== \App\Enums\ProductType::NON_DEFINI; } catch (\Throwable $e) { $annexeType = null; $annexeTypeValid = false; } @endphp @if($annexeTypeValid) {{ $annexeType->label() }} @else Non défini @endif | @if($annexe->number) {{ $annexe->number }} @else - @endif @if(auth()->user() && auth()->user()->isRole('ROLE_DEVELOPER')) #{{ $annexe->id }} @endif |
@if($annexe->surfaces->count() > 0)
@foreach($annexe->surfaces as $surface)
@php
$surfaceValue = $surface->value;
// Si pas de centimes, afficher sans décimales
if (floor($surfaceValue) == $surfaceValue) {
echo number_format($surfaceValue, 0, ',', ' ');
} else {
echo number_format($surfaceValue, 2, ',', ' ');
}
@endphp
m²
@endforeach
@else
-
@endif
|
@php
$salePrices = $annexe->prices->filter(function($price) {
return in_array($price->type, ['prix_ht', 'prix_ttc', 'prix_tva_5_5', 'prix_tva_10']);
});
@endphp
@if($salePrices->count() > 0)
@foreach($salePrices as $price)
{{ $price->type }}
@php
$priceValue = $price->value;
if (floor($priceValue) == $priceValue) {
echo number_format($priceValue, 0, ',', ' ');
} else {
echo number_format($priceValue, 2, ',', ' ');
}
@endphp
€
@endforeach
@else
-
@endif
|
@php
$rentalPrices = $annexe->prices->filter(function($price) {
return in_array($price->type, ['mensuel_garage', 'mensuel_parking', 'mensuel_ttc', 'mensuel_ht', 'mensuel_denormandie_ttc', 'mensuel_denormandie_ht']);
});
@endphp
@if($rentalPrices->count() > 0)
@foreach($rentalPrices as $price)
{{ $price->type }}
@php
$priceValue = $price->value;
if (floor($priceValue) == $priceValue) {
echo number_format($priceValue, 0, ',', ' ');
} else {
echo number_format($priceValue, 2, ',', ' ');
}
@endphp
€/mois
@endforeach
@else
-
@endif
|
{{ $annexe->current_state->label() }} | @php // Si l'annexe a un product_id, récupérer le lot parent $parentLot = $annexe->product_id ? \App\Models\Product::find($annexe->product_id) : null; @endphp @if($parentLot) Lot {{ $parentLot->number }} @else Non rattachée @endif | @php $parentLot = $annexe->product_id ? \App\Models\Product::find($annexe->product_id) : null; @endphp @if($parentLot) @php // Vérifier si l'annexe et le lot sont tous les deux libres $canDetach = $annexe->current_state == \App\Enums\ProductState::LIBRE && $parentLot->current_state == \App\Enums\ProductState::LIBRE; @endphp @if($canDetach) @else @endif @else @if($annexe->current_state == \App\Enums\ProductState::LIBRE) @else @endif @endif |
Ce programme ne contient aucune annexe payante (parking, garage, cave) pour le moment.
Seules les annexes de type "Parking", "Garage" et "Cave" sont affichées ici car elles sont vendables séparément.
@php $allAnnexes = $program->annexes()->get(); @endphp @if($allAnnexes->count() > 0)Il y a {{ $allAnnexes->count() }} autre(s) annexe(s) non payante(s) (cave, jardin, terrasse, balcon...) dans ce programme.
@endif