|
4 | 4 | $hasMore = $totalRows > count($sampleRows); |
5 | 5 | $showCompanyMatch = in_array($entityType, ['people', 'opportunities']); |
6 | 6 |
|
7 | | - // Calculate update method statistics |
8 | | - $idBasedUpdates = collect($sampleRows)->where('_update_method', 'id')->count(); |
9 | | - $attributeBasedUpdates = collect($sampleRows)->where('_update_method', 'attribute')->count(); |
10 | | -
|
11 | 7 | // Calculate company match statistics |
12 | 8 | $companyMatchStats = []; |
13 | 9 | if ($showCompanyMatch) { |
14 | 10 | $companyMatchStats = [ |
| 11 | + 'id' => collect($sampleRows)->where('_company_match_type', 'id')->count(), |
15 | 12 | 'domain' => collect($sampleRows)->where('_company_match_type', 'domain')->count(), |
16 | | - 'name' => collect($sampleRows)->where('_company_match_type', 'name')->count(), |
17 | | - 'ambiguous' => collect($sampleRows)->where('_company_match_type', 'ambiguous')->count(), |
18 | 13 | 'new' => collect($sampleRows)->where('_company_match_type', 'new')->count(), |
| 14 | + // 'none' is not counted - records with no company data |
19 | 15 | ]; |
20 | 16 | } |
21 | 17 | @endphp |
|
25 | 21 | <div> |
26 | 22 | <div class="flex items-center gap-6 text-sm"> |
27 | 23 | <div class="flex items-center gap-1.5"> |
28 | | - <x-filament::icon icon="heroicon-o-document-text" class="h-4 w-4 text-gray-400" /> |
29 | | - <span class="font-medium text-gray-700 dark:text-gray-300">{{ number_format($totalRows) }}</span> |
30 | | - <span class="text-gray-500 dark:text-gray-400">total rows</span> |
31 | | - </div> |
32 | | - <div class="flex items-center gap-1.5"> |
33 | | - <x-filament::icon icon="heroicon-o-plus-circle" class="h-4 w-4 text-success-500" /> |
34 | | - <span class="font-medium text-success-600 dark:text-success-400">~{{ number_format($this->getCreateCount()) }}</span> |
35 | | - <span class="text-gray-500 dark:text-gray-400">new</span> |
| 24 | + <x-filament::icon icon="heroicon-m-plus-circle" class="h-5 w-5 text-success-500" /> |
| 25 | + <span class="font-medium text-success-600 dark:text-success-400">{{ number_format($this->getCreateCount()) }}</span> |
| 26 | + <span class="text-gray-500 dark:text-gray-400">will be created</span> |
36 | 27 | </div> |
37 | 28 | <div class="flex items-center gap-1.5"> |
38 | | - <x-filament::icon icon="heroicon-o-arrow-path" class="h-4 w-4 text-info-500" /> |
39 | | - <span class="font-medium text-info-600 dark:text-info-400">~{{ number_format($this->getUpdateCount()) }}</span> |
40 | | - <span class="text-gray-500 dark:text-gray-400">updates</span> |
| 29 | + <x-filament::icon icon="heroicon-m-arrow-path" class="h-5 w-5 text-info-500" /> |
| 30 | + <span class="font-medium text-info-600 dark:text-info-400">{{ number_format($this->getUpdateCount()) }}</span> |
| 31 | + <span class="text-gray-500 dark:text-gray-400">will be updated</span> |
41 | 32 | </div> |
42 | 33 | </div> |
43 | 34 | </div> |
44 | 35 |
|
45 | | - {{-- Update Method Statistics --}} |
46 | | - @if ($idBasedUpdates > 0 || $attributeBasedUpdates > 0) |
47 | | - <div class="flex items-center gap-4 text-sm pt-2 border-t border-gray-100 dark:border-gray-800"> |
48 | | - <span class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Update Method:</span> |
49 | | - @if ($idBasedUpdates > 0) |
50 | | - <div class="flex items-center gap-1.5"> |
51 | | - <x-filament::badge color="info" size="sm">{{ $idBasedUpdates }}</x-filament::badge> |
52 | | - <span class="text-gray-500 dark:text-gray-400">by ID</span> |
53 | | - </div> |
54 | | - @endif |
55 | | - @if ($attributeBasedUpdates > 0) |
56 | | - <div class="flex items-center gap-1.5"> |
57 | | - <x-filament::badge color="warning" size="sm">{{ $attributeBasedUpdates }}</x-filament::badge> |
58 | | - <span class="text-gray-500 dark:text-gray-400">by name/email</span> |
59 | | - </div> |
60 | | - @endif |
61 | | - </div> |
62 | | - @endif |
63 | | - |
64 | 36 | {{-- Company Match Statistics (for People/Opportunities) --}} |
65 | 37 | @if ($showCompanyMatch && array_sum($companyMatchStats) > 0) |
66 | 38 | <div class="flex items-center gap-4 text-sm pt-2 border-t border-gray-100 dark:border-gray-800"> |
67 | 39 | <span class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Company Matching:</span> |
68 | | - @if ($companyMatchStats['domain'] > 0) |
| 40 | + @if ($companyMatchStats['id'] > 0) |
69 | 41 | <div class="flex items-center gap-1.5"> |
70 | | - <x-filament::badge color="success" size="sm">{{ $companyMatchStats['domain'] }}</x-filament::badge> |
71 | | - <span class="text-gray-500 dark:text-gray-400">domain</span> |
72 | | - </div> |
73 | | - @endif |
74 | | - @if ($companyMatchStats['name'] > 0) |
75 | | - <div class="flex items-center gap-1.5"> |
76 | | - <x-filament::badge color="info" size="sm">{{ $companyMatchStats['name'] }}</x-filament::badge> |
77 | | - <span class="text-gray-500 dark:text-gray-400">name</span> |
| 42 | + <x-filament::badge color="purple" size="sm">{{ $companyMatchStats['id'] }}</x-filament::badge> |
| 43 | + <span class="text-gray-500 dark:text-gray-400">by ID</span> |
78 | 44 | </div> |
79 | 45 | @endif |
80 | | - @if ($companyMatchStats['ambiguous'] > 0) |
| 46 | + @if ($companyMatchStats['domain'] > 0) |
81 | 47 | <div class="flex items-center gap-1.5"> |
82 | | - <x-filament::badge color="warning" size="sm">{{ $companyMatchStats['ambiguous'] }}</x-filament::badge> |
83 | | - <span class="text-gray-500 dark:text-gray-400">ambiguous</span> |
| 48 | + <x-filament::badge color="success" size="sm">{{ $companyMatchStats['domain'] }}</x-filament::badge> |
| 49 | + <span class="text-gray-500 dark:text-gray-400">by domain</span> |
84 | 50 | </div> |
85 | 51 | @endif |
86 | 52 | @if ($companyMatchStats['new'] > 0) |
|
106 | 72 | <table class="min-w-full text-sm"> |
107 | 73 | <thead class="bg-gray-50 dark:bg-gray-800/50 sticky top-0"> |
108 | 74 | <tr> |
109 | | - <th class="px-3 py-2 text-left text-xs font-medium uppercase text-gray-500 dark:text-gray-400">#</th> |
| 75 | + <th class="px-3 py-2 w-10"></th> |
110 | 76 | @foreach (array_keys($columnMap) as $fieldName) |
111 | 77 | @if ($columnMap[$fieldName] !== '') |
112 | 78 | <th class="px-3 py-2 text-left text-xs font-medium uppercase text-gray-500 dark:text-gray-400"> |
|
117 | 83 | @if ($showCompanyMatch) |
118 | 84 | <th class="px-3 py-2 text-left text-xs font-medium uppercase text-gray-500 dark:text-gray-400">Company Match</th> |
119 | 85 | @endif |
120 | | - <th class="px-3 py-2 text-left text-xs font-medium uppercase text-gray-500 dark:text-gray-400">Status</th> |
121 | 86 | </tr> |
122 | 87 | </thead> |
123 | 88 | <tbody class="divide-y divide-gray-100 dark:divide-gray-800"> |
124 | 89 | @foreach ($sampleRows as $index => $row) |
125 | 90 | <tr wire:key="preview-row-{{ $index }}"> |
126 | | - <td class="px-3 py-2 text-gray-500 dark:text-gray-400"> |
127 | | - {{ $row['_row_index'] ?? $index + 1 }} |
| 91 | + <td class="px-3 py-2"> |
| 92 | + @php |
| 93 | + $isNew = $row['_is_new'] ?? true; |
| 94 | + $updateMethod = $row['_update_method'] ?? null; |
| 95 | + @endphp |
| 96 | + @if ($isNew) |
| 97 | + <x-filament::icon icon="heroicon-m-plus-circle" class="h-5 w-5 text-success-500" /> |
| 98 | + @else |
| 99 | + <x-filament::icon icon="heroicon-m-arrow-path" class="h-5 w-5 text-info-500" /> |
| 100 | + @endif |
128 | 101 | </td> |
129 | 102 | @foreach (array_keys($columnMap) as $fieldName) |
130 | 103 | @if ($columnMap[$fieldName] !== '') |
|
136 | 109 | @if ($showCompanyMatch) |
137 | 110 | <td class="px-3 py-2"> |
138 | 111 | @php |
139 | | - $matchType = $row['_company_match_type'] ?? 'new'; |
| 112 | + $matchType = $row['_company_match_type'] ?? 'none'; |
140 | 113 | $matchCount = $row['_company_match_count'] ?? 0; |
141 | 114 | $companyName = $row['_company_name'] ?? $row['company_name'] ?? '-'; |
142 | 115 | @endphp |
|
145 | 118 | {{ $companyName ?: '-' }} |
146 | 119 | </span> |
147 | 120 | @switch($matchType) |
| 121 | + @case('id') |
| 122 | + <x-filament::badge color="purple" size="sm" icon="heroicon-m-key"> |
| 123 | + ID |
| 124 | + </x-filament::badge> |
| 125 | + @break |
148 | 126 | @case('domain') |
149 | 127 | <x-filament::badge color="success" size="sm" icon="heroicon-m-check"> |
150 | 128 | Domain |
151 | 129 | </x-filament::badge> |
152 | 130 | @break |
153 | | - @case('name') |
154 | | - <x-filament::badge color="info" size="sm"> |
155 | | - Name |
156 | | - </x-filament::badge> |
157 | | - @break |
158 | | - @case('ambiguous') |
159 | | - <x-filament::badge color="warning" size="sm" icon="heroicon-m-exclamation-triangle"> |
160 | | - {{ $matchCount }} matches |
161 | | - </x-filament::badge> |
162 | | - @break |
163 | | - @default |
164 | | - <x-filament::badge color="gray" size="sm"> |
| 131 | + @case('new') |
| 132 | + <x-filament::badge color="gray" size="sm" icon="heroicon-m-plus"> |
165 | 133 | New |
166 | 134 | </x-filament::badge> |
| 135 | + @break |
| 136 | + @default {{-- none --}} |
| 137 | + <span class="text-xs text-gray-400">-</span> |
167 | 138 | @endswitch |
168 | 139 | </div> |
169 | 140 | </td> |
170 | 141 | @endif |
171 | | - <td class="px-3 py-2"> |
172 | | - @php |
173 | | - $isNew = $row['_is_new'] ?? true; |
174 | | - $updateMethod = $row['_update_method'] ?? null; |
175 | | - @endphp |
176 | | - @if ($isNew) |
177 | | - <x-filament::badge color="success" size="sm" icon="heroicon-m-plus"> |
178 | | - New |
179 | | - </x-filament::badge> |
180 | | - @elseif ($updateMethod === 'id') |
181 | | - <x-filament::badge color="info" size="sm" icon="heroicon-m-arrow-path"> |
182 | | - Update by ID |
183 | | - </x-filament::badge> |
184 | | - @else |
185 | | - <x-filament::badge color="warning" size="sm" icon="heroicon-m-arrow-path"> |
186 | | - Update |
187 | | - </x-filament::badge> |
188 | | - @endif |
189 | | - </td> |
190 | 142 | </tr> |
191 | 143 | @endforeach |
192 | 144 | </tbody> |
|
0 commit comments