@extends('digitalmenu::layouts.app') @section('title', 'Dashboard | ' . $shop->name) @section('styles') @endsection @section('content') @php $isFood = $shopType === 'food_and_drink'; $typeLabel = $isFood ? 'Food & Drink' : 'Retail'; $typeIcon = $isFood ? 'restaurant' : 'storefront'; $dayMap = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']; $todayName = \Carbon\Carbon::now()->format('l'); $todayHours = $businessHours->get($todayName); $nowTime = \Carbon\Carbon::now()->format('H:i'); $isOpen = $todayHours && $nowTime >= $todayHours->open_hour && $nowTime <= $todayHours->close_hour; $shopLogoUrl = $shop->logo ? config('global.s3_path') . 'shop/' . $shop->logo : null; @endphp {{-- ═══════════════════════════════════════════════════════════ HEADER ═══════════════════════════════════════════════════════════ --}}
@if ($shopLogoUrl)
{{ $shop->name }}
@else
{{ $typeIcon }}
@endif
Merchant Central {{ $typeIcon }} {{ $typeLabel }}

{{ $shop->name }}

@if ($shop->short_description)

{{ $shop->short_description }}

@endif
{{-- Open / Closed badge --}} @if ($todayHours)
{{ $isOpen ? 'Open Now' : 'Closed' }} · {{ $todayHours->open_hour }} – {{ $todayHours->close_hour }}
@endif open_in_new View Menu add Add Product
{{-- ═══════════════════════════════════════════════════════════ STAT CARDS ═══════════════════════════════════════════════════════════ --}}
{{-- Total Products --}}
inventory_2
arrow_forward

{{ $totalProducts }}

Total Products

{{-- Active Products --}}
check_circle
arrow_forward

{{ $activeProducts }}

Active

{{-- Promotions --}}
local_offer

{{ $promotionProducts }}

On Promotion

{{-- New Arrivals --}}
new_releases

{{ $newArrivals }}

New Arrivals

{{-- Categories --}}

{{ $totalCategories }}

Categories

{{-- ═══════════════════════════════════════════════════════════ MAIN CONTENT: Recent Products + Sidebar ═══════════════════════════════════════════════════════════ --}}
{{-- ── Recent Products (2/3) ── --}}
inventory_2

Recent Products

View All chevron_right
@if ($recentProducts->isEmpty())
inventory_2

No products yet

Start building your digital menu.

add Add First Product
@else
@foreach ($recentProducts as $product) @php $categoryName = null; if (!empty($product->category)) { // 1. Find by ID $cat = $categories->first(function($key, $c) use ($product) { // Check if $c is an object before accessing ->id return is_object($c) && $c->id == $product->category; }); // 2. If not found by ID, try finding by Name if (!$cat) { $cat = $categories->first(function($key, $c) use ($product) { return is_object($c) && $c->name == $product->category; }); } // 3. Final assignment $categoryName = $cat ? $cat->name : $product->category; } @endphp
{{-- Thumbnail --}}
@if ($product->image) {{ $product->name }} @else
{{ $isFood ? 'lunch_dining' : 'shopping_bag' }}
@endif
{{-- Name & meta --}}

{{ $product->name }}

@if ($categoryName) category {{ $categoryName }} @endif @if ($product->product_id) {{ $product->product_id }} @endif
{{-- Price --}}

${{ number_format($product->unit_price, 2) }}

{{-- Status --}}
@if ($product->state == 1) Active @else Inactive @endif
{{-- Action --}} edit
@endforeach
@endif
{{-- ── Categories Overview ── --}}
category

Categories

add New
@if ($categories->isEmpty())

No categories yet.

Create one
@else
@php $catIndex = 0; @endphp @foreach ($categories->take(9) as $cat) @php $dotColors = ['bg-primary', 'bg-tertiary', 'bg-secondary', 'bg-amber-500', 'bg-emerald-600', 'bg-slate-500']; $dotColor = $dotColors[$catIndex % count($dotColors)]; $catIndex++; @endphp
{{ $isFood ? 'lunch_dining' : 'label' }}

{{ $cat->name }}

{{ $cat->state == 1 ? 'Active' : 'Inactive' }}

@endforeach @if ($categories->count() > 9) +{{ $categories->count() - 9 }} more @endif
@endif
{{-- ── Sidebar (1/3) ── --}}
{{-- Business Hours --}}
schedule

Business Hours

edit
@foreach ($dayMap as $day) @php $h = $businessHours->get($day); $isToday = $day === $todayName; $isWknd = in_array($day, ['Saturday', 'Sunday']); @endphp
@if ($isToday) @endif {{ substr($day, 0, 3) }} @if ($isToday) Today @endif
@if ($h) {{ $h->open_hour }} – {{ $h->close_hour }} @else @endif
@endforeach
{{-- Shop Info Card --}}
store

Shop Info

@if ($shop->business_contact)
phone
Contact
{{ $shop->business_contact }}
@endif @if ($shop->website)
language
@endif
qr_code_2
Menu URL
{{ $menuUrl }}
{{-- Quick Actions --}}
{{-- /sidebar --}}
{{-- /main grid --}} @endsection