@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) }}
@endif
{{-- Stats Grid --}}
{{ $totalProducts }}
Total Products
{{ $lowStockCount }}
Low Stock Alerts
{{ $totalOrders }}
Total Orders
{{ $currency }}{{ number_format($revenueThisMonth, 0) }}
Revenue This Month
{{-- Plan Quota Usage --}}
@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
@if(!$isUnlimited)
@else
@endif
@endforeach
{{-- Quick Actions --}}
Quick Actions
{{-- Recent Orders & Low Stock --}}
@if($recentOrders->count())
@else
No orders yet. Share your order forms to start receiving orders!
@endif
@if($lowStockProducts->count())
@else
All products are well stocked!
@endif
{{-- Charts --}}
Performance
@endsection
@push('scripts')
@endpush