@php use App\Models\Activity; $seesAll = auth()->user()->seesAllRecords(); $total = $activities->count() + $loans->count() + $contacts->count() + $zoho->count(); @endphp
@error('q')

{{ $message }}

@enderror @unless ($zohoConfigured)
Zoho CRM is not connected, so only Top Gear CRM data is searched. Ask an administrator to configure the Zoho credentials to search Zoho contacts too.
@endunless @if ($zohoError)
{{ $zohoError }}
@endif @if ($term === '') @elseif ($total === 0) @else
@foreach (array_filter([ 'activities' => ['Activities', $activities->count()], 'loans' => ['Leads (loan data)', $loans->count()], 'contacts' => $seesAll ? ['Contacts', $contacts->count()] : null, 'zoho' => $zohoConfigured ? ['Zoho CRM', $zoho->count()] : null, ]) as $key => [$label, $count]) @endforeach
{{-- Activities --}}
@if ($activities->isEmpty()) @else
@foreach ($activities as $a) @endforeach
ContactSubjectStatusFinal remarkDueAssigned to
{{ $a->displayName() ?? 'Unnamed lead' }}
{{ $a->displayMobile() }} @if ($a->loanData?->car_reg_no) · {{ $a->loanData->car_reg_no }} @endif
{{ $a->subject ?: '—' }} {{ $a->status }} {{ $a->clean('final_remark_ins_loan') ?? '—' }} {{ $a->due_date?->format('d-m-Y') ?? '—' }} {{ $a->user?->name ?? '—' }} Open follow-up
@endif
{{-- Loan data leads --}}
@if ($loans->isEmpty()) @else
@foreach ($loans as $l) @php($acts = $activities->where('loantype_id', $l->id)) @endforeach
NameMobileReg noModelLocationAllocatedActivities
{{ $l->contact_name ?: '—' }} {{ $l->mobile ?: '—' }} {{ $l->car_reg_no ?: '—' }} {{ collect([$l->model_picklist, $l->vahan_year_pick_list])->filter()->implode(' · ') ?: '—' }} {{ $l->location ?: '—' }} {{ $l->data_allocation_date && $l->data_allocation_date->year > 1970 ? $l->data_allocation_date->format('d-m-Y') : '—' }}
@forelse ($acts as $a) {{ $a->user?->name ?? 'Activity #'.$a->id }} @empty Not assigned @endforelse
@endif
{{-- Local contacts --}} @if ($seesAll)
@if ($contacts->isEmpty()) @else
@foreach ($contacts as $c) @php($acts = $activities->where('contact_id', $c->contact_id)) @endforeach
NameMobileReg noModelLocationActivities
{{ Activity::firstFilled($c->contact_name, $c->company) ?? '—' }} @if ($c->keyword){{ $c->keyword }}@endif {{ $c->mobile ?: '—' }} {{ $c->car_reg_no ?: '—' }} {{ $c->model_picklist ?: '—' }} {{ $c->location ?: '—' }} @forelse ($acts as $a) {{ $a->user?->name ?? '#'.$a->id }} @empty — @endforelse
@endif
@endif {{-- Zoho CRM --}} @if ($zohoConfigured)
@csrf
selected
@if ($zoho->isEmpty()) @else
@foreach ($zoho as $z) @endforeach
Last nameMobileReg noVahan yearHPALocationIns start monthModelSegmentIn CRM
@unless ($z['in_contacts'])@endunless {{ $z['name'] ?? '—' }} {{ $z['mobile'] ?? '—' }} {{ $z['car_reg_no'] ?? '—' }} {{ $z['vahan_year'] ?? '—' }} {{ $z['hpa'] ?? '—' }} {{ $z['location'] ?? '—' }} {{ $z['ins_start_month'] ?? '—' }} {{ $z['model'] ?? '—' }} {{ $z['segment'] ?? '—' }} @if ($z['in_contacts'])Contact@endif @if ($z['loan_id'])Lead #{{ $z['loan_id'] }}@endif @if (! $z['in_contacts'] && ! $z['loan_id'])No@endif
@endif
@endif
@endif