@extends('layouts.app') @section('title', 'Inventory Dashboard') @push('styles') @endpush @section('content') {{-- Welcome Banner --}}

Welcome back, {{ auth()->user()->name ?? 'User' }}!

Managing inventory for {{ $tenant->business_name ?? 'Your Business' }}

{{ $planName ?? 'Free' }} Plan
{{-- Subscription expired banner --}} @if(isset($subscriptionActive) && !$subscriptionActive)
Subscription expired. Your paid plan has ended — new orders through your forms have been paused. Renew to keep selling.
Renew plan
@endif {{-- Critical quota alerts (at or near limits) --}} @if(!empty($criticalQuotas ?? [])) @foreach($criticalQuotas as $qKey => $q)
@if($q['level'] === 'full') {{ $q['label'] }} quota full ({{ $q['used'] }} / {{ $q['max'] }}). @if($qKey === 'orders') Your forms are no longer accepting new orders this month. Upgrade to receive more. @elseif($qKey === 'products') You can\'t add more products until you upgrade or remove some. @elseif($qKey === 'forms') You can\'t create more order forms until you upgrade. @elseif($qKey === 'staff') You can\'t invite more staff until you upgrade. @else You\'ve hit your plan limit. Upgrade to continue. @endif @else {{ $q['label'] }} almost full ({{ $q['used'] }} / {{ $q['max'] }} — {{ $q['pct'] }}%). @if($qKey === 'orders') Only {{ $q['remaining'] }} orders left this month. Upgrade now to avoid disruption. @else Only {{ $q['remaining'] }} left. Consider upgrading soon. @endif @endif
Upgrade
@endforeach @endif {{-- Personal performance widget for non-owner staff. Owner / managers see the tenant-wide stats below. --}} @if(! empty($personalStats))
Your performance · {{ now()->format('F Y') }}

@if($personalStats['rep_name']) Hi, {{ $personalStats['rep_name'] }} —@endif Let's close some deals

@if($personalStats['commission_rate'] > 0) {{ $personalStats['commission_rate'] }}% commission @endif
Deals Closed
{{ number_format($personalStats['deals_mtd']) }}
Revenue Attributed
{{ $currency }}{{ number_format($personalStats['revenue_mtd'], 2) }}
Commission Earned
{{ $currency }}{{ number_format($personalStats['commission_mtd'], 2) }}
Open Customers
{{ number_format($personalStats['open_customers']) }}
Pending Appointments
{{ number_format($personalStats['open_appointments']) }}
@endif {{-- Stats Grid --}}
{{ $totalProducts }}
Total Products
@if($lowStockCount > 0) {{ $lowStockCount }} alert{{ $lowStockCount > 1 ? 's' : '' }} @endif
{{ $lowStockCount }}
Low Stock Alerts
@if($pendingOrders > 0) {{ $pendingOrders }} pending @endif
{{ $totalOrders }}
Total Orders
{{ $currency }}{{ number_format($revenueThisMonth, 0) }}
Revenue This Month
{{-- Plan Quota Usage --}}

Plan Usage

Upgrade
@foreach($quota as $key => $q) @php $isUnlimited = $q['max'] == -1; $pct = $isUnlimited ? 0 : ($q['max'] > 0 ? min(round(($q['used'] / $q['max']) * 100), 100) : 0); $level = $isUnlimited ? 'unlimited' : ($pct >= 90 ? 'danger' : ($pct >= 70 ? 'warning' : 'ok')); @endphp
{{ $q['label'] }} {{ $q['used'] }} / {{ $isUnlimited ? '∞' : number_format($q['max']) }}
@if(!$isUnlimited)
@else
@endif
@endforeach
{{-- Quick Actions --}}

Quick Actions

Add Product
Create Form
View Orders
Add Staff
{{-- Recent Orders & Low Stock --}}

Recent Orders

View All
@if($recentOrders->count()) @foreach($recentOrders as $order) @endforeach
Order # Customer Total Status Date
{{ $order->order_number ?? 'ORD-' . str_pad($order->id, 5, '0', STR_PAD_LEFT) }} {{ $order->customer_name ?? '—' }} {{ $currency }}{{ number_format($order->total, 2) }} {{ ucfirst($order->status) }} {{ $order->created_at->format('M d') }}
@else

No orders yet. Share your order forms to start receiving orders!

@endif

Low Stock

@if($lowStockProducts->count()) @else

All products are well stocked!

@endif
{{-- Charts --}}

Performance

Orders This Week

Revenue This Week

@endsection @push('scripts') @endpush