@extends('admin.layouts.app') @section('title','Lead Management') @section('content') @php $hasFullAccess = auth('admin')->check() || (auth('staff')->check() && strcasecmp(auth('staff')->user()->designation?->name ?? '', 'Super Admin') === 0); $canManageLeads = $hasFullAccess || auth('staff')->check(); @endphp @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
@if($canManageLeads)@endif @foreach($leads as $key=>$lead) @if($canManageLeads)@endif @endforeach
S.No Lead No Customer Mobile Customer Type Enquiry Type Next Call Date Follow-ups Latest Follow-up Timeline StatusAction
{{ $key+1 }} {{ $lead->lead_number }} {{ $lead->customer->customer_name ?? '-' }} {{ $lead->customer->mobile ?? '-' }} {{ $lead->customer->customer_type ?? '-' }} {{ $lead->enquiry_type }} {{ $lead->next_call_date ? \Carbon\Carbon::parse($lead->next_call_date)->format('d-m-Y') : '-' }} {{ $lead->followup_count }} @if($canManageLeads && $lead->status !== 'Converted' && $lead->status !== 'Rejected') @endif @if($lead->latestFollowUp)
{{ $lead->latestFollowUp->followup_status }}
{{ $lead->latestFollowUp->remarks }}
{{ \Carbon\Carbon::parse($lead->latestFollowUp->followup_date)->format('d-m-Y') }}
@else No Follow-up @endif
@php $class='badge-success'; if($lead->status=='Follow Up'){ $class='badge-warning'; } elseif($lead->status=='Converted'){ $class='badge-primary'; } elseif(in_array($lead->status,['Rejected','Lost'])){ $class='badge-danger'; } @endphp {{ $lead->status }} @if($hasFullAccess) @if($lead->status !== 'Converted' && $lead->status !== 'Rejected') @elseif($lead->status === 'Converted') @else @endif
@csrf @method('DELETE')
@else @endif
@endsection