{{-- Welcome Banner --}}

Selamat datang kembali, {{ auth()->user()->name }}! 👋

@if($this->profitGrowth > 0) Performa penjualan naik {{ $this->profitGrowth }}% {{ strtolower($this->previousPeriodLabel) }}. @elseif($this->profitGrowth < 0) Performa penjualan turun {{ abs($this->profitGrowth) }}% {{ strtolower($this->previousPeriodLabel) }}. @else Performa penjualan stabil {{ strtolower($this->previousPeriodLabel) }}. @endif

Buka POS

Total Keuntungan

Rp {{ number_format($this->allTimeProfit, 0, ',', '.') }}

Sejak {{ $this->firstTransactionDate }}

Total Penjualan

Rp {{ number_format($this->allTimeSales, 0, ',', '.') }}

Sejak {{ $this->firstTransactionDate }}

{{-- Main Content Grid --}}
{{-- Revenue Chart Section with Profitability Sidebar --}}
{{-- Chart Area --}}

Ringkasan Pendapatan

Analisis Pemasukan vs Pengeluaran

{{-- Tooltip hint --}}
@if($filter === 'today') 📅 {{ now()->format('d M Y') }} @elseif($filter === 'week') 📅 {{ now()->startOfWeek()->format('d M') }} - {{ now()->endOfWeek()->format('d M Y') }} @elseif($filter === 'month') 📅 1 - {{ now()->endOfMonth()->format('d M Y') }} @elseif($filter === 'year') 📅 Jan - Des {{ now()->year }} @endif

Chart akan ditampilkan di sini

Pemasukan: Rp {{ number_format($this->totalSales, 0, ',', '.') }}
{{-- Profitability Sidebar --}}

Profitabilitas

Analisis Laba & Pengeluaran

Laba Bersih Saat Ini

Rp {{ number_format($this->netProfit, 0, ',', '.') }}

@if($this->profitGrowth > 0)
+{{ $this->profitGrowth }}% @elseif($this->profitGrowth < 0)
{{ $this->profitGrowth }}% @else
0% @endif {{ $this->previousPeriodLabel }}
Margin Kotor {{ $this->grossMarginPercent }}%

Rp {{ number_format($this->grossProfit, 0, ',', '.') }}

@if($this->otherIncome > 0)
@php $totalIncome = $this->grossProfit + $this->otherIncome; $otherIncomePercent = $totalIncome > 0 ? min(100, ($this->otherIncome / $totalIncome) * 100) : 0; @endphp
Pemasukan Lain {{ number_format($otherIncomePercent, 1) }}%

Rp {{ number_format($this->otherIncome, 0, ',', '.') }}

@endif
@php // Hitung persentase pengeluaran terhadap total pemasukan (gross + other) $totalIncome = $this->grossProfit + $this->otherIncome; $expenseBarPercent = 0; if ($totalIncome > 0) { $expenseBarPercent = min(100, ($this->operatingExpenses / $totalIncome) * 100); } elseif ($this->operatingExpenses > 0) { $expenseBarPercent = 100; // Ada pengeluaran tanpa pemasukan } @endphp
Total Pengeluaran {{ number_format($expenseBarPercent, 1) }}%

Rp {{ number_format($this->operatingExpenses, 0, ',', '.') }}

*Laba Bersih = Penjualan + Pemasukan Lain - Pengeluaran

{{-- Quick Stats Grid (4 small cards) - Saldo Kasir, Pengajuan, Penagihan, Gantung --}}
Shift 1

Saldo Kasir

Rp {{ number_format($this->totalSales, 0, ',', '.') }}
Urgent

Pengajuan

0 Berkas
Hari Ini

Penagihan

Rp 0
Active

Gantung

0 Nota
{{-- Stats Cards (Product, Member, etc) - COMMENTED OUT FOR SAFETY --}} {{--

Produk Aktif

{{ $this->totalProducts }}

Member Aktif

{{ $this->totalMembers }}

Stok Kritis

{{ $this->lowStockProducts->count() }}

Kategori

{{ \App\Models\Category::where('isActive', true)->count() }}
--} {{-- Tabs: Stok Kritis / Produk Terlaris --}}
{{-- Tabs Header --}}
{{-- Content: Stok Menipis --}}
@forelse($this->lowStockProducts as $product)
{{ $product->category?->icon ?? '📦' }}
{{ $product->name }}

{{ $product->category?->name ?? '-' }}

Sisa {{ $product->stock }}
@empty

Semua stok aman!

@endforelse
{{-- Content: Produk Terlaris --}}
@forelse($this->topProducts as $index => $product)
#{{ $index + 1 }}
{{ $product->name }}
{{ $product->category?->name ?? '-' }}
{{ $product->total_sold }} Terjual
@empty

Belum ada data penjualan

@endforelse
{{-- Recent Transactions --}}

Transaksi Terkini

Lihat Semua
@forelse($this->recentTransactions as $trx) @empty @endforelse
Invoice Member Tanggal Jumlah Status
{{ $trx->invoiceNumber }} @if($trx->member)
{{ strtoupper(substr($trx->member->name, 0, 2)) }}
{{ $trx->member->name }}
@else - @endif
{{ $trx->date?->format('d M Y, H:i') }} Rp {{ number_format($trx->totalAmount, 0, ',', '.') }} {{ $trx->status === 'COMPLETED' ? 'Lunas' : $trx->status }}

Belum ada transaksi