@extends('admin.layouts.master') @section('content')
@if (auth()->user()->role === 'admin' || auth()->user()->role === 'cashier')
Low Stock(items)
@if($outofstock->isNotEmpty())
{{ count($outofstock) }}
@else
0
@endif
Monthly Purchase
{{ number_format($purchaseCost, 2) }}
Daily Sales
{{ $dailySales }}
Monthly Sales
{{ $monthlySales }}
@endif
@php // Ensure variables exist for all roles $topProductLabels = []; $topProductCounts = []; // Only populate them if user is an admin if (auth()->user()->role === 'admin') { $topProductLabels = $topProducts->pluck('name')->toArray(); $topProductCounts = $topProducts->pluck('total_quantity_sold')->toArray(); } @endphp @if (auth()->user()->role === 'admin')
Top Products
Payment Types

Cash {{ $paymentMethods->where('payment_method', 'cash')->first()->count ?? 0 }}

Mobile {{ $paymentMethods->where('payment_method', 'mobile')->first()->count ?? 0 }}

Card {{ $paymentMethods->where('payment_method', 'card')->first()->count ?? 0 }}

@endif
Sales Overview
@php $labels = $orderType->pluck('order_type'); // ['In-Store', 'Online'] $counts = $orderType->pluck('count'); // [25, 45] @endphp
Order Types
@endsection @section('scripts') @endsection