Annexes
Gérez les annexes rattachées à ce lot
@php
$exteriorPrivatifTypesForAnnexeCard = \App\Enums\ProductType::exteriorPrivatifTypes();
$annexesForAnnexesCardList = ($lot->annexes ?? collect())->filter(
fn ($a) => $a->type && ! in_array($a->type, $exteriorPrivatifTypesForAnnexeCard, true)
)->values();
$hasAnnexeVisibleInAnnexesCard = $annexesForAnnexesCardList->isNotEmpty();
@endphp
@if($hasAnnexeVisibleInAnnexesCard)
@endif
@if($hasAnnexeVisibleInAnnexesCard)
@foreach($annexesForAnnexesCardList as $annexe)
@php
$annexeSurfaceRow = $annexe->surfaces->where('type', \App\Enums\SurfaceType::ANNEXE)->first()
?? $annexe->surfaces->first();
$annexePrixTtcRow = $annexe->prices->where('type', 'prix_ttc')->first();
$annexePrixDetailList = $annexe->prices->filter(fn ($p) => $p->type !== 'prix_ttc');
$useOldAnnexeEdit = session('failed_annexe_edit_id') === $annexe->id;
$annexeSalePriceTypesForInclude = [
\App\Enums\PriceTypeAnnexe::PRIX_TTC->value,
\App\Enums\PriceTypeAnnexe::PRIX_TVA_5_5->value,
\App\Enums\PriceTypeAnnexe::PRIX_TVA_10->value,
\App\Enums\PriceTypeAnnexe::PRIX_HT->value,
];
$includedInLotDefault = $annexe->prices->first(fn ($p) => in_array($p->type, $annexeSalePriceTypesForInclude, true) && $p->read_only) ? '1' : '0';
$annexePrixTva55Row = $annexe->prices->where('type', 'prix_tva_5_5')->first();
$annexePrixTva10Row = $annexe->prices->where('type', 'prix_tva_10')->first();
$annexePrixHtRow = $annexe->prices->where('type', 'prix_ht')->first();
$annexePrixLoyerRow = $annexe->prices->where('type', \App\Enums\PriceTypeLoyer::MENSUEL_TTC->value)->first();
$annexeSalePrices = $annexe->prices->filter(fn ($price) => in_array($price->type, [
\App\Enums\PriceTypeAnnexe::PRIX_TTC->value,
\App\Enums\PriceTypeAnnexe::PRIX_TVA_5_5->value,
\App\Enums\PriceTypeAnnexe::PRIX_TVA_10->value,
\App\Enums\PriceTypeAnnexe::PRIX_HT->value,
], true));
$annexeRentalPrices = $annexe->prices->filter(fn ($price) => in_array($price->type, [
\App\Enums\PriceTypeLoyer::MENSUEL_TTC->value,
\App\Enums\PriceTypeLoyer::MENSUEL_HT->value,
\App\Enums\PriceTypeLoyer::MENSUEL_DENORMANDIE_TTC->value,
\App\Enums\PriceTypeLoyer::MENSUEL_DENORMANDIE_HT->value,
\App\Enums\PriceTypeLoyer::MENSUEL_PLAFONNE_DISPOSITIF_FISCAL->value,
\App\Enums\PriceTypeLoyer::MENSUEL_SOCIAL_JEAN_BRUN->value,
\App\Enums\PriceTypeLoyer::MENSUEL_TRES_SOCIAL_JEAN_BRUN->value,
], true));
$canDetachAnnexeFromLot = $annexe->current_state === \App\Enums\ProductState::LIBRE
&& $lot->current_state === \App\Enums\ProductState::LIBRE;
@endphp
{{ $annexe->type->label() }}
{{ $annexe->number ?: '—' }}
@if($annexeSurfaceRow)
{{ number_format($annexeSurfaceRow->value, 2, ',', ' ') }} m²
@else
—
@endif
@if($annexePrixTtcRow)
{{ number_format($annexePrixTtcRow->value, 2, ',', ' ') }} € TTC
@else
—
@endif
@if($canDetachAnnexeFromLot)
@else
@endif
Prix de vente
@forelse($annexeSalePrices as $salePrice)
Prix {{ $salePrice->type_enum?->label() ?? $salePrice->type }}
{{ number_format((float) $salePrice->value, 0, ',', ' ') }} €
@empty
Aucun prix de vente renseigné.
@endforelse
Prix de location
@forelse($annexeRentalPrices as $rentalPrice)
Prix {{ $rentalPrice->type_enum?->label() ?? $rentalPrice->type }}
{{ number_format((float) $rentalPrice->value, 0, ',', ' ') }} €/mois
@empty
Aucun prix de location renseigné.
@endforelse
@endforeach
@else
Aucune annexe ajouté
Ajoutez les annexes disponibles à la vente avec ce lot
@endif