{{-- Dashboard File: resources/views/livewire/dashboard.blade.php Component: app/Livewire/Dashboard.php --}}
@once @endonce {{-- In dashboard.blade.php — ADD after page-header --}} @if(auth()->user()->isAdminOrAbove() && isset($newDevices) && $newDevices->count() > 0)
{{ $newDevices->count() }} new device login(s) pending approval
@foreach($newDevices->take(3) as $d) {{ $d->user?->name }} ({{ $d->device_name }}){{ !$loop->last ? ', ' : '' }} @endforeach @if($newDevices->count() > 3) and {{ $newDevices->count() - 3 }} more @endif
@if(auth()->user()->isSuperAdmin()) Review Devices → @endif
@endif {{-- ════════════════════════════════════════════════════ EMPLOYEE DASHBOARD ════════════════════════════════════════════════════ --}} @if(auth()->user()->isEmployee()) {{-- Page header --}} {{-- Widgets --}}
{{ number_format($todayBills) }}
Bills Today
{{ number_format($monthBills) }} this month
₹{{ number_format($todayAmount, 0) }}
Sales Today
₹{{ number_format($monthAmount, 0) }} this month
₹{{ number_format($todayCash, 0) }}
Cash Collected
Today's cash collection
₹{{ number_format($todayUpi, 0) }}
UPI Collected
Due: ₹{{ number_format($todayDue, 0) }}
{{-- Recent Sales + two col section --}}
Today's Sales
{{-- Search --}}
@forelse($recentSales as $sale) @empty @endforelse
# Invoice Customer Time Items Amount Payment Status Action
{{ str_pad($loop->iteration, 2, '0', STR_PAD_LEFT) }} {{ $sale->invoice_no }} @if($sale->customer)
{{ $sale->customer->name ?: '—' }}
{{ $sale->customer->mobile }}
@else Walk-in @endif
{{ $sale->created_at->format('h:i A') }} {{ $sale->items->count() }} ₹{{ number_format($sale->net_amount, 2) }} @foreach($sale->payments ?? [] as $pay) {{ ucfirst($pay->payment_method) }} @endforeach {{ ucfirst($sale->payment_status) }} View
{{ $search ? 'No results found' : 'No sales today yet' }}
{{-- Pagination --}} @if($recentSales->hasPages())
Showing {{ $recentSales->firstItem() }}–{{ $recentSales->lastItem() }} of {{ $recentSales->total() }} @foreach($recentSales->getUrlRange(1, $recentSales->lastPage()) as $page => $url) @endforeach
@endif
{{-- Company wise + Expiring batches --}}
{{-- Company wise sales today --}}
Company Wise Sales Today
@forelse($companySales as $co) @empty @endforelse
# Company Bills Amount
{{ str_pad($loop->iteration, 2, '0', STR_PAD_LEFT) }} {{ $co->company_name }} {{ $co->bill_count }} ₹{{ number_format($co->total_amount, 2) }}
No sales today
{{-- Expiring batches --}}
Expiring Batches
@forelse($expiringBatches as $batch) @php $days = (int) now()->startOfDay()->diffInDays($batch->expiry_date->startOfDay(), false); $expired = $days < 0; @endphp @empty @endforelse
Product Batch Expiry Qty Days
{{ \Illuminate\Support\Str::limit($batch->product?->product_name ?? '—', 22) }} {{ $batch->batch_no ?: '—' }} {{ $batch->expiry_date->format('d M Y') }} {{ number_format($batch->quantity, 0) }} {{ $expired ? 'Expired' : $days.' d' }}
No expiring batches
@endif {{-- /employee --}} {{-- ════════════════════════════════════════════════════ ADMIN / SUPERADMIN DASHBOARD ════════════════════════════════════════════════════ --}} @if(auth()->user()->isAdminOrAbove()) {{-- Page header --}} {{-- Branch Tabs --}}
@foreach($branches as $branch) @endforeach
{{-- Loading overlay on tab switch --}}
Loading…
{{-- Widgets --}}
{{ number_format($monthBills) }}
Total Bills
Today
₹{{ number_format($monthAmount, 0) }}
Total Sales
Total
₹{{ number_format($todayCash, 0) }}
Cash Collected
Today
₹{{ number_format($todayUpi, 0) }}
UPI Collected
Due: ₹{{ number_format($todayDue, 0) }}
{{-- Branch comparison (all branches tab only) --}} @if($selectedBranch === 'all' && count($branchWidgets) > 0)
Branch Performance Today
@foreach($branchWidgets as $bw)
{{ $bw['name'] }}
{{ $bw['bills'] }}
Bills
₹{{ number_format($bw['amount'], 0) }}
Revenue
@php $maxAmt = collect($branchWidgets)->max('amount') ?: 1; @endphp
@endforeach
@endif {{-- Monthly Revenue Chart (full width) --}}
Monthly Revenue
Last 6 Months Revenue @if($selectedBranch !== 'all') — {{ $branches->find($selectedBranch)?->branch_name }} @else — All Branches @endif
{{-- Recent Sales --}}
Today's Sales
@forelse($recentSales as $sale) @empty @endforelse
# Invoice Customer Branch Time Items Amount Status Action
{{ str_pad($loop->iteration, 2, '0', STR_PAD_LEFT) }} {{ $sale->invoice_no }} @if($sale->customer)
{{ $sale->customer->name ?: '—' }}
{{ $sale->customer->mobile }}
@else Walk-in @endif
Branch {{ $sale->branch_id }} {{ $sale->created_at->format('h:i A') }} {{ $sale->items->count() }} ₹{{ number_format($sale->net_amount, 2) }} {{ ucfirst($sale->payment_status) }} View
{{ $search ? 'No results found' : 'No sales today yet' }}
@if($recentSales->hasPages())
Showing {{ $recentSales->firstItem() }}–{{ $recentSales->lastItem() }} of {{ $recentSales->total() }} @foreach($recentSales->getUrlRange(1, $recentSales->lastPage()) as $page => $url) @endforeach
@endif
{{-- Today's Updated Bills --}} @if(isset($todayUpdatedBills) && $todayUpdatedBills->count() > 0)
@foreach($todayUpdatedBills as $sale) @endforeach
Invoice Customer Net Amount Status Edited By Edit Reason Time
{{ $sale->invoice_no }} {{ $sale->customer?->name ?? 'Walk-in' }} @if($sale->customer?->mobile)
{{ $sale->customer->mobile }}
@endif
₹{{ number_format($sale->net_amount, 0) }} {{ ucfirst($sale->payment_status) }} {{ $sale->updatedByUser?->name ?? '—' }} {{ Str::limit($sale->edit_reason ?? '—', 40) }} {{ $sale->updated_at->format('h:i A') }}
@endif {{-- Employee Sales + Due Payments --}}
{{-- Employee wise sales --}}
Employee Sales Today
@forelse($employeeSales as $emp) @empty @endforelse
Employee Bills Amount
{{ $emp->name }}
{{ ucfirst($emp->role) }}
{{ $emp->bill_count }} ₹{{ number_format($emp->total_amount, 2) }}
No activity today
{{-- Due payments --}}
Pending Due Payments
@forelse($dueSales as $due) @empty @endforelse
Invoice Customer Due Action
{{ $due->invoice_no }} @if($due->customer)
{{ $due->customer->name ?: '—' }}
{{ $due->customer->mobile }}
@else Walk-in @endif
₹{{ number_format($due->due_amount, 2) }}
No pending dues
{{-- Company wise sales + Expiring batches --}}
{{-- Company wise --}}
Company Wise Sales Today
@forelse($companySales as $co) @empty @endforelse
# Company Bills Amount
{{ str_pad($loop->iteration, 2, '0', STR_PAD_LEFT) }} {{ $co->company_name }} {{ $co->bill_count }} ₹{{ number_format($co->total_amount, 2) }}
No sales today
{{-- Expiring batches --}}
Expiring Batches
@forelse($expiringBatches as $batch) @php $days = now()->diffInDays($batch->expiry_date, false); $expired = $days < 0; @endphp @empty @endforelse
Product Batch Expiry Qty Days
{{ \Illuminate\Support\Str::limit($batch->product?->product_name ?? '—', 20) }} {{ $batch->batch_no ?: '—' }} {{ $batch->expiry_date->format('d M Y') }} {{ number_format($batch->quantity, 0) }} {{ $expired ? 'Expired' : $days.' d' }}
No expiring batches
@endif {{-- /admin --}}