{{-- resources/views/storefront/store.blade.php --}} @extends('storefront.layout') @section('title', $store->name.' - '.config('app.name', 'FreshMart')) @section('body_class', 'sf-store-page') @section('content') @php $cover = \App\Support\StorefrontPresenter::storeCover($store); $logo = \App\Support\StorefrontPresenter::storeLogo($store); $groupedProducts = $store->products->groupBy(fn ($product) => $product->category?->name ?: 'Popular items'); $categoryList = $groupedProducts->keys()->take(10); $etaLabel = data_get($store->meta, 'eta_label') ?: data_get($store->meta, 'delivery_time_label'); $radiusLabel = $store->delivery_radius_km ? number_format((float) $store->delivery_radius_km, 1).' km radius' : null; $minimumOrderLabel = $store->minimum_order_amount ? \App\Support\StorefrontPresenter::money($store->minimum_order_amount) : ($store->deliveryZone?->minimum_order_amount ? \App\Support\StorefrontPresenter::money($store->deliveryZone->minimum_order_amount) : null); $deliveryFeeLabel = data_get($store->meta, 'delivery_fee') !== null ? \App\Support\StorefrontPresenter::money((float) data_get($store->meta, 'delivery_fee')) : null; $isOpen = $store->is_open ?? true; $isFeatured = $store->is_featured ?? false; $reviewSummary = $reviewSummary ?? [ 'average' => (float) ($store->reviews_avg_rating ?? 0), 'total_ratings' => (int) ($store->reviews_count ?? 0), 'total_reviews' => (int) ($store->reviews_count ?? 0), 'distribution' => [5 => 0, 4 => 0, 3 => 0, 2 => 0, 1 => 0], 'max_count' => 0, ]; $averageRating = number_format((float) data_get($reviewSummary, 'average', $store->reviews_avg_rating ?? 0), 1); $reviewsCount = (int) data_get($reviewSummary, 'total_ratings', $store->reviews_count ?? 0); $writtenReviewsCount = (int) data_get($reviewSummary, 'total_reviews', 0); $ratingDistribution = data_get($reviewSummary, 'distribution', [5 => 0, 4 => 0, 3 => 0, 2 => 0, 1 => 0]); $maxRatingCount = max(1, (int) data_get($reviewSummary, 'max_count', 0)); $ratingFillPercent = max(0, min(100, ((float) data_get($reviewSummary, 'average', 0) / 5) * 100)); $reviewsUrl = route('storefront.stores.reviews', ['store' => $store->slug ?: $store->id] + ($storefrontQuery ?? [])); $storeService = $selectedService ?? 'grocery'; $isFoodStore = in_array($storeService, ['food', 'restaurant'], true); @endphp
{{-- Breadcrumb --}} {{-- Store Header --}}
@if($cover) {{ $store->name }} @else
{{ Str::upper(Str::substr($store->name, 0, 1)) }}
@endif {{-- Badges on Cover --}}
@if($isFeatured) ⭐ Featured @endif {{ $isOpen ? 'Open' : 'Closed' }} @if($etaLabel) ⏱ {{ $etaLabel }} @endif
{{-- Store Info --}}

{{ $store->name }}

{{ $isOpen ? '● Open now' : '● Currently closed' }}

{{ $store->description ?: ($isFoodStore ? 'Delicious meals from this local restaurant.' : 'Fresh items delivered from this local store.') }}

@if($averageRating > 0) {{ $averageRating }} ★ ({{ $reviewsCount }} reviews) @endif @if($store->city) {{ $store->city }} @endif @if($minimumOrderLabel) Min {{ $minimumOrderLabel }} @endif @if($etaLabel) {{ $etaLabel }} @endif
{{-- Category Chips --}} @if($categoryList->isNotEmpty())
@foreach($categoryList as $categoryName) @php $categorySlug = Str::slug($categoryName); $categoryImage = null; $firstProduct = $groupedProducts->get($categoryName)?->first(); if ($firstProduct && $firstProduct->category) { $categoryImage = \App\Support\StorefrontPresenter::categoryImage($firstProduct->category); } @endphp @if($categoryImage) {{ $categoryName }} @else {{ Str::upper(Str::substr($categoryName, 0, 1)) }} @endif {{ $categoryName }} @endforeach
@endif {{-- Offer Strip --}} @if(($storeCoupons ?? collect())->isNotEmpty()) @php $primaryCoupon = $storeCoupons->first(); @endphp
🏷 {{ $primaryCoupon->title ?: \App\Support\StorefrontPresenter::couponDiscountLabel($primaryCoupon) }} {{ \App\Support\StorefrontPresenter::couponMinimumLabel($primaryCoupon) }} {{ $primaryCoupon->code }}
@endif {{-- Menu Sections --}} @foreach($groupedProducts as $categoryName => $items)

{{ $categoryName }}

{{ $items->count() }} items available

@foreach($items as $product) @include('storefront.partials.product-card', ['product' => $product]) @endforeach
@endforeach {{-- Ratings & Reviews --}} @if($reviewsCount > 0)

Ratings & Reviews

Customer feedback for this store

View all reviews
★★★★★ {{ number_format($reviewsCount) }} ratings and {{ number_format($writtenReviewsCount) }} reviews {{ $averageRating }} average rating
@foreach([5, 4, 3, 2, 1] as $ratingValue) @php $ratingBarCount = (int) ($ratingDistribution[$ratingValue] ?? 0); $ratingBarWidth = $maxRatingCount > 0 ? max(4, ($ratingBarCount / $maxRatingCount) * 100) : 0; @endphp
{{ $ratingValue }} ★ {{ number_format($ratingBarCount) }}
@endforeach
@if(($reviews ?? collect())->count()) @foreach($reviews as $review)
{{ $review->user?->name ?? trans_key('storefront.fallbacks.customer') }} {{ number_format((float) $review->rating, 1) }} ★ @if($review->comment)

{{ $review->comment }}

@endif
@endforeach @endif
@endif {{-- Reviews --}} @if(false && ($reviews ?? collect())->count())

Customer Reviews

Latest feedback for this store

@foreach($reviews as $review)
{{ $review->customer?->name ?? trans_key('storefront.fallbacks.customer') }} {{ number_format((float) $review->rating, 1) }} ★

{{ $review->comment }}

@endforeach
@endif {{-- Info Section --}}

Store Information

Details about this store

Store Name {{ $store->name }}
@if($store->city)
Location {{ $store->city }}
@endif @if($store->address_line_1)
Address {{ collect([$store->address_line_1, $store->address_line_2, $store->city, $store->state, $store->postal_code])->filter()->implode(', ') }}
@endif
Status {{ $isOpen ? 'Open now' : 'Currently closed' }}
@if($minimumOrderLabel)
Minimum Order {{ $minimumOrderLabel }}
@endif @if($etaLabel)
Estimated Delivery {{ $etaLabel }}
@endif @if($deliveryFeeLabel)
Delivery Fee {{ $deliveryFeeLabel }}
@endif @if($radiusLabel)
Service Radius {{ $radiusLabel }}
@endif
@endsection