{{-- Carte d'annonce Immo-Pro.tn (Agences & Particuliers). Variables : $p (Property), $premium (bool, optionnel) --}} @php $premium = $premium ?? false; $cat = optional($p->category)->name ?? 'Propriété'; $op = optional($p->operation)->title ?? optional($p->operation)->name ?? ''; $isLoc = (optional($p->operation)->name ?? null) === 'location'; $city = optional($p->city)->name ?? ''; $area = optional($p->area)->name ?? ''; $title = trim($p->title ?? '') ?: trim($cat . ($op ? " à {$op}" : '') . ($city ? " à {$city}" : '')); $href = route('annonce.show', rtrim($p->slug, '-') . (!empty($p->city) ? ('-a-' . \Illuminate\Support\Str::slug($p->city->slug ?: $p->city->name)) : '')); $fallback = asset('assets/img/product/01.jpg'); $img = (!empty($p->main_picture) && !empty($p->main_picture->alt)) ? asset('uploads/main_picture/images/properties/' . $p->main_picture->alt) : $fallback; $price = is_numeric(str_replace(' ', '', (string) $p->price)) ? number_format((float) str_replace(' ', '', (string) $p->price), 0, ',', ' ') : $p->price; $owner = ''; if ($p->user) { switch ($p->user->checkType()) { case 'company': $owner = optional($p->user->company)->corporate_name; break; case 'particular': $owner = optional($p->user->particular)->first_name; break; default: $owner = $p->user->username; break; } } $owner = ucfirst((string) $owner); $surface = $p->floor_area ?? $p->surfacetotal ?? null; @endphp
{{ $title }} {{ ucfirst($op ?: $cat) }} @if ($premium) Premium@endif
{{ $price }} DT @if ($isLoc) / mois@endif
{{ $cat }} · Réf. {{ strtoupper($p->ref) }}

{{ $title }}

{{ $city }}@if($area), {{ \Illuminate\Support\Str::limit($area, 35) }}@endif

{{ mb_substr($owner ?: 'I', 0, 1) }} {{ \Illuminate\Support\Str::limit($owner, 22) }} Voir