@php $tz = config('app.display_timezone'); $tabMeta = [ 'overdue' => ['label' => __('Overdue'), 'icon' => 'exclamation-triangle', 'accent' => '#e11d48', 'sub' => __('Past their due time')], 'today' => ['label' => __('Today'), 'icon' => 'clock', 'accent' => '#f59e0b', 'sub' => __('Still to do today')], 'week' => ['label' => __('This Week'), 'icon' => 'calendar-days', 'accent' => '#6366f1', 'sub' => __('From now to Sunday')], 'open' => ['label' => __('All Open'), 'icon' => 'queue-list', 'accent' => '#0ea5e9', 'sub' => __('Everything not done')], 'done' => ['label' => __('Completed'), 'icon' => 'check-circle', 'accent' => '#10b981', 'sub' => __('With their outcomes')], ]; $priorityColor = ['high' => 'rose', 'medium' => 'amber', 'low' => 'slate']; $empty = [ 'overdue' => [__('Nothing overdue'), __('Every task is on time. Keep it that way by rescheduling with a reason rather than letting a date slip.')], 'today' => [__('Nothing else due today'), __('Tasks due later today appear here.')], 'week' => [__('Nothing due this week'), __('Tasks due between now and Sunday appear here.')], 'open' => [__('No open tasks'), __('Add one, or complete an activity and set its next action.')], 'done' => [__('Nothing completed yet'), __('Completed tasks are kept here with their outcome.')], ]; $hasFilters = $type !== '' || $assignee || trim($q) !== '' || $record; @endphp
@if ($canCreate) {{ __('New task') }} @endif {{-- One card per view; each opens its list --}}
@foreach ($tabMeta as $key => $m) @endforeach
@foreach ($tabMeta as $key => $meta) @endforeach
@if ($seesTeam)
@endif

{{ $tabMeta[$view]['label'] }}

{{ $scope === 'team' ? __('Everyone on the team') : __('Assigned to you') }} @if ($record) · {{ $record instanceof \App\Models\Opportunity ? $record->title : $record->name }} @endif

@if ($seesTeam && $scope === 'team') @endif
@if ($scope === 'team') @endif @forelse ($tasks as $task) @php $overdue = $task->isOverdue(); $canEdit = $task->isOpen() && \Illuminate\Support\Facades\Gate::allows('update', $task); @endphp @if ($scope === 'team') @endif @empty @endforelse
{{ $view === 'done' ? __('Completed') : __('Due') }} {{ __('Task') }} {{ __('Regarding') }}{{ __('Assigned to') }}{{ __('Priority') }} {{ __('Actions') }}
@if ($view === 'done') {{ $task->completed_at?->copy()->timezone($tz)->format('j M Y') }} @elseif ($task->due_at) {{ $task->due_at->copy()->timezone($tz)->format('D j M') }} @unless (\App\Services\Crm\TaskService::isDateOnly($task->due_at)) {{ $task->due_at->copy()->timezone($tz)->format('H:i') }} @endunless @if ($overdue) {{ $task->due_at->diffForHumans($now, \Carbon\CarbonInterface::DIFF_ABSOLUTE) }} {{ __('late') }} @endif @else {{ __('No date') }} @endif

{{ $task->title }}

{{ __(\App\Models\Crm\Task::TYPES[$task->type] ?? $task->type) }} @if ($task->reschedule_count > 0) {{ trans_choice('{1} rescheduled once|[2,*] rescheduled :count times', $task->reschedule_count, ['count' => $task->reschedule_count]) }} @endif

@if ($view === 'done' && $task->outcome)

{{ $task->status === 'cancelled' ? __('Cancelled') : __('Outcome') }}: {{ $task->outcome }}

@elseif ($task->description)

{{ \Illuminate\Support\Str::limit($task->description, 140) }}

@endif
@if ($task->opportunity) {{ $task->opportunity->title }} @if ($task->customer) {{ $task->customer->name }} @endif @elseif ($task->customer) {{ $task->customer->name }} @else {{ __('General') }} @endif {{ $task->assignee?->name ?? __('Nobody') }} {{ __(\App\Models\Crm\Task::PRIORITIES[$task->priority] ?? $task->priority) }}
@if ($canEdit) @elseif ($view === 'done') {{ $task->completedBy?->name }} @endif
{{ $tasks->links() }}