@extends('layouts.app') @section('content') @php use App\Enums\PriceType; use App\Enums\PriceTypeLoyer; use App\Enums\PriceTypeTravaux; use App\Enums\ProductState; use App\Enums\ProductType; use App\Enums\FloorType; use App\Enums\SurfaceType; use App\Enums\Fiscalite as FiscaliteEnum; use App\Enums\DocumentTypeLot; use App\Services\AppContext; @endphp
@if($program)
@if($firstImage) {{ strtolower($program->name) }} @endif

{{ ucwords(strtolower($program->name)) }}

    @if($hasExclusivite)
  • Exclusivité Exclusivité
  • @endif @if($dateLivraisonValue)
  • Livré en {{ date('Y', strtotime($dateLivraisonValue)) }}
  • @endif
  • {{ ucwords(strtolower($program->city)) }}
  • {{ $fiscaliteLibelle }}
    @if($quoteTravaux)
  • Quote/travaux : {{ $quoteTravaux }} %
  • @endif @if(!empty($operations_commerciales)) @foreach($operations_commerciales as $operation_commerciale => $value)
  • {{ $operation_commerciale }}
  • @endforeach @endif
@endif
@if($program && $program->lots->count() > 0)
{{ $program->lots->count() }} Lots{{ !empty($types) ? ' du ' . $types[array_key_first($types)] . ' au ' . $types[array_key_last($types)] : '' }}
@if($fiscaliteEnum === FiscaliteEnum::RESIDENCE_PRINCIPALE) {{-- Classique --}} @elseif($fiscaliteEnum === FiscaliteEnum::MALRAUX) {{-- Malraux --}} @elseif($fiscaliteEnum === FiscaliteEnum::MONUMENT_HISTORIQUE) {{-- Monument Historique --}} @elseif($fiscaliteEnum === FiscaliteEnum::DEFICIT_FONCIER) {{-- Déficit Foncier --}} @elseif($fiscaliteEnum === FiscaliteEnum::DENORMANDIE) {{-- Denormandie --}} @elseif($fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_AVEC_TVA || $fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_SANS_TVA) {{-- LMNP Services --}} @elseif($fiscaliteEnum === FiscaliteEnum::LMNP_NEUF || $fiscaliteEnum === FiscaliteEnum::LMNP_ANCIEN) {{-- LMNP Neuf/Ancien --}} @endif @php // Variables pour suivre quelles colonnes ont des données $col_loyer_mensuel_dispositif_fiscal = $col_loyer_mensuel_denormandie_ttc = $col_loyer_mensuel_ttc = $col_loyer_mensuel_ht = $col_loyer_mensuel = false; $col_loyer_annuel_ttc = $col_loyer_annuel_ht = false; $col_prix_immobilier_ttc = $col_prix_immobilier_ht = false; $col_prix_mobilier_ttc = $col_prix_mobilier_ht = false; $col_prix_parking_ttc = $col_prix_parking_ht = false; $col_prix_garage_ttc = $col_prix_garage_ht = false; $col_prix_cave_ht = $col_prix_cave_ttc = false; $col_prix_vente_ttc = $col_prix_vente_total = false; $col_montant_travaux_comm_ttc = $col_montant_travaux_priv_ttc = $col_prix_travaux_total = false; $col_prix_foncier = $col_subvention_anah = $col_rentabilite_locative = false; @endphp @foreach($program->lots as $lot) @php $lotPrices = $lot->prices; $lotSurfaces = $lot->surfaces; $lotStates = $lot->states; $lotAnnexes = $lot->annexes; // Surfaces $surfaceHabitable = $lotSurfaces->where('type', SurfaceType::HABITABLE->value)->first()?->value ?? 0; // Les balcons, terrasses et jardins sont des annexes, pas des surfaces $balconAnnexes = $lotAnnexes->filter(function($annexe) { return $annexe->type && $annexe->type->value === ProductType::BALCON->value; }); $balconAnnexe = $balconAnnexes->first(); $terrasseAnnexe = $lotAnnexes->filter(function($annexe) { return $annexe->type && $annexe->type->value === ProductType::TERRASSE->value; })->first(); $jardinAnnexe = $lotAnnexes->filter(function($annexe) { return $annexe->type && $annexe->type->value === ProductType::JARDIN->value; })->first(); // Récupérer les surfaces des annexes (si elles ont des surfaces) // Pour les balcons, additionner toutes les surfaces des annexes de type Balcon // Les annexes utilisent le type de surface ANNEXE, pas HABITABLE $surfaceBalcon = 0; foreach ($balconAnnexes as $balcon) { // Essayer d'abord avec ANNEXE, puis HABITABLE en fallback $surfaceAnnexe = $balcon->surfaces->where('type', SurfaceType::ANNEXE->value)->first()?->value ?? 0; $surfaceHabitable = $balcon->surfaces->where('type', SurfaceType::HABITABLE->value)->first()?->value ?? 0; $surfaceBalcon += $surfaceAnnexe > 0 ? $surfaceAnnexe : $surfaceHabitable; } $surfaceTerrasse = 0; if ($terrasseAnnexe) { $surfaceAnnexe = $terrasseAnnexe->surfaces->where('type', SurfaceType::ANNEXE->value)->first()?->value ?? 0; $surfaceHabitable = $terrasseAnnexe->surfaces->where('type', SurfaceType::HABITABLE->value)->first()?->value ?? 0; $surfaceTerrasse = $surfaceAnnexe > 0 ? $surfaceAnnexe : $surfaceHabitable; } $surfaceJardin = 0; if ($jardinAnnexe) { $surfaceAnnexe = $jardinAnnexe->surfaces->where('type', SurfaceType::ANNEXE->value)->first()?->value ?? 0; $surfaceHabitable = $jardinAnnexe->surfaces->where('type', SurfaceType::HABITABLE->value)->first()?->value ?? 0; $surfaceJardin = $surfaceAnnexe > 0 ? $surfaceAnnexe : $surfaceHabitable; } $hasExterieur = ($surfaceBalcon > 0 || $surfaceTerrasse > 0 || $surfaceJardin > 0 || $balconAnnexes->isNotEmpty() || $terrasseAnnexe || $jardinAnnexe); // Annexes - Les annexes sont des Product avec category='annexe' et product_id=lot->id // Le type est dans l'attribut 'type' (casté en ProductType) $hasParking = $lotAnnexes->filter(function($annexe) { return $annexe->type && $annexe->type->value === ProductType::PARKING->value; })->isNotEmpty(); $hasGarage = $lotAnnexes->filter(function($annexe) { return $annexe->type && $annexe->type->value === ProductType::GARAGE->value; })->isNotEmpty(); $hasCave = $lotAnnexes->filter(function($annexe) { return $annexe->type && $annexe->type->value === ProductType::CAVE->value; })->isNotEmpty(); // Prix - Utiliser les types de prix comme chaînes de caractères (pas d'enums pour tous les types) $prixTTC = $lotPrices->where('type', PriceType::PRIX_TTC->value)->first()?->value ?? 0; $loyerMensuelDispositifFiscal = $lotPrices->where('type', 'loyer_mensuel_dispositif_fiscal')->first()?->value ?? 0; $loyerMensuelDenormandieTTC = $lotPrices->where('type', PriceTypeLoyer::MENSUEL_DENORMANDIE_TTC->value)->first()?->value ?? 0; $prixImmobilierTTC = $lotPrices->where('type', 'prix_immo_ttc')->first()?->value ?? 0; $prixParkingTTC = $lotPrices->where('type', 'prix_parking_ttc')->first()?->value ?? 0; $prixGarageTTC = $lotPrices->where('type', 'prix_garage_ttc')->first()?->value ?? 0; $prixCaveTTC = $lotPrices->where('type', 'prix_cave_ttc')->first()?->value ?? 0; // Pour la fiscalité classique, utiliser prix_ttc (PriceType::PRIX_TTC) comme pour Malraux $prixVenteTTC = $lotPrices->where('type', PriceType::PRIX_TTC->value)->first()?->value ?? 0; // Le prix foncier est calculé : Prix de vente TTC - Total des travaux en read_only // S'assurer que les prix sont chargés avant d'appeler getPrixFoncier() if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixFoncier = $lot->getPrixFoncier(); $montantTravauxCommTTC = $lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_ELIGIBLE->value)->first()?->value ?? 0; $montantTravauxPrivTTC = $lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_NON_ELIGIBLE->value)->first()?->value ?? 0; $prixTravauxTotal = $montantTravauxCommTTC + $montantTravauxPrivTTC; // Calculer le total des travaux (hors read_only) pour le prix vente total // S'assurer que les prix sont chargés avant d'appeler getTotalTravaux() if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixTravauxHorsReadOnly = $lot->getTotalTravaux(); // Prix travaux hors read_only $loyerMensuel = $lotPrices->where('type', 'loyer_mensuel')->first()?->value ?? 0; $loyerMensuelTTC = $lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()?->value ?? 0; $loyerAnnuelHT = $lotPrices->where('type', 'loyer_annuel_ht')->first()?->value ?? 0; $loyerAnnuelTTC = $lotPrices->where('type', 'loyer_annuel_ttc')->first()?->value ?? 0; $prixImmobilierHT = $lotPrices->where('type', 'prix_immobilier_ht')->first()?->value ?? 0; $prixMobilierHT = $lotPrices->where('type', 'prix_mobilier_ht')->first()?->value ?? 0; $prixMobilierTTC = $lotPrices->where('type', 'prix_mobilier_ttc')->first()?->value ?? 0; $prixParkingHT = $lotPrices->where('type', 'prix_parking_ht')->first()?->value ?? 0; $prixGarageHT = $lotPrices->where('type', 'prix_garage_ht')->first()?->value ?? 0; $prixCaveHT = $lotPrices->where('type', 'prix_cave_ht')->first()?->value ?? 0; $prixVenteHT = $lotPrices->where('type', 'prix_vente_ht')->first()?->value ?? 0; // Prix Vente Total = prix_ttc + prix_travaux (si pas en read_only) $prixVenteTotal = $prixTTC + $prixTravauxHorsReadOnly; // State $state = $lotStates->first(); $stateValue = $state ? $state->type->value : null; $isVendu = ($stateValue === ProductState::VENDU->value); @endphp @if($fiscaliteEnum === FiscaliteEnum::RESIDENCE_PRINCIPALE) {{-- Classique --}} @elseif($fiscaliteEnum === FiscaliteEnum::MALRAUX) {{-- Malraux --}} @elseif($fiscaliteEnum === FiscaliteEnum::MONUMENT_HISTORIQUE) {{-- Monument Historique --}} @elseif($fiscaliteEnum === FiscaliteEnum::DEFICIT_FONCIER) {{-- Déficit Foncier --}} @php // Pour Déficit Foncier, calculer le prix cave TTC depuis les annexes (comme pour Malraux) // S'assurer que les annexes et leurs prix sont chargés if (!$lot->relationLoaded('annexes')) { $lot->load('annexes'); } if (!$lot->relationLoaded('annexes.prices')) { $lot->load('annexes.prices'); } // Grouper les annexes par type $groupedAnnexesDeficit = $lotAnnexes->groupBy(function($annexe) { try { return $annexe->type ? $annexe->type->value : 'unknown'; } catch (\Throwable $e) { return 'unknown'; } }); $caveAnnexesDeficit = $groupedAnnexesDeficit->get(ProductType::CAVE->value, collect()); // Calculer le prix total des caves depuis les annexes $prixCaveTTCFromAnnexes = 0; foreach ($caveAnnexesDeficit as $cave) { $prixCaveTTCFromAnnexes += $cave->prices->where('type', 'prix_ttc')->first()?->value ?? 0; } // Utiliser le prix des annexes si disponible, sinon celui du lot $prixCaveTTCFinal = $prixCaveTTCFromAnnexes > 0 ? $prixCaveTTCFromAnnexes : $prixCaveTTC; // Loyer marché = loyer_mensuel ou loyer_mensuel_ttc $loyerMarche = $lotPrices->where('type', 'loyer_mensuel')->first()?->value ?? 0; if ($loyerMarche == 0) { $loyerMarche = $lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()?->value ?? 0; } @endphp @elseif($fiscaliteEnum === FiscaliteEnum::DENORMANDIE) {{-- Denormandie --}} @php // Pour Denormandie, calculer les prix des annexes depuis les annexes elles-mêmes (comme pour Malraux) // S'assurer que les annexes et leurs prix sont chargés if (!$lot->relationLoaded('annexes')) { $lot->load('annexes'); } if (!$lot->relationLoaded('annexes.prices')) { $lot->load('annexes.prices'); } // Grouper les annexes par type $groupedAnnexesDenormandie = $lotAnnexes->groupBy(function($annexe) { try { return $annexe->type ? $annexe->type->value : 'unknown'; } catch (\Throwable $e) { return 'unknown'; } }); $parkingAnnexesDenormandie = $groupedAnnexesDenormandie->get(ProductType::PARKING->value, collect()); // Calculer le prix total des parkings depuis les annexes $prixParkingTTCFromAnnexes = 0; foreach ($parkingAnnexesDenormandie as $parking) { $prixParkingTTCFromAnnexes += $parking->prices->where('type', 'prix_ttc')->first()?->value ?? 0; } // Utiliser le prix des annexes si disponible, sinon celui du lot $prixParkingTTCFinal = $prixParkingTTCFromAnnexes > 0 ? $prixParkingTTCFromAnnexes : $prixParkingTTC; @endphp @elseif($fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_AVEC_TVA || $fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_SANS_TVA) {{-- LMNP Services --}} @php $prixVenteTotalHT = ($prixVenteHT + $prixGarageHT + $prixParkingHT); $rentabiliteLocative = ($loyerAnnuelHT > 0 && $prixVenteTotalHT > 0) ? round(($loyerAnnuelHT / $prixVenteTotalHT) * 100) : 0; @endphp @elseif($fiscaliteEnum === FiscaliteEnum::LMNP_NEUF || $fiscaliteEnum === FiscaliteEnum::LMNP_ANCIEN) {{-- LMNP Neuf/Ancien --}} @php $prixVenteTotalHT = ($prixVenteHT + $prixGarageHT + $prixParkingHT); $rentabiliteLocative = ($loyerAnnuelHT > 0 && $prixVenteTotalHT > 0) ? round(($loyerAnnuelHT / $prixVenteTotalHT) * 100) : 0; @endphp @endif {{-- Détails du lot (affichés au clic) --}} @php // Calculer le colspan selon la fiscalité $colspan = 10; // Base: Lot, Type, Niveau, Surface, Extérieur, Parking, Garage, Cave, Statut, Actions if ($fiscaliteEnum === FiscaliteEnum::RESIDENCE_PRINCIPALE) $colspan = 13; // + 3 colonnes (Prix Parking TTC, Prix Cave TTC, Prix Vente TTC) elseif ($fiscaliteEnum === FiscaliteEnum::MALRAUX) $colspan = 18; // + 8 colonnes (Prix Foncier, Travaux, Prix Parking TTC, Prix Garage TTC, Prix Cave TTC, Loyer Marché, Prix Vente Total, Subvention ANAH) elseif ($fiscaliteEnum === FiscaliteEnum::MONUMENT_HISTORIQUE) $colspan = 21; // + 11 colonnes (Loyer Mensuel TTC, Prix Foncier, Travaux Déductibles, Travaux Non Déductibles, Travaux Total, Prix Parking TTC, Prix Garage TTC, Prix Cave TTC, Loyer Marché, Prix Vente Total, Subvention ANAH) elseif ($fiscaliteEnum === FiscaliteEnum::DEFICIT_FONCIER) $colspan = 17; // + 7 colonnes (Prix Foncier, Travaux Déductibles, Travaux Total, Prix Cave TTC, Loyer Marché, Prix Vente Total, Subvention ANAH) elseif ($fiscaliteEnum === FiscaliteEnum::DENORMANDIE) $colspan = 14; // + 4 colonnes (Loyer Mensuel Denormandie, Prix Immo TTC, Prix Parking TTC, Prix Vente Total) elseif ($fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_AVEC_TVA || $fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_SANS_TVA) $colspan = 18; // + 8 colonnes (Loyer Annuel HT, Prix Immo HT, Prix Mobilier HT, Prix Parking HT, Prix Garage HT, Loyer Marché, Prix Vente Total HT, Rentabilité Locative) elseif ($fiscaliteEnum === FiscaliteEnum::LMNP_NEUF || $fiscaliteEnum === FiscaliteEnum::LMNP_ANCIEN) $colspan = 18; // + 8 colonnes (Loyer Annuel HT, Prix Immo HT, Prix Mobilier HT, Prix Parking HT, Prix Garage HT, Loyer Marché, Prix Vente Total HT, Rentabilité Locative) @endphp @endforeach
Lot Type Niveau Surface Extérieur Parking Garage CavePrix Parking TTC Prix Cave TTC Prix Vente TTCPrix Foncier Travaux Prix Parking TTC Prix Garage TTC Prix Cave TTC Loyer Marché Prix Vente Total Subvention ANAHLoyer Mensuel TTC Prix Foncier Travaux Déductibles Travaux Non Déductibles Travaux Total Prix Parking TTC Prix Garage TTC Prix Cave TTC Loyer Marché Prix Vente Total Subvention ANAHPrix Foncier Travaux Déductibles Travaux Total Prix Cave TTC Loyer Marché Prix Vente Total Subvention ANAHLoyer Mensuel Denormandie Prix Immo TTC Prix Parking TTC Prix Vente TotalLoyer Annuel HT Prix Immo HT Prix Mobilier HT Prix Parking HT Prix Garage HT Loyer Marché Prix Vente Total HT Rentabilité LocativeLoyer Annuel HT Prix Immo HT Prix Mobilier HT Prix Parking HT Prix Garage HT Loyer Marché Prix Vente Total HT Rentabilité Locative
{{ $lot->number ?? '-' }} {{ $lot->type ? $lot->type->label() : '-' }} {{ $lot->floor ? $lot->floor->shortLabel() : '-' }} {{ $surfaceHabitable > 0 ? number_format($surfaceHabitable, 0, ',', ' ') . ' m²' : '-' }} {!! $hasExterieur ? '' : '' !!} {!! $hasParking ? '' : '' !!} {!! $hasGarage ? '' : '' !!} {!! $hasCave ? '' : '' !!}@if($prixParkingTTC > 0){{ number_format($prixParkingTTC, 0, ',', ' ') }} €@endif @if($prixCaveTTC > 0){{ number_format($prixCaveTTC, 0, ',', ' ') }} €@endif @if($prixVenteTTC > 0){{ number_format($prixVenteTTC, 0, ',', ' ') }} €@endif@if($prixFoncier > 0){{ number_format($prixFoncier, 0, ',', ' ') }} €@endif @if($prixTravauxTotal > 0){{ number_format($prixTravauxTotal, 0, ',', ' ') }} € {{ $prixVenteTotal > 0 ? round(($prixTravauxTotal / $prixVenteTotal) * 100) : 0 }} %@endif @if($prixParkingTTC > 0){{ number_format($prixParkingTTC, 0, ',', ' ') }} €@endif @if($prixGarageTTC > 0){{ number_format($prixGarageTTC, 0, ',', ' ') }} €@endif @if($prixCaveTTC > 0){{ number_format($prixCaveTTC, 0, ',', ' ') }} €@endif @if($loyerMensuelTTC > 0){{ number_format($loyerMensuelTTC, 0, ',', ' ') }} €@endif @if($prixVenteTotal > 0){{ number_format($prixVenteTotal, 0, ',', ' ') }} €@endif @if($lot->subvention_anah){{ $lot->subvention_anah }}@endif@if($loyerMensuelTTC > 0){{ number_format($loyerMensuelTTC, 0, ',', ' ') }} €@endif @if($prixFoncier > 0){{ number_format($prixFoncier, 0, ',', ' ') }} €@endif @if($montantTravauxCommTTC > 0){{ number_format($montantTravauxCommTTC, 0, ',', ' ') }} €
{{ ($prixVenteTotal - $prixParkingTTC) > 0 ? round(($montantTravauxCommTTC / ($prixVenteTotal - $prixParkingTTC)) * 100) : 0 }} %@endif
@if($montantTravauxPrivTTC > 0){{ number_format($montantTravauxPrivTTC, 0, ',', ' ') }} €@endif @if($prixTravauxTotal > 0){{ number_format($prixTravauxTotal, 0, ',', ' ') }} €@endif @if($prixParkingTTC > 0){{ number_format($prixParkingTTC, 0, ',', ' ') }} €@endif @if($prixGarageTTC > 0){{ number_format($prixGarageTTC, 0, ',', ' ') }} €@endif @if($prixCaveTTC > 0){{ number_format($prixCaveTTC, 0, ',', ' ') }} €@endif @if($loyerMensuel > 0){{ number_format($loyerMensuel, 0, ',', ' ') }} €@endif @if($prixVenteTotal > 0){{ number_format($prixVenteTotal, 0, ',', ' ') }} €@endif @if($lot->subvention_anah){{ $lot->subvention_anah }}@endif@if($prixFoncier > 0){{ number_format($prixFoncier, 0, ',', ' ') }} €@endif @if($montantTravauxCommTTC > 0){{ number_format($montantTravauxCommTTC, 0, ',', ' ') }} €
{{ ($prixVenteTotal - $prixParkingTTC) > 0 ? round(($montantTravauxCommTTC / ($prixVenteTotal - $prixParkingTTC)) * 100) : 0 }} %@endif
@if($prixTravauxTotal > 0){{ number_format($prixTravauxTotal, 0, ',', ' ') }} €@endif @if($prixCaveTTCFinal > 0){{ number_format($prixCaveTTCFinal, 0, ',', ' ') }} €@else-@endif @if($loyerMarche > 0){{ number_format($loyerMarche, 0, ',', ' ') }} €@else-@endif @if($prixVenteTotal > 0){{ number_format($prixVenteTotal, 0, ',', ' ') }} €@endif @if($lot->subvention_anah){{ $lot->subvention_anah }}@endif@if($loyerMensuelDenormandieTTC > 0){{ number_format($loyerMensuelDenormandieTTC, 0, ',', ' ') }} €@endif @if($prixImmobilierTTC > 0){{ number_format($prixImmobilierTTC, 0, ',', ' ') }} €@else-@endif @if($prixParkingTTCFinal > 0){{ number_format($prixParkingTTCFinal, 0, ',', ' ') }} €@else-@endif @if($prixVenteTotal > 0){{ number_format($prixVenteTotal, 0, ',', ' ') }} €@endif@if($loyerAnnuelHT > 0){{ number_format($loyerAnnuelHT, 0, ',', ' ') }} €@endif @if($prixImmobilierHT > 0){{ number_format($prixImmobilierHT, 0, ',', ' ') }} €@endif @if($prixMobilierHT > 0){{ number_format($prixMobilierHT, 0, ',', ' ') }} €@endif @if($prixParkingHT > 0){{ number_format($prixParkingHT, 0, ',', ' ') }} €@endif @if($prixGarageHT > 0){{ number_format($prixGarageHT, 0, ',', ' ') }} €@endif @if($loyerMensuel > 0){{ number_format($loyerMensuel, 0, ',', ' ') }} €@endif @if($prixVenteTotalHT > 0){{ number_format($prixVenteTotalHT, 0, ',', ' ') }} €@endif @if($rentabiliteLocative > 0){{ number_format($rentabiliteLocative, 0, ',', ' ') }} %@endif@if($loyerAnnuelHT > 0){{ number_format($loyerAnnuelHT, 0, ',', ' ') }} €@endif @if($prixImmobilierHT > 0){{ number_format($prixImmobilierHT, 0, ',', ' ') }} €@endif @if($prixMobilierHT > 0){{ number_format($prixMobilierHT, 0, ',', ' ') }} €@endif @if($prixParkingHT > 0){{ number_format($prixParkingHT, 0, ',', ' ') }} €@endif @if($prixGarageHT > 0){{ number_format($prixGarageHT, 0, ',', ' ') }} €@endif @if($loyerMensuel > 0){{ number_format($loyerMensuel, 0, ',', ' ') }} €@endif @if($prixVenteTotalHT > 0){{ number_format($prixVenteTotalHT, 0, ',', ' ') }} €@endif @if($rentabiliteLocative > 0){{ number_format($rentabiliteLocative, 0, ',', ' ') }} %@endif @php $availableRang = $lot->available_option_rang ?? null; @endphp @if($state) @if($stateValue === ProductState::VENDU->value) @elseif($stateValue === ProductState::ALLOTE->value) @elseif($availableRang === null) @elseif($availableRang === 1) @elseif($availableRang === 2) @else @endif @else @if($availableRang === null) @elseif($availableRang === 1) @elseif($availableRang === 2) @else @endif @endif
@foreach($program->lots as $lot) @php $lotPrices = $lot->prices; $lotSurfaces = $lot->surfaces; $lotStates = $lot->states; $lotAnnexes = $lot->annexes; $surfaceHabitable = $lotSurfaces->where('type', SurfaceType::HABITABLE->value)->first()?->value ?? 0; $prixTTC = $lotPrices->where('type', PriceType::PRIX_TTC->value)->first()?->value ?? 0; $state = $lotStates->first(); $stateValue = $state ? $state->type->value : null; $isVendu = ($stateValue === ProductState::VENDU->value); @endphp

Lot {{ $lot->number ?? '-' }}

{{ $lot->type ? $lot->type->label() : '-' }} | {{ $lot->floor ? $lot->floor->shortLabel() : '-' }} | {{ $surfaceHabitable > 0 ? number_format($surfaceHabitable, 0, ',', ' ') . ' m²' : '-' }}

Prix total

{{ $prixTTC > 0 ? number_format($prixTTC, 0, ',', ' ') . ' €' : '-' }}


@if($fiscaliteEnum === FiscaliteEnum::RESIDENCE_PRINCIPALE) {{-- Classique --}}
    @if($lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()?->value > 0)
  • Loyer Mensuel TTC : {{ number_format($lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_parking_ttc')->first()?->value > 0)
  • Prix Parking TTC : {{ number_format($lotPrices->where('type', 'prix_parking_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_cave_ttc')->first()?->value > 0)
  • Prix Cave TTC : {{ number_format($lotPrices->where('type', 'prix_cave_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', PriceType::PRIX_TTC->value)->first()?->value > 0)
  • Prix Vente TTC : {{ number_format($lotPrices->where('type', PriceType::PRIX_TTC->value)->first()->value, 0, ',', ' ') }} €
  • @endif
@elseif($fiscaliteEnum === FiscaliteEnum::MALRAUX) {{-- Malraux --}}
    @php // S'assurer que les prix sont chargés avant d'appeler getPrixFoncier() if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixFoncierCalcul = $lot->getPrixFoncier(); @endphp @if($prixFoncierCalcul > 0)
  • Prix Foncier : {{ number_format($prixFoncierCalcul, 0, ',', ' ') }} €
  • @endif @php $prixTravauxTotal = ($lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_ELIGIBLE->value)->first()?->value ?? 0) + ($lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_NON_ELIGIBLE->value)->first()?->value ?? 0); @endphp @if($prixTravauxTotal > 0)
  • Travaux : {{ number_format($prixTravauxTotal, 0, ',', ' ') }} € {{ $prixTTC > 0 ? round(($prixTravauxTotal / $prixTTC) * 100) : 0 }} %
  • @endif @if($lotPrices->where('type', 'prix_parking_ttc')->first()?->value > 0)
  • Prix Parking TTC : {{ number_format($lotPrices->where('type', 'prix_parking_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_garage_ttc')->first()?->value > 0)
  • Prix Garage TTC : {{ number_format($lotPrices->where('type', 'prix_garage_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_cave_ttc')->first()?->value > 0)
  • Prix Cave TTC : {{ number_format($lotPrices->where('type', 'prix_cave_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()?->value > 0)
  • Loyer Marché : {{ number_format($lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()->value, 0, ',', ' ') }} €
  • @endif @php // Calculer le prix vente total = prix_ttc + prix_travaux (hors read_only) if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixTravauxHorsReadOnlyMobile = $lot->getTotalTravaux(); $prixVenteTotalMobile = $prixTTC + $prixTravauxHorsReadOnlyMobile; @endphp @if($prixVenteTotalMobile > 0)
  • Prix Vente Total : {{ number_format($prixVenteTotalMobile, 0, ',', ' ') }} €
  • @endif @if($lot->subvention_anah)
  • Subvention ANAH : {{ $lot->subvention_anah }}
  • @endif
@elseif($fiscaliteEnum === FiscaliteEnum::MONUMENT_HISTORIQUE) {{-- Monument Historique --}}
    @if($lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()?->value > 0)
  • Loyer Mensuel TTC : {{ number_format($lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()->value, 0, ',', ' ') }} €
  • @endif @php // S'assurer que les prix sont chargés avant d'appeler getPrixFoncier() if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixFoncierCalcul = $lot->getPrixFoncier(); @endphp @if($prixFoncierCalcul > 0)
  • Prix Foncier : {{ number_format($prixFoncierCalcul, 0, ',', ' ') }} €
  • @endif @php $montantTravauxCommTTC = $lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_ELIGIBLE->value)->first()?->value ?? 0; $montantTravauxPrivTTC = $lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_NON_ELIGIBLE->value)->first()?->value ?? 0; $prixTravauxTotal = $montantTravauxCommTTC + $montantTravauxPrivTTC; @endphp @if($montantTravauxCommTTC > 0)
  • Travaux Déductibles : {{ number_format($montantTravauxCommTTC, 0, ',', ' ') }} € {{ ($prixTTC - ($lotPrices->where('type', 'prix_parking_ttc')->first()?->value ?? 0)) > 0 ? round(($montantTravauxCommTTC / ($prixTTC - ($lotPrices->where('type', 'prix_parking_ttc')->first()?->value ?? 0))) * 100) : 0 }} %
  • @endif @if($montantTravauxPrivTTC > 0)
  • Travaux Non Déductibles : {{ number_format($montantTravauxPrivTTC, 0, ',', ' ') }} €
  • @endif @if($prixTravauxTotal > 0)
  • Travaux Total : {{ number_format($prixTravauxTotal, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_parking_ttc')->first()?->value > 0)
  • Prix Parking TTC : {{ number_format($lotPrices->where('type', 'prix_parking_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_garage_ttc')->first()?->value > 0)
  • Prix Garage TTC : {{ number_format($lotPrices->where('type', 'prix_garage_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_cave_ttc')->first()?->value > 0)
  • Prix Cave TTC : {{ number_format($lotPrices->where('type', 'prix_cave_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'loyer_mensuel')->first()?->value > 0)
  • Loyer Marché : {{ number_format($lotPrices->where('type', 'loyer_mensuel')->first()->value, 0, ',', ' ') }} €
  • @endif @php // Calculer le prix vente total = prix_ttc + prix_travaux (hors read_only) if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixTravauxHorsReadOnlyMobile2 = $lot->getTotalTravaux(); $prixVenteTotalMobile2 = $prixTTC + $prixTravauxHorsReadOnlyMobile2; @endphp @if($prixVenteTotalMobile2 > 0)
  • Prix Vente Total : {{ number_format($prixVenteTotalMobile2, 0, ',', ' ') }} €
  • @endif @if($lot->subvention_anah)
  • Subvention ANAH : {{ $lot->subvention_anah }}
  • @endif
@elseif($fiscaliteEnum === FiscaliteEnum::DEFICIT_FONCIER) {{-- Déficit Foncier --}}
    @php // S'assurer que les prix sont chargés avant d'appeler getPrixFoncier() if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } if (!$lot->relationLoaded('annexes')) { $lot->load('annexes'); } if (!$lot->relationLoaded('annexes.prices')) { $lot->load('annexes.prices'); } $prixFoncierCalcul = $lot->getPrixFoncier(); // Calculer le prix cave TTC depuis les annexes $groupedAnnexesDeficitMobile = $lotAnnexes->groupBy(function($annexe) { try { return $annexe->type ? $annexe->type->value : 'unknown'; } catch (\Throwable $e) { return 'unknown'; } }); $caveAnnexesDeficitMobile = $groupedAnnexesDeficitMobile->get(ProductType::CAVE->value, collect()); $prixCaveTTCFromAnnexesMobile = 0; foreach ($caveAnnexesDeficitMobile as $cave) { $prixCaveTTCFromAnnexesMobile += $cave->prices->where('type', 'prix_ttc')->first()?->value ?? 0; } $prixCaveTTCMobile = $lotPrices->where('type', 'prix_cave_ttc')->first()?->value ?? 0; $prixCaveTTCFinalMobile = $prixCaveTTCFromAnnexesMobile > 0 ? $prixCaveTTCFromAnnexesMobile : $prixCaveTTCMobile; $montantTravauxCommTTC = $lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_ELIGIBLE->value)->first()?->value ?? 0; $montantTravauxPrivTTC = $lotPrices->where('type', PriceTypeTravaux::PRIX_TRAVAUX_NON_ELIGIBLE->value)->first()?->value ?? 0; $prixTravauxTotal = $montantTravauxCommTTC + $montantTravauxPrivTTC; // Loyer marché = loyer_mensuel ou loyer_mensuel_ttc $loyerMarche = $lotPrices->where('type', 'loyer_mensuel')->first()?->value ?? 0; if ($loyerMarche == 0) { $loyerMarche = $lotPrices->where('type', PriceTypeLoyer::MENSUEL_TTC->value)->first()?->value ?? 0; } // Prix vente total $prixTravauxHorsReadOnlyMobile3 = $lot->getTotalTravaux(); $prixVenteTotalMobile3 = $prixTTC + $prixTravauxHorsReadOnlyMobile3; @endphp @if($prixFoncierCalcul > 0)
  • Prix Foncier : {{ number_format($prixFoncierCalcul, 0, ',', ' ') }} €
  • @endif @if($montantTravauxCommTTC > 0)
  • Travaux Déductibles : {{ number_format($montantTravauxCommTTC, 0, ',', ' ') }} € {{ ($prixTTC - ($lotPrices->where('type', 'prix_parking_ttc')->first()?->value ?? 0)) > 0 ? round(($montantTravauxCommTTC / ($prixTTC - ($lotPrices->where('type', 'prix_parking_ttc')->first()?->value ?? 0))) * 100) : 0 }} %
  • @endif @if($prixTravauxTotal > 0)
  • Travaux Total : {{ number_format($prixTravauxTotal, 0, ',', ' ') }} €
  • @endif @if($prixCaveTTCFinalMobile > 0)
  • Prix Cave TTC : {{ number_format($prixCaveTTCFinalMobile, 0, ',', ' ') }} €
  • @endif @if($loyerMarche > 0)
  • Loyer Marché : {{ number_format($loyerMarche, 0, ',', ' ') }} €
  • @endif @if($prixVenteTotalMobile3 > 0)
  • Prix Vente Total : {{ number_format($prixVenteTotalMobile3, 0, ',', ' ') }} €
  • @endif @if($lot->subvention_anah)
  • Subvention ANAH : {{ $lot->subvention_anah }}
  • @endif
@elseif($fiscaliteEnum === FiscaliteEnum::DENORMANDIE) {{-- Denormandie --}}
    @if($lotPrices->where('type', PriceTypeLoyer::MENSUEL_DENORMANDIE_TTC->value)->first()?->value > 0)
  • Loyer Mensuel Denormandie : {{ number_format($lotPrices->where('type', PriceTypeLoyer::MENSUEL_DENORMANDIE_TTC->value)->first()->value, 0, ',', ' ') }} €
  • @endif
  • Prix Immo TTC : {!! $lotPrices->where('type', 'prix_immo_ttc')->first()?->value > 0 ? '' . number_format($lotPrices->where('type', 'prix_immo_ttc')->first()->value, 0, ',', ' ') . ' €' : '-' !!}
  • Prix Parking TTC : {!! $lotPrices->where('type', 'prix_parking_ttc')->first()?->value > 0 ? '' . number_format($lotPrices->where('type', 'prix_parking_ttc')->first()->value, 0, ',', ' ') . ' €' : '-' !!}
  • @php // Calculer le prix vente total = prix_ttc + prix_travaux (hors read_only) if (!$lot->relationLoaded('prices')) { $lot->load('prices'); } $prixTravauxHorsReadOnlyMobile4 = $lot->getTotalTravaux(); $prixVenteTotalMobile4 = $prixTTC + $prixTravauxHorsReadOnlyMobile4; @endphp @if($prixVenteTotalMobile4 > 0)
  • Prix Vente Total : {{ number_format($prixVenteTotalMobile4, 0, ',', ' ') }} €
  • @endif
@elseif($fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_AVEC_TVA || $fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_SANS_TVA) {{-- LMNP Services --}} @php $loyerAnnuelHT = $lotPrices->where('type', 'loyer_annuel_ht')->first()?->value ?? 0; $prixVenteHT = $lotPrices->where('type', 'prix_vente_ht')->first()?->value ?? 0; $prixGarageHT = $lotPrices->where('type', 'prix_garage_ht')->first()?->value ?? 0; $prixParkingHT = $lotPrices->where('type', 'prix_parking_ht')->first()?->value ?? 0; $prixVenteTotalHT = $prixVenteHT + $prixGarageHT + $prixParkingHT; $rentabiliteLocative = ($loyerAnnuelHT > 0 && $prixVenteTotalHT > 0) ? round(($loyerAnnuelHT / $prixVenteTotalHT) * 100) : 0; @endphp
    @if($loyerAnnuelHT > 0)
  • Loyer Annuel HT : {{ number_format($loyerAnnuelHT, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_immobilier_ht')->first()?->value > 0)
  • Prix Immo HT : {{ number_format($lotPrices->where('type', 'prix_immobilier_ht')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_mobilier_ht')->first()?->value > 0)
  • Prix Mobilier HT : {{ number_format($lotPrices->where('type', 'prix_mobilier_ht')->first()->value, 0, ',', ' ') }} €
  • @endif @if($prixParkingHT > 0)
  • Prix Parking HT : {{ number_format($prixParkingHT, 0, ',', ' ') }} €
  • @endif @if($prixGarageHT > 0)
  • Prix Garage HT : {{ number_format($prixGarageHT, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'loyer_mensuel')->first()?->value > 0)
  • Loyer Marché : {{ number_format($lotPrices->where('type', 'loyer_mensuel')->first()->value, 0, ',', ' ') }} €
  • @endif @if($prixVenteTotalHT > 0)
  • Prix Vente Total HT : {{ number_format($prixVenteTotalHT, 0, ',', ' ') }} €
  • @endif @if($rentabiliteLocative > 0)
  • Rentabilité Locative : {{ number_format($rentabiliteLocative, 0, ',', ' ') }} %
  • @endif
@elseif($fiscaliteEnum === FiscaliteEnum::LMNP_SEVICES_SANS_TVA) {{-- LMNP Services sans TVA --}} @php $prixVenteTTC = $lotPrices->where('type', PriceType::PRIX_TTC->value)->first()?->value ?? 0; $prixGarageTTC = $lotPrices->where('type', 'prix_garage_ttc')->first()?->value ?? 0; $prixParkingTTC = $lotPrices->where('type', 'prix_parking_ttc')->first()?->value ?? 0; $prixVenteTotalTTC = $prixVenteTTC + $prixGarageTTC + $prixParkingTTC; @endphp
    @if($lotPrices->where('type', 'loyer_annuel_ttc')->first()?->value > 0)
  • Loyer Annuel TTC : {{ number_format($lotPrices->where('type', 'loyer_annuel_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_immo_ttc')->first()?->value > 0)
  • Prix Immo TTC : {{ number_format($lotPrices->where('type', 'prix_immo_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_mobilier_ttc')->first()?->value > 0)
  • Prix Mobilier TTC : {{ number_format($lotPrices->where('type', 'prix_mobilier_ttc')->first()->value, 0, ',', ' ') }} €
  • @endif @if($prixParkingTTC > 0)
  • Prix Parking TTC : {{ number_format($prixParkingTTC, 0, ',', ' ') }} €
  • @endif @if($prixGarageTTC > 0)
  • Prix Garage TTC : {{ number_format($prixGarageTTC, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'loyer_mensuel')->first()?->value > 0)
  • Loyer Marché : {{ number_format($lotPrices->where('type', 'loyer_mensuel')->first()->value, 0, ',', ' ') }} €
  • @endif @if($prixVenteTotalTTC > 0)
  • Prix Vente Total TTC : {{ number_format($prixVenteTotalTTC, 0, ',', ' ') }} €
  • @endif
@elseif($fiscaliteEnum === FiscaliteEnum::LMNP_NEUF || $fiscaliteEnum === FiscaliteEnum::LMNP_ANCIEN) {{-- LMNP Neuf/Ancien --}} @php $loyerAnnuelHT = $lotPrices->where('type', 'loyer_annuel_ht')->first()?->value ?? 0; $prixVenteHT = $lotPrices->where('type', 'prix_vente_ht')->first()?->value ?? 0; $prixGarageHT = $lotPrices->where('type', 'prix_garage_ht')->first()?->value ?? 0; $prixParkingHT = $lotPrices->where('type', 'prix_parking_ht')->first()?->value ?? 0; $prixVenteTotalHT = $prixVenteHT + $prixGarageHT + $prixParkingHT; $rentabiliteLocative = ($loyerAnnuelHT > 0 && $prixVenteTotalHT > 0) ? round(($loyerAnnuelHT / $prixVenteTotalHT) * 100) : 0; @endphp
    @if($loyerAnnuelHT > 0)
  • Loyer Annuel HT : {{ number_format($loyerAnnuelHT, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_immobilier_ht')->first()?->value > 0)
  • Prix Immo HT : {{ number_format($lotPrices->where('type', 'prix_immobilier_ht')->first()->value, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'prix_mobilier_ht')->first()?->value > 0)
  • Prix Mobilier HT : {{ number_format($lotPrices->where('type', 'prix_mobilier_ht')->first()->value, 0, ',', ' ') }} €
  • @endif @if($prixParkingHT > 0)
  • Prix Parking HT : {{ number_format($prixParkingHT, 0, ',', ' ') }} €
  • @endif @if($prixGarageHT > 0)
  • Prix Garage HT : {{ number_format($prixGarageHT, 0, ',', ' ') }} €
  • @endif @if($lotPrices->where('type', 'loyer_mensuel')->first()?->value > 0)
  • Loyer Marché : {{ number_format($lotPrices->where('type', 'loyer_mensuel')->first()->value, 0, ',', ' ') }} €
  • @endif @if($prixVenteTotalHT > 0)
  • Prix Vente Total HT : {{ number_format($prixVenteTotalHT, 0, ',', ' ') }} €
  • @endif @if($rentabiliteLocative > 0)
  • Rentabilité Locative : {{ number_format($rentabiliteLocative, 0, ',', ' ') }} %
  • @endif
@endif
@php $availableRang = $lot->available_option_rang ?? null; @endphp @if($state) @if($stateValue === ProductState::VENDU->value) @elseif($stateValue === ProductState::ALLOTE->value) @elseif($availableRang === null) @elseif($availableRang === 1) @elseif($availableRang === 2) @else @endif @else @if($availableRang === null) @elseif($availableRang === 1) @elseif($availableRang === 2) @else @endif @endif
@endforeach
@if($hasLotSimulatorsFeature && $fiscaliteEnum && in_array($fiscaliteEnum, [FiscaliteEnum::RESIDENCE_PRINCIPALE, FiscaliteEnum::MALRAUX, FiscaliteEnum::MONUMENT_HISTORIQUE, FiscaliteEnum::DEFICIT_FONCIER, FiscaliteEnum::DENORMANDIE, FiscaliteEnum::LMNP_NEUF, FiscaliteEnum::LMNP_ANCIEN, FiscaliteEnum::LMNP_SEVICES_AVEC_TVA, FiscaliteEnum::LMNP_SEVICES_SANS_TVA])) @endif @endif @endsection @push('scripts') @endpush {{-- Modal de pose d'option --}} {{-- Modal de pose d'option --}} {{-- Modal de retour de pose d'option --}} {{-- Modal de retour de pose d'option --}}