@include('frontend.partials.head', ['title' => 'Fily | Listing Details'])
@include('frontend.dashboard.partials.styles')
@php
$providerName = $provider?->business_name ?: ($provider?->name ?: 'Provider');
$providerInitial = strtoupper(substr($providerName, 0, 1));
$typeMeta = [
'job' => ['label' => 'Job', 'icon' => 'work'],
'rent' => ['label' => 'Rental', 'icon' => 'apartment'],
'hostel' => ['label' => 'Hostel', 'icon' => 'bed'],
'service' => ['label' => 'Service', 'icon' => 'construction'],
];
$statusMeta = [
'pending' => ['label' => 'Pending', 'class' => 'warning'],
'rejected' => ['label' => 'Rejected', 'class' => 'danger'],
'approved' => ['label' => 'Accepted', 'class' => 'success'],
];
$visibilityMeta = [
'visible' => ['label' => 'Visible publicly', 'class' => 'success', 'icon' => 'visibility'],
'hidden' => ['label' => 'Hidden from public', 'class' => 'warning', 'icon' => 'visibility_off'],
'expired' => ['label' => 'Expired ad', 'class' => 'danger', 'icon' => 'event_busy'],
];
$meta = $typeMeta[$type] ?? ['label' => 'Listing', 'icon' => 'inventory_2'];
$statusInfo = $statusMeta[$listing->status] ?? ['label' => ucfirst((string) $listing->status), 'class' => 'warning'];
$visibility = $listing->visibility ?: 'visible';
$visibilityInfo = $visibilityMeta[$visibility] ?? $visibilityMeta['visible'];
$heroStatus = ''.e($statusInfo['label']).''
.''.$visibilityInfo['icon'].''.e($visibilityInfo['label']).'';
$canEdit = $listing->status !== 'approved';
$title = match ($type) {
'job' => $listing->job_title,
'rent' => $listing->name ?: ($listing->property_kind ?: $listing->property_type),
'hostel' => $listing->hostel_type,
'service' => $listing->name ?: ($listing->serviceType?->name ?: $listing->service_type),
default => 'Listing',
} ?: 'Listing';
$fieldGroups = [
'job' => [
'Basics' => [
['agent_id_code', 'Agent ID code'], ['company_name', 'Company name'], ['job_title', 'Job title', 'required'], ['job_type', 'Job type'], ['job_category', 'Category'],
['department', 'Department'], ['employment_type', 'Employment type'], ['experience_required', 'Experience required'],
['education_required', 'Education required'], ['post_role', 'Post role'], ['designation', 'Designation'],
['application_deadline', 'Application deadline', 'date'], ['number_of_openings', 'Openings', 'number'],
],
'Salary and Location' => [
['monthly_salary', 'Monthly salary', 'number'], ['min_salary', 'Minimum salary', 'number'], ['salary_type', 'Salary type'],
['job_shift', 'Job shift'], ['work_type', 'Work type'], ['location', 'Area / Location'], ['city', 'City'], ['state', 'State'], ['pincode', 'Pincode'],
],
'Details' => [
['skills_required', 'Skills required', 'csv'], ['responsibilities', 'Responsibilities', 'textarea_array'],
['apply_channels', 'Apply channels', 'csv'], ['apply_whatsapp_number', 'Apply WhatsApp number'],
['job_description', 'Description', 'textarea'], ['employer_terms_accepted', 'Employer terms accepted', 'boolean'],
],
],
'rent' => [
'Property' => [
['agent_id_code', 'Agent ID code'], ['name', 'Listing name'], ['property_kind', 'Property kind'], ['property_type', 'Property type'], ['furnishing_status', 'Furnishing status'],
['address', 'Address', 'textarea'], ['area_locality', 'Area / locality'], ['nearest_landmark', 'Nearest landmark'],
['latitude', 'Latitude', 'number'], ['longitude', 'Longitude', 'number'],
['city', 'City'], ['state', 'State'], ['district', 'District'], ['pincode', 'Pincode'],
],
'Pricing' => [
['rent_per_month', 'Rent per month', 'number'], ['security_deposit', 'Security deposit', 'number'],
['maintenance_type', 'Maintenance type'], ['available_from', 'Available from', 'date'], ['lease_duration', 'Lease duration'],
['area_sqft', 'Area sqft', 'number'], ['parking_type', 'Parking type'],
],
'Contact and Notes' => [
['willing_to_rent_to', 'Willing to rent to'], ['additional_spaces', 'Additional spaces', 'array_input'],
['contact_number', 'Contact number'], ['whatsapp_number', 'WhatsApp number'], ['description', 'Description', 'textarea'],
['details_confirmed', 'Details confirmed', 'boolean'], ['platform_terms_accepted', 'Platform terms accepted', 'boolean'],
],
],
'hostel' => [
'Basics' => [
['agent_id_code', 'Agent ID code'], ['hostel_type', 'Preferred for'], ['property_type', 'Property type'], ['owner_name', 'Owner name'], ['contact_number', 'Contact number'],
['whatsapp_number', 'WhatsApp number'], ['address', 'Address', 'textarea'], ['city', 'City'],
['district', 'District'], ['area_landmark', 'Area landmark'], ['total_rooms', 'Total rooms', 'number'], ['total_bed_capacity', 'Bed capacity', 'number'],
],
'Pricing and Rules' => [
['bed_sharing_type', 'Bed sharing type'], ['bathroom_type', 'Bathroom type'], ['monthly_rent', 'Monthly rent', 'number'],
['security_deposit', 'Security deposit', 'number'], ['electricity_charge_type', 'Electricity charge type'],
['electricity_charges', 'Electricity charges', 'number'], ['gate_open_time', 'Gate open time', 'time'], ['gate_close_time', 'Gate close time', 'time'],
['visitor_policy', 'Visitor policy', 'textarea'], ['house_rules', 'House rules', 'textarea'], ['description', 'Description', 'textarea'],
],
'Facilities' => [
['wifi_available', 'WiFi', 'boolean'], ['food_mess', 'Food / mess', 'boolean'], ['drinking_water', 'Drinking water', 'boolean'],
['power_backup', 'Power backup', 'boolean'], ['study_room', 'Study room', 'boolean'], ['cctv', 'CCTV', 'boolean'],
['security_guard', 'Security guard', 'boolean'], ['terms_accepted', 'Terms accepted', 'boolean'],
],
],
'service' => [
'Service Details' => [
['agent_id_code', 'Agent ID code'], ['name', 'Listing name'], ['service_type', 'Service type'], ['service_sub_type_name', 'Service sub type'], ['experience_years', 'Experience years', 'number'], ['service_area', 'Service area'],
['phone_number', 'Phone number'], ['service_radius', 'Service radius', 'number'], ['inspection_charge', 'Inspection charge', 'number'],
['starting_price', 'Starting price', 'number'], ['pricing_unit', 'Pricing unit'], ['hourly_rate', 'Hourly rate', 'number'],
['price_type', 'Price type'], ['working_days', 'Working days', 'array_input'], ['description', 'Description', 'textarea'],
['terms_accepted', 'Terms accepted', 'boolean'], ['guidelines_accepted', 'Guidelines accepted', 'boolean'], ['refund_policy_accepted', 'Refund policy accepted', 'boolean'],
],
],
];
$mediaItems = ($listing->media ?? collect())->map(function ($media) {
$media->image_url = $media->file_path ? asset('storage/'.$media->file_path) : null;
return $media;
})->filter(fn ($media) => $media->image_url && ($media->file_type ?? null) === 'image');
$valueFor = function (string $field) use ($listing) {
if ($field === 'service_type') {
return $listing->serviceType?->name ?: $listing->service_type;
}
if ($field === 'service_sub_type_name') {
return $listing->serviceSubType?->name;
}
if (in_array($field, ['job_type', 'property_type'], true) && is_string($listing->{$field} ?? null)) {
return ucwords(str_replace('_', ' ', $listing->{$field}));
}
$value = $listing->{$field} ?? null;
if ($value instanceof \Illuminate\Support\Carbon) {
return $value->format('Y-m-d');
}
if (is_array($value)) {
return implode(', ', $value);
}
return $value;
};
@endphp
@include('frontend.partials.header')
@include('frontend.dashboard.provider.partials.hero', [
'provider' => $provider,
'kicker' => $meta['label'].' listing',
'title' => $title,
'description' => $canEdit ? 'You can edit this listing until admin accepts it.' : 'This listing is accepted and available for view only.',
'status' => $heroStatus,
'actionUrl' => route('frontend.provider.lists', ['status' => $listing->status === 'approved' ? 'accepted' : $listing->status]),
'actionIcon' => 'arrow_back',
'actionLabel' => 'Back',
])
@include('frontend.dashboard.provider.partials.sidebar', ['provider' => $provider, 'active' => 'lists'])
@if (session('status'))
{{ session('status') }}
@endif
@if ($errors->any())
Please review the form.@foreach ($errors->all() as $error)- {{ $error }}
@endforeach
@endif
{{ $meta['icon'] }}
{{ $canEdit ? 'Edit details' : 'View details' }}
Listing ID LST-{{ strtoupper($type) }}-{{ str_pad((string) $listing->id, 5, '0', STR_PAD_LEFT) }}
@if ($canEdit)
@endif
Uploaded media
@if ($mediaItems->isNotEmpty())
@else
No media uploaded for this listing.
@endif
@include('frontend.partials.footer')