@php $record = $getRecord(); $activities = \App\Models\ActivityLog::where('loggable_type', get_class($record)) ->where('loggable_id', $record->id) ->with('user') ->orderBy('created_at', 'desc') ->get(); $getIconConfig = function ($action, $properties) { if ($action === 'created') { return [ 'icon' => 'heroicon-o-plus-circle', 'bg' => '#f0fdf4', 'color' => '#16a34a', 'ring' => '#bbf7d0', ]; } if ($action === 'deleted') { return [ 'icon' => 'heroicon-o-trash', 'bg' => '#fff1f2', 'color' => '#e11d48', 'ring' => '#fecdd3', ]; } $attributes = $properties['attributes'] ?? []; if (isset($attributes['status'])) { return match ($attributes['status']) { 'pending' => ['icon' => 'heroicon-o-clock', 'bg' => '#eff6ff', 'color' => '#1d4ed8', 'ring' => '#bfdbfe'], 'processing' => ['icon' => 'heroicon-o-arrow-path', 'bg' => '#fffbeb', 'color' => '#b45309', 'ring' => '#fde68a'], 'shipped' => ['icon' => 'heroicon-o-truck', 'bg' => '#f0f9ff', 'color' => '#0369a1', 'ring' => '#bae6fd'], 'delivered' => ['icon' => 'heroicon-o-check-circle', 'bg' => '#f0fdf4', 'color' => '#16a34a', 'ring' => '#bbf7d0'], 'cancelled' => ['icon' => 'heroicon-o-x-circle', 'bg' => '#fff1f2', 'color' => '#e11d48', 'ring' => '#fecdd3'], default => ['icon' => 'heroicon-o-pencil-square', 'bg' => '#fafafa', 'color' => '#64748b', 'ring' => '#e2e8f0'], }; } if (isset($attributes['payment_status'])) { return match ($attributes['payment_status']) { 'paid' => ['icon' => 'heroicon-o-banknotes', 'bg' => '#f0fdf4', 'color' => '#16a34a', 'ring' => '#bbf7d0'], 'failed' => ['icon' => 'heroicon-o-exclamation-triangle','bg' => '#fff1f2', 'color' => '#e11d48', 'ring' => '#fecdd3'], 'refunded' => ['icon' => 'heroicon-o-arrow-uturn-left', 'bg' => '#eff6ff', 'color' => '#1d4ed8', 'ring' => '#bfdbfe'], default => ['icon' => 'heroicon-o-credit-card', 'bg' => '#fffbeb', 'color' => '#b45309', 'ring' => '#fde68a'], }; } return ['icon' => 'heroicon-o-pencil-square', 'bg' => '#fafafa', 'color' => '#64748b', 'ring' => '#e2e8f0']; }; $getStatusBadge = function ($value, $type = 'status') { if ($type === 'status') { [$bg, $color, $border, $label] = match (strtolower($value ?? '')) { 'pending' => ['#eff6ff', '#1d4ed8', '#bfdbfe', 'Pending'], 'processing' => ['#fffbeb', '#b45309', '#fde68a', 'Processing'], 'shipped' => ['#f0f9ff', '#0369a1', '#bae6fd', 'Shipped'], 'delivered' => ['#f0fdf4', '#15803d', '#bbf7d0', 'Delivered'], 'cancelled' => ['#fff1f2', '#be123c', '#fecdd3', 'Cancelled'], default => ['#f8fafc', '#475569', '#e2e8f0', ucfirst($value ?? '—')], }; } else { [$bg, $color, $border, $label] = match (strtolower($value ?? '')) { 'paid' => ['#f0fdf4', '#15803d', '#bbf7d0', 'Paid'], 'pending' => ['#eff6ff', '#1d4ed8', '#bfdbfe', 'Pending'], 'failed' => ['#fff1f2', '#be123c', '#fecdd3', 'Failed'], 'refunded' => ['#f0f9ff', '#0369a1', '#bae6fd', 'Refunded'], default => ['#f8fafc', '#475569', '#e2e8f0', ucfirst($value ?? '—')], }; } return "{$label}"; }; @endphp