{{-- Filter Bar --}}
@if($period === 'custom')
s/d
@endif
{{ \Carbon\Carbon::parse($dateFrom)->format('d M Y') }} - {{ \Carbon\Carbon::parse($dateTo)->format('d M Y') }}
@php $data = $this->getReportData(); @endphp {{-- KPI Summary Cards --}}
{{-- Total Transaksi --}}

Total Transaksi

{{ number_format($data['summary']->total_orders ?? 0, 0) }}

@if($data['orderGrowth'] !== null)

{{ $data['orderGrowth'] >= 0 ? '+' : '' }}{{ $data['orderGrowth'] }}% vs periode lalu

@endif
{{-- Total Pendapatan --}}

Total Pendapatan

Rp {{ number_format($data['summary']->total_revenue ?? 0, 0, ',', '.') }}

@if($data['revenueGrowth'] !== null)

{{ $data['revenueGrowth'] >= 0 ? '+' : '' }}{{ $data['revenueGrowth'] }}% vs periode lalu

@endif
{{-- Total Modal --}}

Total Modal

Rp {{ number_format($data['summary']->total_cost ?? 0, 0, ',', '.') }}

{{-- Total Laba --}}

Total Laba

Rp {{ number_format($data['summary']->total_profit ?? 0, 0, ',', '.') }}

@if($data['profitGrowth'] !== null)

{{ $data['profitGrowth'] >= 0 ? '+' : '' }}{{ $data['profitGrowth'] }}% vs periode lalu

@endif
{{-- Profit Margin --}}

Margin Laba

{{ $data['profitMargin'] }}%

Avg: Rp {{ number_format($data['summary']->avg_order ?? 0, 0, ',', '.') }}/order

{{-- Tab Navigation --}}
{{-- TAB: Overview --}} @if($tab === 'overview')
{{-- Daily Trend Chart (C3.js) --}}

Trend Penjualan Harian

@if($data['dailyTrend']->count() > 0)
{{ $data['dailyTrend']->count() }} hari data Total: Rp {{ number_format($data['dailyTrend']->sum('revenue'), 0, ',', '.') }}
@else

Belum ada data penjualan

@endif
{{-- Payment Methods --}}

Metode Pembayaran

@forelse($data['paymentMethods'] as $pm) @php $methodLabel = match($pm->payment_method) { 'cash' => 'Tunai', 'transfer' => 'Transfer', 'qris' => 'QRIS', 'credit' => 'Piutang', default => ucfirst($pm->payment_method ?? 'Lainnya'), }; $percentage = ($data['summary']->total_revenue ?? 0) > 0 ? round(($pm->total / $data['summary']->total_revenue) * 100) : 0; $colors = ['cash' => '#10B981', 'transfer' => '#2563EB', 'qris' => '#8B5CF6', 'credit' => '#F59E0B']; $color = $colors[$pm->payment_method] ?? '#6B7280'; @endphp
{{ $methodLabel }} {{ $percentage }}%
{{ $pm->count }} transaksi Rp {{ number_format($pm->total, 0, ',', '.') }}
@empty

Belum ada data

@endforelse
{{-- TAB: Orders --}} @elseif($tab === 'orders') {{-- Desktop table --}} {{-- Mobile cards --}}
@forelse($data['orders'] as $order) @php $orderProfit = $order->total - $order->total_cost; @endphp

{{ $order->order_number }}

{{ $order->customer_name ?? 'Walk-in' }} | {{ $order->created_at->format('d M Y') }}

Rp {{ number_format($order->total, 0, ',', '.') }}
@php $pmLabel = match($order->payment_method) { 'cash' => 'Tunai', 'transfer' => 'Transfer', 'qris' => 'QRIS', 'credit' => 'Piutang', default => ucfirst($order->payment_method ?? '-') }; @endphp {{ $pmLabel }} Modal: Rp {{ number_format($order->total_cost, 0, ',', '.') }} Laba: Rp {{ number_format($orderProfit, 0, ',', '.') }}
@empty
Belum ada transaksi pada periode ini
@endforelse
{{-- TAB: Products --}} @elseif($tab === 'products') {{-- Desktop table --}} {{-- Mobile cards --}}
@forelse($data['perProduct'] as $index => $item) @php $margin = $item->total_revenue > 0 ? round(($item->total_profit / $item->total_revenue) * 100, 1) : 0; @endphp

{{ $item->product_name }}

{{ number_format($item->total_qty, 0) }} terjual | {{ $item->order_count }}x transaksi

{{ $margin }}%
Rp {{ number_format($item->total_revenue, 0, ',', '.') }} Modal: Rp {{ number_format($item->total_cost, 0, ',', '.') }} Laba: Rp {{ number_format($item->total_profit, 0, ',', '.') }}
@empty
Belum ada data penjualan
@endforelse
{{-- TAB: Customers --}} @elseif($tab === 'customers') {{-- Desktop table --}} {{-- Mobile cards --}}
@forelse($data['perCustomer'] as $cust)

{{ $cust->customer_name ?? 'Walk-in' }}

{{ $cust->total_orders }} order

Rp {{ number_format($cust->total_revenue, 0, ',', '.') }}
Laba: Rp {{ number_format($cust->total_profit, 0, ',', '.') }} @if($cust->total_piutang > 0) Piutang: Rp {{ number_format($cust->total_piutang, 0, ',', '.') }} @endif
@empty
Belum ada data pelanggan
@endforelse
@endif
{{-- C3.js CDN --}} @push('styles') @endpush @push('scripts') @endpush