@include('frontend.partials.head', ['title' => 'Fily | Saved Listings']) @include('frontend.dashboard.partials.styles') @php $customerName = $customer?->name ?: 'Customer'; $savedListingCollection = collect($savedListings ?? []); $listingTypeLabels = [ 'job' => 'Job', 'rent' => 'Rental', 'hostel' => 'Hostel', 'service' => 'Service', ]; $listingFallbackImages = [ 'job' => 'https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=400&q=80', 'rent' => 'https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=400&q=80', 'hostel' => 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?auto=format&fit=crop&w=400&q=80', 'service' => 'https://images.unsplash.com/photo-1581578731548-c64695cc6952?auto=format&fit=crop&w=400&q=80', ]; $listingPrice = function ($listing): string { if ($listing->listing_type === 'job') { return $listing->price ? 'Rs '.number_format((float) $listing->price).'/mo' : 'Hiring'; } if ($listing->listing_type === 'service') { return $listing->price ? 'Starts Rs '.number_format((float) $listing->price) : 'On request'; } return $listing->price ? 'Rs '.number_format((float) $listing->price).'/mo' : 'On request'; }; $listingImage = function ($listing) use ($listingFallbackImages): string { return $listing->media_path ? asset('storage/'.$listing->media_path) : ($listingFallbackImages[$listing->listing_type] ?? $listingFallbackImages['rent']); }; $listingDetails = function ($listing): string { $details = collect([$listing->location, $listing->city])->filter(); if ($listing->listing_type === 'job') { $details = $details->merge([$listing->meta_three, $listing->meta_one, $listing->meta_two]); } elseif ($listing->listing_type === 'rent') { $roomDetails = is_string($listing->meta_three) ? json_decode($listing->meta_three, true) : null; $bedrooms = data_get($roomDetails, 'bedrooms'); $bathrooms = data_get($roomDetails, 'bathrooms'); $details = $details->merge([ $listing->meta_one, $bedrooms ? $bedrooms.' '.Str::plural('bed', (int) $bedrooms) : null, $bathrooms ? $bathrooms.' '.Str::plural('bath', (int) $bathrooms) : null, $listing->meta_two, ]); } elseif ($listing->listing_type === 'hostel') { $details = $details->merge([ $listing->meta_one, $listing->meta_two ? 'Meals available' : null, $listing->meta_three ? 'WiFi' : null, ]); } elseif ($listing->listing_type === 'service') { $details = $details->merge([ is_numeric($listing->meta_one) ? $listing->meta_one.' '.Str::plural('year', (int) $listing->meta_one).' experience' : null, is_numeric($listing->meta_two) ? $listing->meta_two.' km radius' : null, $listing->meta_three, ]); } return $details->filter()->take(4)->implode(' ยท ') ?: 'Details available on request'; }; @endphp @include('frontend.partials.header')
@include('frontend.dashboard.customer.partials.hero', [ 'customer' => $customer, 'kicker' => 'Customer dashboard', 'title' => 'Saved listings', 'description' => 'Review shortlisted jobs, rentals, hostels, and services.', 'actionUrl' => route('frontend.category-list'), 'actionIcon' => 'search', 'actionLabel' => 'Find more', ])
@include('frontend.dashboard.customer.partials.sidebar', ['customer' => $customer, 'active' => 'saved'])
@if (session('status')) @endif
@forelse ($savedListingCollection as $listing)
{{ $listing->title }}
{{ $listingTypeLabels[$listing->listing_type] ?? ucfirst((string) $listing->listing_type) }} {{ $listingDetails($listing) }}
{{ $listing->title }}
{{ $listingPrice($listing) }}
Open
@csrf
@empty
bookmark

No saved listings yet

Listings you save from the marketplace will appear here.

search Browse listings
@endforelse
@include('frontend.partials.footer')