@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'], ]; $categoryIcons = [ 'recommend' => [ 'type' => 'heart', 'color' => '#e62e43', ], 'svod' => [ 'icon' => 'fa-solid fa-tv', 'color' => '#f1b22d', ], 'streaming' => [ 'icon' => 'fa-solid fa-tv', 'color' => '#f1b22d', ], 'music' => [ 'icon' => 'fa-solid fa-music', 'color' => '#76a7ff', ], 'security' => [ 'icon' => 'fa-solid fa-lock', 'color' => '#d87e2d', ], 'software' => [ 'icon' => 'fa-solid fa-laptop-code', 'color' => '#6e9dcf', ], 'reading' => [ 'icon' => 'fa-solid fa-book-open', 'color' => '#8b78d4', ], 'cloud' => [ 'icon' => 'fa-solid fa-cloud', 'color' => '#a09e9b', ], 'health' => [ 'icon' => 'fa-solid fa-user-doctor', 'color' => '#f1a42d', ], 'video games' => [ 'icon' => 'fa-solid fa-gamepad', 'color' => '#2c2c2c', ], 'gaming' => [ 'icon' => 'fa-solid fa-gamepad', 'color' => '#2c2c2c', ], 'e-learning' => [ 'icon' => 'fa-solid fa-graduation-cap', 'color' => '#4f4f4f', ], 'education' => [ 'icon' => 'fa-solid fa-graduation-cap', 'color' => '#4f4f4f', ], ]; @endphp
@forelse($servicesByCategory as $categoryId => $serviceCards) @php $categoryName = (string) ($categoryId === 'recommend' ? 'Recommend' : ($serviceCards->first()['category_name'] ?? 'More')); $categoryKey = strtolower(trim($categoryName)); $categoryFilterId = is_numeric($categoryId) ? (int) $categoryId : 0; $viewAllParams = $categoryFilterId > 0 ? ['category_id' => $categoryFilterId] : ['q' => $categoryName]; if (! empty($selectedCountry ?? null)) { $viewAllParams['country'] = $selectedCountry; } $catMeta = $categoryIcons[$categoryKey] ?? null; @endphp

@if($categoryKey === 'recommend') @elseif($catMeta && !empty($catMeta['icon'])) @endif {{ $categoryName }}

@if($categoryKey !== 'recommend' && empty($isCategoryFiltered)) View all >> @endif
@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; $cardLogo = marketplaceImageUrl($card['logo'] ?? null); $hasPackage = !empty($card['has_package']) || ((int) ($card['listings_count'] ?? 0) > 0); $seekingCount = (int) ($card['seeking_count'] ?? ( !empty($card['active_seekers']) ? $card['active_seekers'] : ((abs(crc32(strtolower((string) $card['service_name']))) % 5) + 2) )); @endphp @php $targetSubId = (int) ($card['target_subscription_id'] ?? 0); $serviceId = (int) ($card['service_id'] ?? 0); $cardUrl = $targetSubId > 0 ? route('subscriptions.show', array_filter(['subscription' => $targetSubId, 'country' => $selectedCountry ?? null])) : ($serviceId > 0 ? route('subscriptions.service.show', array_filter(['service' => $serviceId, 'country' => $selectedCountry ?? null])) : route('subscriptions.index')); @endphp @endforeach
@empty
No subscriptions found.
@endforelse