@php $tz = config('app.display_timezone'); $tabMeta = [ 'year' => ['label' => __('Rolling 12 months'), 'icon' => 'calendar'], 'outreach' => ['label' => __('Upcoming Outreach'), 'icon' => 'megaphone'], 'unconfirmed' => ['label' => __('Dates to confirm'), 'icon' => 'question-mark-circle'], 'starter' => ['label' => __('Starter set'), 'icon' => 'sparkles'], ]; $cards = [ ['key' => 'year', 'label' => __('Next 12 months'), 'value' => $counts['year'], 'icon' => 'calendar', 'accent' => '#d97706', 'sub' => __('Entries on the calendar')], ['key' => 'outreach', 'label' => __('Outreach open'), 'value' => $counts['open'], 'icon' => 'megaphone', 'accent' => '#ea580c', 'sub' => __('Windows open now')], ['key' => 'outreach', 'label' => __('Opening soon'), 'value' => $counts['soon'], 'icon' => 'clock', 'accent' => '#6366f1', 'sub' => __('Within :weeks weeks', ['weeks' => \App\Services\Crm\Calendar\CommercialCalendarService::UPCOMING_WEEKS])], ['key' => 'unconfirmed', 'label' => __('Dates to confirm'), 'value' => $counts['unconfirmed'], 'icon' => 'question-mark-circle', 'accent' => '#64748b', 'sub' => __('Not yet checked')], ]; $statusColor = ['planned' => 'sky', 'in_outreach' => 'orange', 'done' => 'emerald', 'cancelled' => 'slate']; $select = 'mt-1 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; // An unconfirmed entry is shown by its month only: its day is not known. $when = function (\App\Models\Crm\CalendarEvent $e) use ($tz): string { $start = $e->all_day ? $e->starts_at : $e->starts_at->copy()->timezone($tz); if (! $e->is_confirmed) { return __('Around :month', ['month' => $start->format('F Y')]); } $text = $start->format($e->all_day ? 'D j M Y' : 'D j M Y, H:i'); if ($e->ends_at !== null) { $end = $e->all_day ? $e->ends_at : $e->ends_at->copy()->timezone($tz); if ($end->format('Y-m-d') !== $start->format('Y-m-d')) { $text .= ' to '.$end->format('j M Y'); } elseif (! $e->all_day) { $text .= ' to '.$end->format('H:i'); } } return $text; }; @endphp
{{ __('Combined calendar') }} @if ($canCreate) {{ __('New entry') }} @endif
@foreach ($cards as $m) @endforeach
@foreach ($tabMeta as $key => $meta) @endforeach
@if ($tab === 'year')

{{ __('Rolling 12 months') }}

{{ __('From :from to :to. Yearly entries are carried forward automatically and need their new date confirmed.', ['from' => $today->format('j M Y'), 'to' => $today->copy()->addMonths(12)->format('j M Y')]) }}

@forelse ($months as $month => $entries) @foreach ($entries as $e) @include('livewire.crm.commercial-calendar.partials.row', ['e' => $e]) @endforeach @empty @endforelse
{{ __('When') }} {{ __('Event or opportunity') }} {{ __('Outreach starts') }} {{ __('Owner') }} {{ __('Status') }} {{ __('Actions') }}
{{ \Illuminate\Support\Carbon::parse($month.'-01')->format('F Y') }}
@include('livewire.crm.partials.paginator', ['rows' => $monthPage])
@elseif ($tab === 'outreach')

{{ __('Upcoming Outreach') }}

{{ __('Windows open now, and those opening in the next :weeks weeks. When a window opens its owner gets a task.', ['weeks' => \App\Services\Crm\Calendar\CommercialCalendarService::UPCOMING_WEEKS]) }}

@forelse ($upcoming as $e) @php $isOpen = $e->outreach_starts_on->lte($today); @endphp @empty @endforelse
{{ __('Outreach') }} {{ __('Event or opportunity') }} {{ __('Takes place') }} {{ __('Owner') }} {{ __('Task') }}
@if (! $e->is_confirmed) {{ __('Confirm the date first') }} @elseif ($isOpen) {{ __('Open now') }} @else {{ __('Opens :date', ['date' => $e->outreach_starts_on->format('D j M')]) }} {{ trans_choice('{1} in 1 day|[2,*] in :count days', $today->diffInDays($e->outreach_starts_on), ['count' => (int) $today->diffInDays($e->outreach_starts_on)]) }} @endif @if ($e->submission_deadline) {{ __('Submission deadline :date', ['date' => $e->submission_deadline->format('j M Y')]) }} @endif {{ $when($e) }} {{ $e->owner?->name ?? __('Nobody') }} @if ($e->outreachTask) {{ __(\App\Models\Crm\Task::STATUSES[$e->outreachTask->status] ?? $e->outreachTask->status) }} @else {{ __('Raised when the window opens') }} @endif
@include('livewire.crm.partials.paginator', ['rows' => $upcoming])
@elseif ($tab === 'unconfirmed')

{{ __('Dates to confirm') }}

{{ __('Starter entries and yearly entries carried forward. Their dates are guesses: check each with the organiser or the official calendar, edit the date, then confirm. Outreach never opens on an unconfirmed entry.') }}

@forelse ($unconfirmed as $e) @php $canEdit = \Illuminate\Support\Facades\Gate::allows('update', $e); @endphp @empty @endforelse
{{ __('When') }} {{ __('Event or opportunity') }} {{ __('Owner') }} {{ __('Actions') }}
{{ $when($e) }} {{ __('Date unconfirmed') }}

{{ $e->title }}

@if ($e->recurs_from_id)

{{ __('Carried forward from last year') }}

@endif
{{ $e->owner?->name ?? __('Nobody') }} @if ($canEdit)
@endif
@include('livewire.crm.partials.paginator', ['rows' => $unconfirmed])
@else

{{ __('Proposed starter set') }}

{{ __('Occasions buyers commonly plan around. The month is only a hint, not a date. Anything you add arrives unconfirmed, owned by you, and opens no outreach until its real date is checked and confirmed.') }}

@if ($canCreate) {{ __('Add selected as unconfirmed') }} @endif
@foreach (collect($proposalList)->groupBy('group', true) as $group => $items) @foreach ($items as $key => $p) @endforeach @endforeach
{{ __('Occasion') }} {{ __('Usual month (hint)') }} {{ __('Outreach lead time') }} {{ __('What to check') }}
{{ __($group) }}
@if ($p['added']) @elseif ($canCreate) @endif

{{ __($p['title']) }}

@if ($p['added'])

{{ __('Already on the calendar') }}

@endif
{{ __('Around :month', ['month' => $p['lands_on']->format('F')]) }} {{ trans_choice('{1} 1 week|[2,*] :count weeks', $p['outreach_weeks'], ['count' => $p['outreach_weeks']]) }} {{ __($p['hint']) }}
@endif
{{ $editingId ? __('Edit commercial entry') : __('New commercial entry') }}
@if ($startsOn !== '' && preg_match('/^\d{4}-\d{2}-\d{2}$/', $startsOn))

{{ __('Outreach opens on :date.', ['date' => \Illuminate\Support\Carbon::parse($startsOn)->subWeeks((int) $outreachWeeks)->format('D j M Y')]) }}

@endif
@if ($editingId)
@endif
@foreach ($linked['organisations'] as $org) {{ $org->name }} @endforeach @foreach ($linked['opportunities'] as $opp) {{ $opp->title }} @endforeach
@if ($results['organisations']->isNotEmpty() || $results['opportunities']->isNotEmpty())
    @foreach ($results['organisations'] as $org)
  • @endforeach @foreach ($results['opportunities'] as $opp)
  • @endforeach
@endif
@if ($editingId) @endif
{{ __('Close') }} {{ __('Save') }} {{ __('Saving…') }}