@php
$salePrice = $property->portal_sale_price ?? $property->price;
// Prioritize current_value, fallback to market_value_avg
$originPrice = $property->current_value > 0 ? $property->current_value :
($property->market_value_avg > 0 ? $property->market_value_avg : null);
// Fallback for when originPrice is still null, calculate from min and max directly
if (!$originPrice && $property->market_value_min > 0 && $property->market_value_max > 0) {
$originPrice = ($property->market_value_min + $property->market_value_max) / 2;
}
$discountPct = null;
if ($originPrice && $salePrice < $originPrice) {
$discountPct = (($originPrice - $salePrice) / $originPrice) * 100;
}
@endphp
@if($logoBase64)
@endif
@if($discountPct && $discountPct > 0)
{{ number_format($discountPct, 0) }}% OFF
BMV DEAL
@endif
@if($property->bedrooms)
- {{ $property->bedrooms }} Bedrooms
@endif
@if($property->bathrooms)
- {{ $property->bathrooms }} Bathrooms
@endif
@if($property->propertyType)
- {{ $property->propertyType->name }}
@endif
@if($property->investment_type)
-
{{ ucfirst(str_replace('_', ' ', $property->investment_type)) }}
@endif
@if($property->yearly_rent)
- Yield:
{{ number_format(($property->yearly_rent / $salePrice) * 100, 1) }}%
@endif
@if($property->thumbnail && Storage::disk('public')->exists($property->thumbnail))
@php
$thumbData = Storage::disk('public')->get($property->thumbnail);
$thumb64 = 'data:image/jpeg;base64,' . base64_encode($thumbData);
@endphp

@else
No Image
@endif
{{ $property->headline }}
{{ $property->location }}
@if($originPrice && $originPrice > $salePrice)
Current Value
£{{ number_format($originPrice, 0) }}
@endif
Asking Price
£{{ number_format($salePrice, 0) }}
@if($originPrice && $originPrice > $salePrice)
Instant Equity / Saving: £{{ number_format($originPrice - $salePrice, 0) }}
@endif
@if($property->gallery_images)
@foreach($property->gallery_images as $index => $image)
@if(Storage::disk('public')->exists($image))
@php
$imgData = Storage::disk('public')->get($image);
$img64 = 'data:image/jpeg;base64,' . base64_encode($imgData);
@endphp
@endif
@endforeach
@endif