{{ __('Lead Details') }}: {{ $lead->client_name }}

{{ $lead->status->name }} Stage {{ $lead->stage_indicator }}
@php $todayDate = now()->format('Y-m-d'); $assignedToLabel = $lead->assignedUsers->isNotEmpty() ? $lead->assignedUsers->pluck('name')->join(', ') : $lead->assignedTo?->name ?? 'Unassigned'; $projectStartDate = $lead->next_follow_up ? \Carbon\Carbon::parse($lead->next_follow_up)->format('Y-m-d') : $todayDate; $wonStatus = $statuses->first(function ($status) { return strtolower((string) $status->name) === 'won'; }); $authUser = auth()->user(); $canUpdateLeadStatus = $authUser && $authUser->hasPermission('leads.status.update'); $canCommentLead = $authUser && $authUser->hasPermission('leads.comment'); $canManageQuotation = $authUser && $authUser->hasPermission('leads.quotation.manage'); $canUploadSurvey = $authUser && $authUser->hasPermission('leads.survey.upload'); $canUploadDocuments = $authUser && $authUser->hasPermission('leads.documents.upload'); $canDownloadSummary = $authUser && $authUser->hasPermission('leads.summary.download'); @endphp

Contact Information

Email: {{ $lead->email ?? 'N/A' }}

Mobile: {{ $lead->mobile ?? 'N/A' }}

Address: {{ $lead->address ?? 'N/A' }}

Lead Details

Category: {{ $lead->category->name }}

Source: {{ $lead->source ?? 'N/A' }}

Assigned To: {{ $assignedToLabel }}

Estimated Value: ₹{{ number_format($lead->estimated_value, 2) }}

Priority: {{ $lead->priority }}

Next Follow Up: {{ $lead->next_follow_up ? \Carbon\Carbon::parse($lead->next_follow_up)->format('M d, Y') : 'Not scheduled' }}

    @foreach ($lead->activities as $activity)
  • @if (!$loop->last) @endif
    @if ($activity->type === 'status_change') @elseif($activity->type === 'note') @else @endif

    {{ $activity->description }} by {{ $activity->user->name ?? 'System' }}

  • @endforeach
@if ($canUploadSurvey)
@csrf

No file selected.

Upload
@endif
@forelse($lead->surveys as $survey)
@php $surveyImageUrl = $survey->display_url ?? (!empty($survey->photo_path) ? (\Illuminate\Support\Str::startsWith($survey->photo_path, [ 'http://', 'https://', '/', ]) ? $survey->photo_path : asset('storage/' . ltrim($survey->photo_path, '/'))) : null); @endphp @if ($surveyImageUrl) Survey Photo @else
Image not available
@endif

{{ $survey->description }}

@empty

No survey photos uploaded yet.

@endforelse
@php $hasApprovedQuotation = $lead->quotations->contains(function ($q) { return strtolower((string) $q->status) === 'accepted'; }); $isConvertedToProject = (bool) $lead->project; $showQuotationVersion = filled($lead->company?->quotation_prefix) || filled($lead->company?->quotation_sequence); $nextQuotationVersion = old('version', (($lead->quotations->count() + 1)) . '.0'); @endphp @if ($canManageQuotation)
@csrf
@if ($showQuotationVersion)
@endif
@if ($canDownloadSummary) @endif @if ($hasApprovedQuotation) @else Upload Quotation @endif
@endif @if ($hasApprovedQuotation)

Quotation actions are locked because one quotation is already approved.

@endif @if ($isConvertedToProject) This lead is already converted to a project. Additional conversion actions are disabled. @endif
@if ($lead->quotations->count())
@foreach ($lead->quotations as $quote)

Version {{ $quote->version }}

@if(strtolower($quote->status) === 'accepted') {{ $quote->status }} @endif

@if ($canManageQuotation) Download File @endif @if ( $canManageQuotation && !$hasApprovedQuotation && !$isConvertedToProject && !in_array(strtolower((string) $quote->status), ['accepted', 'rejected'], true))
@csrf @method('PATCH')
@endif
@endforeach
@else

No quotations managed yet.

@endif
@foreach ($lead->comments as $comment)
{{ $comment->user->name }} {{ $comment->created_at->diffForHumans() }}

{{ $comment->comment }}

@endforeach
@if ($canCommentLead)
@csrf
Post Comment
@endif
@php $acceptedQuotation = $lead->quotations->first(function ($quote) { return strtolower((string) $quote->status) === 'accepted'; }); $effectiveValue = $acceptedQuotation?->amount ?? $lead->estimated_value; @endphp

Lead Summary

Client: {{ $lead->client_name }} | Status: {{ $lead->status->name }} | Effective Value: ₹{{ number_format((float) $effectiveValue, 2) }}

@if ($canDownloadSummary) @endif
@if ($canUploadDocuments)
@csrf
Upload

No file selected.

@endif
@forelse($lead->documents as $doc)
{{ $doc->name }}
View
@empty

No general documents stored yet.

@endforelse
@if ($canUpdateLeadStatus) @endif @if ($canManageQuotation) @endif
@if (session('success')) @endif @if (session('error')) @endif @if ($errors->any()) @endif