@include('admin.partials.header') @include('admin.partials.sidebar') @include('admin.partials.topbar') @php $typeMeta = [ 'job' => ['label' => 'Job Advertisement', 'icon' => 'work', 'color' => '#2563eb'], 'rent' => ['label' => 'Property Rental', 'icon' => 'apartment', 'color' => '#7c3aed'], 'hostel' => ['label' => 'Hostel Listing', 'icon' => 'bed', 'color' => '#db2777'], 'service' => ['label' => 'Professional Service', 'icon' => 'construction', 'color' => '#059669'], ]; $meta = $typeMeta[$listing->listing_type] ?? ['label' => ucfirst($listing->listing_type), 'icon' => 'inventory_2', 'color' => '#475569']; // Clean, corporate fallback title structure if specific string is raw lowercase $title = match ($listing->listing_type) { 'job' => $listing->job_title ?? 'Untitled Job Position', 'rent' => $listing->property_type ?? $listing->property_kind ?? 'Rental Property', 'hostel' => $listing->hostel_type ?? 'Hostel Accommodation', 'service' => $listing->service_type ?? 'Professional Service Request', default => 'Marketplace Item', }; $providerName = $listing->provider_business_name ?: ($listing->provider_name ?: ($listing->provider_mobile ?: 'Anonymous Provider')); $hiddenFields = ['id', 'provider_id', 'deleted_at', 'provider_name', 'provider_business_name', 'provider_mobile', 'provider_email', 'listing_type', 'media', 'status', 'admin_note', 'views_count', 'approved_at', 'created_at', 'updated_at']; $fieldOrder = [ 'job' => ['company_name', 'job_title', 'job_category', 'department', 'role_category', 'employment_type', 'experience_required', 'education_required', 'post_role', 'gender_preference', 'job_posted_by', 'designation', 'application_deadline', 'apply_channels', 'apply_whatsapp_number', 'number_of_openings', 'salary_type', 'min_salary', 'monthly_salary', 'job_shift', 'work_type', 'candidate_min_education', 'skills_required', 'responsibilities', 'location', 'city', 'state', 'pincode', 'job_description', 'accuracy_confirmed', 'employer_terms_accepted', 'compliance_check_authorized'], 'rent' => ['property_kind', 'property_type', 'furnishing_status', 'address', 'area_locality', 'nearest_landmark', 'city', 'state', 'pincode', 'room_details', 'willing_to_rent_to', 'rent_per_month', 'security_deposit', 'maintenance_type', 'available_from', 'lease_duration', 'area_sqft', 'parking_type', 'additional_spaces', 'contact_number', 'whatsapp_number', 'description', 'details_confirmed', 'platform_terms_accepted'], 'hostel' => ['hostel_type', 'owner_name', 'contact_number', 'whatsapp_number', 'address', 'city', 'area_landmark', 'latitude', 'longitude', 'total_rooms', 'total_bed_capacity', 'bed_sharing_type', 'bathroom_type', 'monthly_rent', 'security_deposit', 'electricity_charge_type', 'electricity_charges', 'wifi_available', 'food_mess', 'power_backup', 'security_guard', 'gate_open_time', 'gate_close_time', 'visitor_policy', 'house_rules', 'description', 'terms_accepted'], 'service' => ['service_type', 'experience_years', 'service_area', 'service_radius', 'working_days', 'inspection_charge', 'starting_price', 'pricing_unit', 'hourly_rate', 'price_type', 'description', 'terms_accepted', 'guidelines_accepted', 'refund_policy_accepted'], ]; $fieldLabels = [ 'hostel_type' => 'Preferred For', 'area_landmark' => 'Area / Landmark', 'total_bed_capacity' => 'Total Bed Capacity', 'electricity_charge_type' => 'Electricity Charges', 'electricity_charges' => 'Fixed Electricity Amount', 'wifi_available' => 'WiFi', 'food_mess' => 'Food / Mess', 'security_guard' => 'Security', 'terms_accepted' => 'Terms Accepted', 'rent_per_month' => 'Rent Per Month', 'monthly_rent' => 'Monthly Rent', 'monthly_salary' => 'Monthly Salary', 'min_salary' => 'Minimum Salary', 'salary_type' => 'Salary Type', 'apply_channels' => 'Apply Channels', 'apply_whatsapp_number' => 'Apply WhatsApp Number', 'accuracy_confirmed' => 'Accuracy Confirmed', 'employer_terms_accepted' => 'Employer Terms Accepted', 'compliance_check_authorized' => 'Compliance Check Authorized', 'furnishing_status' => 'Furnishing Status', 'area_locality' => 'Area / Locality', 'nearest_landmark' => 'Nearest Landmark', 'maintenance_type' => 'Maintenance', 'available_from' => 'Available From', 'lease_duration' => 'Lease Duration', 'area_sqft' => 'Area', 'parking_type' => 'Parking', 'additional_spaces' => 'Additional Spaces', 'details_confirmed' => 'Details Confirmed', 'platform_terms_accepted' => 'Platform Terms Accepted', 'pricing_unit' => 'Pricing Unit', 'guidelines_accepted' => 'Guidelines Accepted', 'refund_policy_accepted' => 'Refund Policy Accepted', 'room_details' => 'Room Details', 'working_days' => 'Working Days', ]; $currencyFields = ['monthly_salary', 'min_salary', 'rent_per_month', 'monthly_rent', 'security_deposit', 'electricity_charges', 'inspection_charge', 'starting_price', 'hourly_rate']; $booleanFields = ['wifi_available', 'food_mess', 'power_backup', 'security_guard', 'terms_accepted', 'accuracy_confirmed', 'employer_terms_accepted', 'compliance_check_authorized', 'details_confirmed', 'platform_terms_accepted', 'guidelines_accepted', 'refund_policy_accepted']; $rawFields = collect((array) $listing) ->reject(fn ($value, $key) => in_array($key, $hiddenFields, true)) ->reject(fn ($value) => $value === null || $value === '' || $value === []); $orderedKeys = collect($fieldOrder[$listing->listing_type] ?? []) ->filter(fn ($key) => $rawFields->has($key)); $fields = $orderedKeys ->mapWithKeys(fn ($key) => [$key => $rawFields->get($key)]) ->merge($rawFields->except($orderedKeys->all())); $imageMedia = collect($listing->media ?? [])->filter(fn ($media) => ($media->file_type ?? null) === 'image')->values(); $documentMedia = collect($listing->media ?? [])->filter(fn ($media) => ($media->file_type ?? null) === 'document')->values(); $profileMedia = $imageMedia->first(fn ($media) => ($media->media_label ?? null) === 'profile_photo'); $pastWorkMedia = $imageMedia->filter(fn ($media) => in_array(($media->media_label ?? null), ['primary', 'gallery'], true))->values(); $toolsMedia = $imageMedia->filter(fn ($media) => str_starts_with((string) ($media->media_label ?? ''), 'tools_'))->values(); $otherImageMedia = $imageMedia ->reject(fn ($media) => ($media->media_label ?? null) === 'profile_photo') ->reject(fn ($media) => str_starts_with((string) ($media->media_label ?? ''), 'tools_')) ->reject(fn ($media) => in_array(($media->media_label ?? null), ['primary', 'gallery'], true)) ->values(); $heroMedia = $listing->listing_type === 'service' ? ($profileMedia ?: $pastWorkMedia->first() ?: $toolsMedia->first() ?: $imageMedia->first()) : $imageMedia->first(); $formatValue = function ($key, $value) use ($currencyFields, $booleanFields) { if (in_array($key, $booleanFields, true)) { return ((bool) $value) ? 'Yes' : 'No'; } if (in_array($key, $currencyFields, true) && is_numeric($value)) { return 'Rs '.number_format((float) $value, 2); } if (is_string($value) && str_starts_with(trim($value), '[')) { $decoded = json_decode($value, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { $value = $decoded; } } if (is_string($value) && str_starts_with(trim($value), '{')) { $decoded = json_decode($value, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { $value = $decoded; } } if (is_array($value) || is_object($value)) { return collect((array) $value) ->map(fn ($item, $itemKey) => is_string($itemKey) ? ucwords(str_replace('_', ' ', $itemKey)).': '.$item : $item) ->implode(', '); } return (string) $value; }; @endphp

{{ $title }}

ID: #{{ $listing->id ?? 'N/A' }}
arrow_back Back to List edit Edit Listing
{{ $meta['icon'] }} {{ $meta['label'] }}
@if ($heroMedia?->image_url) @else
{{ $meta['icon'] }}
@endif
Listing Specifications
@foreach ($fields as $key => $value)
{{ $fieldLabels[$key] ?? ucwords(str_replace('_', ' ', $key)) }}
{{ $formatValue($key, $value) }}
@endforeach
@if ($listing->listing_type === 'service') @if ($profileMedia?->image_url)
Profile Photo
@endif @if ($pastWorkMedia->isNotEmpty())
Past Work Images
@foreach ($pastWorkMedia as $media)
@endforeach
@endif @if ($toolsMedia->isNotEmpty())
Tools and Equipment Images
@foreach ($toolsMedia as $media)
@endforeach
@endif @if ($otherImageMedia->isNotEmpty())
Other Images
@foreach ($otherImageMedia as $media)
@endforeach
@endif @elseif ($imageMedia->count() > 1)
Supporting Media
@foreach ($imageMedia as $media)
@endforeach
@endif @if ($documentMedia->isNotEmpty())
{{ $listing->listing_type === 'service' ? 'Submitted Documents' : 'Verification Documents' }}
@endif
@include('admin.partials.footer')