@php $statusColors = ['draft' => 'slate', 'scheduled' => 'sky', 'active' => 'emerald', 'completed' => 'indigo', 'cancelled' => 'rose']; $money = fn (?float $value): ?string => $value === null ? null : $base.' '.number_format($value, 2); $cards = [ ['label' => __('Enquiries'), 'value' => number_format($figures['enquiries']), 'icon' => 'inbox', 'accent' => '#0ea5e9', 'sub' => __(':first new, :influence known', ['first' => $figures['first'], 'influence' => $figures['influence']]), 'source' => __('Each arrival through the tracked link, the QR code, or a lead form that named this campaign.')], ['label' => __('Qualified'), 'value' => number_format($figures['qualified']), 'icon' => 'check-circle', 'accent' => '#10b981', 'sub' => trans_choice(':count opportunity opened|:count opportunities opened', $figures['opportunities'], ['count' => $figures['opportunities']]), 'source' => __('Opportunities on this campaign that reached Qualified for the first time.')], ['label' => __('Open pipeline'), 'value' => $money($figures['open_value']) ?? __('Not estimated'), 'icon' => 'funnel', 'accent' => '#8b5cf6', 'sub' => $figures['open_not_estimated'] > 0 ? __(':count open, :n not estimated', ['count' => $figures['open_count'], 'n' => $figures['open_not_estimated']]) : trans_choice(':count open|:count open', $figures['open_count'], ['count' => $figures['open_count']]), 'source' => __('Open opportunities on this campaign, in the base currency. A blank value was never estimated.')], ['label' => __('Confirmed orders'), 'value' => $money($figures['confirmed']) ?? __('Not available'), 'icon' => 'flag', 'accent' => '#16a34a', 'sub' => trans_choice(':count won|:count won', $figures['won'], ['count' => $figures['won']]), 'source' => __('Won opportunities. The same confirmed figure as each opportunity\'s outcome.')], ['label' => __('Invoiced'), 'value' => $money($figures['invoiced']) ?? __('Not available'), 'icon' => 'banknotes', 'accent' => '#f59e0b', 'sub' => __('Net of voided invoices'), 'source' => __('Invoices raised on those won opportunities. Voided invoices are left out.')], ]; $tabMeta = [ 'overview' => ['label' => __('Overview'), 'icon' => 'squares-2x2'], 'enquiries' => ['label' => __('Enquiries'), 'icon' => 'inbox'], 'content' => ['label' => __('Content'), 'icon' => 'photo'], 'audience' => ['label' => __('Audience'), 'icon' => 'user-group'], ]; @endphp
{{ __('Campaigns') }} @if ($canEdit) @if (! in_array($campaign->status, ['completed', 'cancelled'], true)) {{ __('Edit') }} @endif @if (in_array('draft', $transitions, true)) {{ __('Back to draft') }} @endif @if (in_array('cancelled', $transitions, true)) {{ __('Cancel campaign') }} @endif @if (in_array('scheduled', $transitions, true)) {{ __('Schedule') }} @elseif (in_array('active', $transitions, true)) {{ __('Start') }} @elseif (in_array('completed', $transitions, true)) {{ __('Complete and review') }} @endif @endif
{{ __(\App\Models\Crm\Campaign::STATUSES[$campaign->status] ?? $campaign->status) }} @if ($campaign->starts_on) {{ $campaign->starts_on->format('j M Y') }}{{ $campaign->ends_on ? ' – '.$campaign->ends_on->format('j M Y') : '' }} @endif @if ($sectorLabel) {{ $sectorLabel }} @endif {{ $campaign->code }}
@if ($campaign->status === 'draft' && $missing !== [])

{{ __('Before this campaign can be scheduled, the brief needs: :fields.', ['fields' => implode(', ', $missing)]) }}

@endif
@foreach ($cards as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
@foreach ($tabMeta as $key => $meta) @endforeach
@if ($tab === 'overview')

{{ __('Brief') }}

@foreach ([ __('Objective') => $campaign->objective ?: __('Not set'), __('Target sector') => $sectorLabel ?? __('Not set'), __('Dates') => $campaign->starts_on ? $campaign->starts_on->format('j M Y').($campaign->ends_on ? ' to '.$campaign->ends_on->format('j M Y') : __(', open-ended')) : __('Not set'), __('Offer') => $campaign->offer ?: __('Not set'), __('Call to action') => $campaign->call_to_action ?: __('Not set'), __('Success measure') => $campaign->success_measure ?: __('Not set'), ] as $label => $value)
{{ $label }}
{{ $value }}
@endforeach
{{ __('Channels') }}
@forelse ($campaign->channels ?? [] as $channel) {{ $channelLabels[$channel] ?? $channel }} @empty {{ __('None chosen') }} @endforelse
@if ($campaign->review_worked || $campaign->review_not_worked || $campaign->review_repeat)

{{ __('Review') }}

@foreach (\App\Services\Crm\CampaignService::REVIEW_FIELDS as $field => $label)
{{ __($label) }}
{{ $campaign->{$field} ?: __('Not recorded') }}
@endforeach
@endif

{{ __('Tracked link and QR code') }}

@if ($trackedUrl)

{{ __('Anyone who requests a quote through this link or code is credited to the campaign automatically.') }}

{{ __('QR code for :name', ['name' => $campaign->name]) }}
{{ __('Download QR code for print') }}
@elseif ($campaign->status === 'draft')

{{ __('The link and QR code are issued when the campaign is scheduled, so nothing goes out before the brief is agreed.') }}

@else

{{ __('The public request form is switched off for this workspace. Turn it on in the requests queue settings to get a tracked link.') }}

@endif
@if ($channelLinks !== [])

{{ __('Links for each channel') }}

{{ __('Use the link for the channel you are posting in. Google and Meta add their click ID when someone clicks the ad.') }}

    @foreach ($channelLinks as $link)
  • {{ __($link['label']) }}

    @if ($link['on_campaign']) {{ __('On this campaign') }} @endif
  • @endforeach
@endif

{{ __('Spend') }}

{{ __('Planned') }}
{{ $money($figures['planned']) ?? __('Not set') }}
{{ __('Actual') }}
{{ $money($figures['actual']) ?? __('None recorded') }}

{{ __('Actual spend is read from Marketing expenses linked to this campaign. A campaign never authorises spending; Finance records it on the Expenses page.') }}

@if ($expenses->isNotEmpty())
    @foreach ($expenses as $expense)
  • {{ $expense->vendor ?: ($expense->description ?: __('Expense')) }} {{ $expense->incurred_on?->format('j M Y') }} {{ $expense->currency_code }} {{ number_format((float) $expense->amount, 2) }}
  • @endforeach
@endif

{{ __('Where these numbers come from') }}

    @foreach ($cards as $m)
  • {{ $m['label'] }}

    {{ $m['source'] }}

  • @endforeach
  • {{ __('Spend') }}

    {{ __('Planned spend is the figure in the brief. Actual spend is Marketing expenses on the Expenses page that name this campaign, in the base currency.') }}

{{ __('The five results are read live and kept apart. They measure different things and are never added together.') }}

@endif @if ($tab === 'enquiries')

{{ __('Enquiries') }}

{{ __('An organisation new to us takes this campaign as its original source. One already on record keeps its source; the campaign is recorded as influence.') }}

@forelse ($touches as $touch) @empty @endforelse
{{ __('When') }} {{ __('Organisation') }} {{ __('Credit') }} {{ __('Opportunity') }} {{ __('Request') }}
{{ $touch->occurred_at?->timezone(config('app.display_timezone'))->format('j M Y, H:i') }} @if ($touch->customer && $canOpenOrganisations) {{ $touch->customer->name }} @else {{ $touch->customer?->name ?? __('Counter order, no organisation') }} @endif {{ __(\App\Models\Crm\CampaignTouch::KINDS[$touch->kind] ?? $touch->kind) }} @if ($touch->opportunity) @if ($canOpenOpportunities) {{ $touch->opportunity->title }} @else {{ $touch->opportunity->title }} @endif

{{ __(\App\Models\Opportunity::STAGES[$touch->opportunity->stage] ?? $touch->opportunity->stage) }} · {{ $touch->opportunity->owner?->name ?? __('No owner') }}

@else - @endif
{{ $touch->serviceRequest?->reference ?? '-' }}
@if ($touches->hasPages())
{{ $touches->links() }}
@endif
@endif @if ($tab === 'content') @php $contentColors = ['idea' => 'slate', 'draft' => 'amber', 'review' => 'sky', 'approved' => 'indigo', 'published' => 'emerald', 'cancelled' => 'rose']; @endphp

{{ __('Content for this campaign') }}

{{ __('Planned and published on the content calendar') }}

{{ __('Open in the content calendar') }}
@forelse ($content as $item) @empty @endforelse
{{ __('Publish') }} {{ __('Title') }} {{ __('Channel') }} {{ __('Author') }} {{ __('Status') }}
{{ $item->publish_at?->timezone(config('app.display_timezone'))->format('j M Y') ?? __('Not scheduled') }} {{ $item->title }} {{ $channelLabels[$item->channel] ?? ($item->channel ?: '-') }} {{ $item->author?->name ?? '-' }} {{ __(\App\Models\Crm\ContentItem::STATUSES[$item->status] ?? $item->status) }}
@if ($content->hasPages())
{{ $content->links() }}
@endif
@endif @if ($tab === 'audience')

{{ __('Who this campaign may contact directly') }}

{{ __('Contacts at organisations in :sector. Anyone who withdrew marketing consent, and every organisation marked Do Not Contact, is left out.', ['sector' => $sectorLabel ?? __('the target sector')]) }} @if ($optedOut > 0) {{ trans_choice(':count person in this sector has opted out and is excluded.|:count people in this sector have opted out and are excluded.', $optedOut, ['count' => $optedOut]) }} @endif

@forelse ($audience as $contact) @empty @endforelse
{{ __('Contact') }} {{ __('Organisation') }} {{ __('Preferred channel') }} {{ __('Consent') }}
{{ $contact->name }} @if ($contact->title){{ $contact->title }}@endif {{ $contact->customer?->name ?? '-' }} {{ __(\App\Models\Crm\Contact::CHANNELS[$contact->preferred_channel] ?? '-') }} {{ __(\App\Models\Crm\Contact::CONSENTS[$contact->marketing_consent] ?? $contact->marketing_consent) }}
@if ($audience->hasPages())
{{ $audience->links() }}
@endif
@endif {{-- This campaign's emails and their results (S21). Mounted once it is built. --}} @unless (\App\Livewire\Crm\Campaigns\EmailSends::isComingSoon()) @endunless
@if ($canEdit) {{ __('Edit campaign') }} @include('livewire.crm.campaigns.partials.form') {{ __('Cancel') }} {{ __('Save') }} {{ __('Saving…') }} {{ $closeAs === 'completed' ? __('Complete the campaign') : __('Cancel the campaign') }}

{{ $closeAs === 'completed' ? __('A short review, so the next campaign starts from what this one taught us. All three are needed.') : __('Optional: note what was learned before it stopped.') }}

{{ __('Back') }} {{ $closeAs === 'completed' ? __('Complete campaign') : __('Cancel campaign') }} {{ __('Saving…') }}
@endif