@extends('layouts.store') @push('styles') @endpush @section('content') @php $fallbackImage = 'https://images.unsplash.com/photo-1493711662062-fa541adb3fc8?q=70&w=800&auto=format&fit=crop'; $formatPrice = fn ($price) => (float) $price <= 0 ? 'Gratis' : 'Rp ' . number_format($price, 0, ',', '.'); $cartCount = auth()->check() ? auth()->user()->carts()->count() : 0; @endphp

{{ $sort === 'popular' ? 'Top Sellers' : 'Search Results' }}

{{ $sort === 'popular' ? 'Game paling banyak dibeli' : $games->total() . ' game ditemukan' }}

@if($sort === 'popular')

Urutan ini dihitung dari jumlah checkout yang statusnya sudah paid.

@endif @if($search !== '')

Untuk awalan huruf/judul: "{{ $search }}"

@endif @if(!empty($maxPrice))

Filter harga: di bawah {{ $formatPrice($maxPrice) }}

@endif @if(!empty($discountedOnly))

Filter promo: game yang sedang diskon

@endif
@forelse($games as $game) @php $discount = $game->discount_percent; $price = (float) $game->price; $finalPrice = $game->final_price; $releaseDate = $game->release_date ? $game->release_date->translatedFormat('j M Y') : 'TBA'; $tagList = $game->genres ->take(3) ->pluck('name') ->merge($game->categories->take(2)->pluck('name')) ->filter() ->values(); $previewImages = $game->screenshots ->pluck('url') ->prepend($game->thumbnail_url ?: $fallbackImage) ->filter() ->unique() ->take(1) ->values(); $previewTags = $game->genres ->take(3) ->pluck('name') ->merge($game->categories->take(3)->pluck('name')) ->filter() ->values(); @endphp {{ $game->title }} {{ $game->title }} {{ $tagList->isNotEmpty() ? $tagList->join(', ') : 'PlayMart' }} @if($game->platforms->isNotEmpty()) @foreach($game->platforms->take(4) as $platform) {!! $platform->icon !!} @endforeach @endif Dirilis: {{ $releaseDate }} @if(($game->paid_purchases_count ?? 0) > 0) {{ number_format($game->paid_purchases_count, 0, ',', '.') }} pembelian @endif @if($discount > 0) -{{ $discount }}% {{ $formatPrice($price) }} @endif {{ $formatPrice($finalPrice) }} @empty

Game not found

@endforelse
@if($games->count() > 0) @endif
@if($games->total() > 0) @php $currentPage = $games->currentPage(); $lastPage = $games->lastPage(); $startPage = max(1, $currentPage - 1); $endPage = min($lastPage, $currentPage + 1); if ($currentPage === 1) { $endPage = min($lastPage, 3); } if ($currentPage === $lastPage) { $startPage = max(1, $lastPage - 2); } $pageNumbers = range($startPage, $endPage); @endphp @if($lastPage > 1) @endif @endif
@endsection @push('scripts') @endpush