@php $stageBadge = [ 'prospect' => 'sky', 'contacted' => 'cyan', 'meeting' => 'indigo', 'requirement' => 'violet', 'qualified' => 'fuchsia', 'proposal' => 'amber', 'negotiation' => 'orange', 'won' => 'emerald', 'lost' => 'rose', 'deferred' => 'slate', ]; $today = now()->startOfDay(); $overdue = $opportunity->isOpen() && $opportunity->next_action_due && $opportunity->next_action_due->lt($today); $notGiven = __('Not recorded'); $field = fn ($value) => filled($value) ? $value : null; $doneCount = collect($checklist)->where('done', true)->count(); $select = 'mt-1 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; @endphp
{{ __('Opportunities') }} @if ($canEdit) {{ __('Log activity') }} @if ($opportunity->customer?->phone) {{ __('Message') }} @endif {{ __('Edit') }} @endif {{-- Stage strip: where it stands, and the Change Stage action. --}}
{{ \App\Models\Opportunity::STAGES[$opportunity->stage] ?? $opportunity->stage }} @if ($opportunity->isOpen() && $opportunity->accepted_at !== null) {{ __('Accepted, awaiting confirmation') }} @endif {{ \App\Models\Opportunity::TYPES[$opportunity->type] ?? $opportunity->type }} {{ __(':p priority', ['p' => \App\Models\Opportunity::PRIORITIES[$opportunity->priority] ?? $opportunity->priority]) }} @if ($opportunity->stage_entered_at) {{ __('In this stage since :date', ['date' => $opportunity->stage_entered_at->timezone(config('app.display_timezone'))->format('j M Y')]) }} @endif
@if ($canEdit)
@foreach (\App\Models\Opportunity::STAGES as $key => $label) @continue($key === 'won' && $opportunity->stage !== 'won') @endforeach
@endif
@if ($opportunity->isOpen())

{{ __('Won is reached when Administration links the confirmed job for this opportunity.') }}

@endif
{{-- Next action, or the outcome --}} @if ($opportunity->isOpen())

{{ __('Next action') }}

{{ $opportunity->next_action ?: __('No next action recorded') }}

@if ($opportunity->next_action_due) {{ $overdue ? __('Overdue since :date', ['date' => $opportunity->next_action_due->format('j M Y')]) : __('Due :date', ['date' => $opportunity->next_action_due->format('l j M Y')]) }} @else {{ __('No date given') }} @endif

@else

{{ __('Outcome') }}

{{ \App\Models\Opportunity::STAGES[$opportunity->stage] }} @if ($opportunity->outcome_at) · {{ $opportunity->outcome_at->timezone(config('app.display_timezone'))->format('j M Y') }} @endif

@if ($reasonLabel)

{{ $reasonLabel }}

@endif @if ($opportunity->reason_note)

{{ $opportunity->reason_note }}

@endif @if ($opportunity->stage === 'deferred' && $opportunity->review_on)

{{ __('Review again on :date.', ['date' => $opportunity->review_on->format('j M Y')]) }}

@endif
@endif {{-- Requirement --}}

{{ __('Requirement') }}

{{ __('Need') }}
{{ $field($opportunity->need) ?? $notGiven }}
{{ __('Products') }}
{{ $field($opportunity->products) ?? $notGiven }}
{{ __('Quantity or scope') }}
{{ $field($opportunity->quantity_scope) ?? $notGiven }}
{{ __('Specifications') }}
{{ $field($opportunity->specifications) ?? $notGiven }}
{{ __('Wanted by') }}
{{ $opportunity->desired_delivery_on?->format('j M Y') ?? $notGiven }}
{{ __('Budget') }}
@if ($opportunity->budget !== null) {{ $opportunity->currency_code }} {{ number_format((float) $opportunity->budget, 2) }} @else {{ __('Not known') }} @endif @if ($opportunity->budget_note) {{ $opportunity->budget_note }} @endif
{{-- Catalogue lines. The Products note above stays for anything not in the catalogue. --}}

{{ __('Catalogue lines') }}

@php $catalogueLines = $opportunity->lines; $linesPriced = $catalogueLines->isNotEmpty() && $catalogueLines->every(fn ($line) => $line->unit_price !== null); @endphp
@forelse ($catalogueLines as $line) @empty @endforelse
{{ __('Item') }} {{ __('Size or variant') }} {{ __('Qty') }} {{ __('Unit price') }} {{ __('Total') }}
{{ $line->description }} {{ $line->variant ?: __('None') }} {{ (float) $line->quantity }} @if ($line->unit_price === null) {{ __('Not estimated') }} @else {{ $opportunity->currency_code }} {{ number_format((float) $line->unit_price, 2) }} @endif @if ($line->estimatedTotal() === null) {{ __('Not estimated') }} @else {{ $opportunity->currency_code }} {{ number_format($line->estimatedTotal(), 2) }} @endif
@if ($catalogueLines->isNotEmpty())
@if ($linesPriced)

{{ __('Line total: :amount', ['amount' => $opportunity->currency_code.' '.number_format($catalogueLines->sum(fn ($line) => $line->estimatedTotal()), 2)]) }}

@else

{{ __('Line total: Not estimated') }}

@endif

{{ __('The Products note above is for anything not in the catalogue. The estimated value can follow these lines and can still be changed.') }}

@endif
{{-- Buying process --}}

{{ __('Buying process') }}

{{ __('Decision-maker') }}
{{ $field($opportunity->decision_maker) ?? $notGiven }}
{{ __('Tender deadline') }}
{{ $opportunity->tender_deadline?->format('j M Y') ?? __('Not applicable') }}
{{ __('Procurement process') }}
{{ $field($opportunity->procurement_process) ?? $notGiven }}
{{ __('Decision criteria') }}
{{ $field($opportunity->decision_criteria) ?? $notGiven }}
{{ __('Competitors') }}
{{ $field($opportunity->competitors) ?? $notGiven }}
{{-- Value and dates --}}

{{ __('Estimated value') }}

@if ($opportunity->estimated_value === null)

{{ __('Not estimated') }}

@else

{{ $opportunity->currency_code }} {{ number_format((float) $opportunity->estimated_value, 2) }}

@if ($baseCode && $opportunity->currency_code !== $baseCode)

{{ $baseCode }} {{ number_format($opportunity->estimatedValueBaseOrNull(), 2) }} {{ __('at the rate when opened') }}

@endif @endif
{{ __('Expected close') }}
{{ $opportunity->expected_close_date?->format('j M Y') ?? $notGiven }}
{{ __('Source') }}
{{ $sources[$opportunity->source] ?? ($opportunity->source ?: __('Unknown')) }}
@if ($opportunity->campaign)
{{ __('Campaign') }}
{{ $opportunity->campaign->name }}
@endif @if ($opportunity->portfolio)
{{ __('Portfolio') }}
{{ $opportunity->portfolio->name }}
@endif
{{-- People --}}

{{ __('People') }}

{{ __('Originator') }}
{{ $opportunity->originator?->name ?? __('Not recorded') }}
{{ __('Who brought it in. Never changes.') }}
{{ __('Owner') }} @if ($canReassign) @endif
{{ $opportunity->owner?->name ?? __('No owner') }}
{{ __('Collaborators') }} @if ($canCollaborate) @endif
@forelse ($opportunity->collaborators as $collaborator)
{{ $collaborator->user?->name ?? __('Former member') }} · {{ $collaboratorRoles[$collaborator->role] ?? $collaborator->role }} @if ($canCollaborate) @endif
@empty
{{ __('Nobody yet') }}
@endforelse
{{ __('Contacts') }}
@forelse ($opportunity->contacts as $contact)
{{ $contact->name }} @if ($contact->pivot->is_primary) · {{ __('Primary') }} @endif @if ($contact->phone || $contact->email) {{ collect([$contact->phone, $contact->email])->filter()->implode(' · ') }} @endif
@empty
{{ __('No contact linked') }}
@endforelse
{{-- Qualification checklist --}}

{{ __('Qualification checklist') }}

{{ $doneCount }}/{{ count($checklist) }}
    @foreach ($checklist as $key => $item)
  • {{ $item['label'] }}
  • @endforeach

{{ __('All six are needed before Qualified, and before a quote stage.') }}

@if ($canDelete) @endif
{{-- Tabs --}} @if (count($tabs) > 0)
@foreach ($tabs as $key => $class) @endforeach
@switch($tab) @case('timeline') @break @case('tasks') @break @case('quotes') @break @case('handover') @break @case('files') @break @case('outcome') @break @case('products') @break @case('voice-notes') @break @endswitch
@endif
@include('livewire.crm.opportunities.partials.stage-dialog') {{-- Reassign: a director's act, with a reason. --}} {{ __('Reassign opportunity') }}

{{ __('The originator stays the same. The new and old owners are told, and the reason is kept on the timeline.') }}

{{ __('Cancel') }} {{ __('Reassign') }}
{{-- Add a collaborator --}} {{ __('Add a collaborator') }}

{{ __('Collaborators support the owner and can work on the opportunity. They are credited under "supported", never added to the owner\'s figures.') }}

{{ __('Cancel') }} {{ __('Add') }}
@include('livewire.partials.interactions-modal') @include('livewire.partials.compose-message-modal')