@php $cardPalettes = [ ['surface' => '#f0f0f0', 'logo' => '#8373d9', 'logo_text' => '#ffffff'], ['surface' => '#f1f1f1', 'logo' => '#090909', 'logo_text' => '#ffffff'], ['surface' => '#fbf7e9', 'logo' => '#f1c40f', 'logo_text' => '#1a1a1a'], ['surface' => '#eef3fb', 'logo' => '#2b5ed9', 'logo_text' => '#ffffff'], ['surface' => '#f5efec', 'logo' => '#d86a42', 'logo_text' => '#ffffff'], ['surface' => '#eff5f1', 'logo' => '#2c8d58', 'logo_text' => '#ffffff'], ]; @endphp
@forelse($servicesByCategory as $categoryId => $serviceCards) @php $categoryName = $serviceCards->first()['category_name'] ?? 'More'; $categoryFilterId = (int) $categoryId; $viewAllParams = $categoryFilterId > 0 ? ['category_id' => $categoryFilterId] : ['q' => $categoryName]; if (! empty($selectedCountry ?? null)) { $viewAllParams['country'] = $selectedCountry; } @endphp

{{ $categoryName }}

View all >>
@foreach($serviceCards as $card) @php $palette = $cardPalettes[abs(crc32((string) $card['service_name'])) % count($cardPalettes)]; $serviceName = strtoupper((string) $card['service_name']); $compactLogoLabel = preg_replace('/[^A-Z0-9]/', '', $serviceName) ?: 'APP'; $serviceLogoChunks = collect(); if (preg_match('/\s/', trim($serviceName))) { $serviceLogoChunks = collect(preg_split('/[\s\-_]+/', $serviceName)) ->map(fn ($chunk) => preg_replace('/[^A-Z0-9]/', '', (string) $chunk)) ->filter() ->map(fn ($chunk) => substr($chunk, 0, 5)) ->take(3) ->values(); } if ($serviceLogoChunks->isEmpty()) { $compactLogoLength = strlen($compactLogoLabel); if ($compactLogoLength <= 5) { $serviceLogoChunks = collect([$compactLogoLabel]); } elseif ($compactLogoLength <= 8) { $serviceLogoChunks = collect([substr($compactLogoLabel, 0, 3), substr($compactLogoLabel, 3)]); } elseif ($compactLogoLength <= 10) { $serviceLogoChunks = collect([substr($compactLogoLabel, 0, 5), substr($compactLogoLabel, 5)]); } else { $serviceLogoChunks = collect([ substr($compactLogoLabel, 0, 5), substr($compactLogoLabel, 5, 5), substr($compactLogoLabel, 10, 5), ]); } } $profilesCollection = collect($card['profiles'] ?? []); $extraProfiles = (int) ($card['extra_profiles'] ?? 0); $extraProfilesLabel = $extraProfiles > 99 ? '99+' : (string) $extraProfiles; @endphp @endforeach
@empty
No subscriptions found.
@endforelse