@php $dealColor = match($record->deal_status ?? 'Pending') { 'Won' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', 'Lost' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300', default => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300', }; $lastInteraction = $record->last_interaction ? \Carbon\Carbon::parse($record->last_interaction)->diffForHumans() : null; $isOld = $record->last_interaction && \Carbon\Carbon::parse($record->last_interaction)->diffInDays(now()) > 7; $actions = is_array($record->action) ? $record->action : (json_decode($record->action ?? '[]', true) ?: []); $lastAction = !empty($actions) ? last($actions) : null; $actionColor = match($lastAction) { 'Offer' => 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300', 'Sending Portfolio' => 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300', 'Active Chating' => 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300', 'Meeting' => 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300', 'Waiting Response' => 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300', 'Follow Up' => 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300', default => 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300', }; @endphp