@php $recentList = collect($recentActivities ?? []); $recentCount = $recentList->count(); $activityTypeSelectOptions = [['value' => '', 'label' => 'Select type…']]; foreach (($activityTypes ?? []) as $type) { $displayName = $type->code === 'online_ads_posted' ? 'Online Ad' : $type->name; $activityTypeSelectOptions[] = [ 'value' => (string) $type->id, 'label' => $displayName.' ('.(int) $type->default_points.' pts)', ]; } $leadSelectOptions = [['value' => '', 'label' => 'Select lead…']]; foreach (($leads ?? []) as $lead) { $leadLabel = $lead->displayName(); $leadLabel = $leadLabel === '—' ? 'Lead' : $leadLabel; $leadSelectOptions[] = [ 'value' => (string) $lead->id, 'label' => '#'.$lead->id.' — '.$leadLabel, ]; } $prospectSelectOptions = [['value' => '', 'label' => 'Select prospect…']]; foreach (($prospects ?? []) as $prospect) { $prospectLabel = $prospect->displayNameForTable(); $prospectLabel = $prospectLabel === '—' ? 'Prospect' : $prospectLabel; $prospectSelectOptions[] = [ 'value' => (string) $prospect->id, 'label' => '#'.$prospect->id.' — '.$prospectLabel, ]; } $fieldLabelClass = 'block text-[11px] font-medium leading-none text-gray-600'; $textInputClass = 'mt-1 block w-full min-w-0 rounded-md border-gray-300 text-sm shadow-sm focus:border-red-500 focus:ring-red-500'; $controlHeightClass = 'h-9'; @endphp {{ __('Sales Activity Logging') }}
@csrf

Recent activity

Last {{ number_format($recentCount) }} entries

@forelse ($recentList as $activity) @php $userName = trim(($activity->user?->name ?? '').' '.($activity->user?->surname ?? '')); $leadLabel = $activity->lead ? $activity->lead->displayName() : ''; $leadLabel = ($leadLabel === '' || $leadLabel === '—') ? 'Lead' : $leadLabel; $activityTypeLabel = $activity->activityType?->code === 'online_ads_posted' ? 'Online Ad' : ($activity->activityType?->name ?? '—'); $hasStoredDescription = $activity->description !== null && trim((string) $activity->description) !== ''; $descriptionCell = $hasStoredDescription ? trim((string) $activity->description) : trim((string) ($activity->notes ?? '')); $notesCell = $hasStoredDescription ? trim((string) ($activity->notes ?? '')) : ''; @endphp @empty @endforelse
Date User Activity type Points Lead Description Notes
{{ optional($activity->activity_date)->format('Y-m-d') ?? $activity->activity_date }} {{ $userName !== '' ? $userName : '—' }} {{ $activityTypeLabel }}
{{ (int) $activity->points }}
@if ($activity->pointsStatusLabel() !== '')
{{ $activity->pointsStatusLabel() }}
@endif
@if ($activity->lead_id) #{{ $activity->lead_id }} {{ $leadLabel }} @else @endif
{{ $descriptionCell !== '' ? $descriptionCell : '—' }}
@if ($hasStoredDescription)
{{ $notesCell }}
@endif
No activities logged yet.