@extends('layouts.admin') @section('title', 'Leads') @section('content') @php $canManage = auth()->user()?->hasPermission('leads', 'manage'); $currentType = $type ?? ''; $typeLabels = [ 'property' => ['label' => 'Property', 'icon' => 'bi-building', 'route' => 'admin.properties.show'], 'job' => ['label' => 'Job', 'icon' => 'bi-briefcase', 'route' => 'admin.jobs.show'], 'education' => ['label' => 'Education', 'icon' => 'bi-mortarboard', 'route' => 'admin.educations.show'], 'service' => ['label' => 'Service', 'icon' => 'bi-wrench-adjustable-circle', 'route' => 'admin.services.show'], 'contact' => ['label' => 'Contact', 'icon' => 'bi-envelope-open', 'route' => null], ]; @endphp

Leads Management

Track and update incoming leads across every module

@if($currentType !== '') @endif
Reset Total: {{ $leads->total() }}
Type Name Mobile Listing / Service Location Status Created Actions @forelse($leads as $lead) @php $leadType = $lead->module_type ?? $lead->service?->type ?? ($lead->listing?->service?->type ?? null); $typeInfo = $typeLabels[$leadType] ?? null; $listingLinkRoute = $typeInfo['route'] ?? null; $listingLinkParam = match ($leadType) { 'job' => 'job', 'education' => 'education', 'service' => 'localService', 'service_category' => 'serviceCategory', 'contact' => 'property', default => 'property', }; $linkedModule = $lead->module ?? $lead->listing; $linkedTitle = $linkedModule?->name ?? $linkedModule?->title ?? $lead->service?->title; $displayTypeInfo = $leadType === 'service_category' ? ['label' => 'Service Category', 'icon' => 'bi-tags', 'route' => 'web.services.category.show'] : $typeInfo; $linkedLocation = $lead->location ?: ($linkedModule?->location ?? null); @endphp @if($displayTypeInfo ?? $typeInfo) {{ ($displayTypeInfo ?? $typeInfo)['label'] }} @else — @endif
{{ $lead->name }}
@if($lead->user) {{ $lead->user->email ?: $lead->user->mobile }} @endif {{ $lead->mobile }} @if($linkedModule) @if($leadType === 'service_category') {{ $linkedTitle }} @elseif($listingLinkRoute) {{ $linkedTitle }} @else {{ $linkedTitle }} @endif @if($leadType !== 'service_category')
{{ $lead->service?->title ?? '-' }}
@endif @else
{{ $lead->service?->title ?? '-' }}
No specific listing
@endif {{ $linkedLocation ?: '-' }} @if($canManage)
@csrf @method('PUT')
@else {{ ucfirst(str_replace('_', ' ', $lead->status)) }} @endif {{ $lead->created_at?->format('d M Y') }} @empty No leads found{{ $currentType !== '' ? ' for this type' : '' }}. @endforelse
{{ $leads->links() }}
@endsection