@extends('layouts.app') @section('title', 'Properties') @section('page-title', 'Properties') @section('content')
{{ $properties->total() }} {{ Str::plural('property', $properties->total()) }} found
| # | @include('partials._sort_th', ['column' => 'title', 'label' => 'Title'])Purpose | Type | @include('partials._sort_th', ['column' => 'city', 'label' => 'City'])Owner | @include('partials._sort_th', ['column' => 'price', 'label' => 'Price']) @include('partials._sort_th', ['column' => 'status', 'label' => 'Status'])Added By | @include('partials._sort_th', ['column' => 'created_at', 'label' => 'Added'])Actions | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| {{ $properties->firstItem() + $loop->index }} | {{ $property->title }} | @php $purposeLabels = \App\Models\Property::LISTING_PURPOSES; @endphp {{ $purposeLabels[$property->listing_purpose] ?? '—' }} | {{ (\App\Models\Property::typeLabels())[$property->type] ?? ucwords(str_replace('_', ' ', $property->type)) }} | {{ $property->city ?? '—' }} | {{ $property->owner->name ?? '—' }} | {{ $property->formattedPrice() }} | @php $statusClasses = [ 'published' => 'bg-success text-white', 'under_review' => 'bg-warning text-dark', 'unavailable' => 'bg-secondary text-white', ]; $statusClass = $statusClasses[$property->status] ?? 'bg-secondary text-white'; $availStatus = in_array($property->id, $soldPropertyIds) ? 'sold' : (in_array($property->id, $rentedPropertyIds) ? 'rented' : 'available'); @endphp {{ ucwords(str_replace('_', ' ', $property->status)) }} @if($availStatus === 'sold') Sold @elseif($availStatus === 'rented') Rented @endif | @if($property->createdBy) {{ $property->createdBy->name }} @if($property->createdBy->isAdmin()) Admin @else Staff @endif @else — @endif | {{ $property->created_at->format('d M Y') }} | @if(auth()->user()->isAdmin() || $property->created_by === auth()->id()) @endif @if(auth()->user()->isAdmin()) @endif |
| No properties found. | ||||||||||