@extends('temple.layouts.app') @section('title', 'Temple Reports') @php // Single source of truth for all figures (cards + charts stay in sync) $paidAmount = (float) ($totals['paid_amount'] ?? $totals['receipts'] ?? 0); $paidCount = (int) ($totals['paid_count'] ?? $totals['receipts_count'] ?? 0); $pendingAmount = (float) ($totals['pending_amount'] ?? $totalPending ?? 0); $pendingCnt = (int) ($totals['pending_count'] ?? $pendingCount ?? 0); $vazhipadCount = (int) ($totals['vazhipad_count'] ?? 0); $trendData = collect($trend ?? []); @endphp @section('content') {{-- Date Filter --}}
{{-- Summary Cards --}}
{{-- Total Paid Amount --}}
{{ number_format($paidCount) }} paid
₹{{ number_format($paidAmount, 2) }}
Total Paid Amount
{{-- Total Vazhipads --}}
{{ number_format($vazhipadCount) }}
Total Vazhipads
{{-- Pending Payments (links to pending report if the route exists) --}} @php $pendingUrl = Route::has('temple.reports.pending') ? route('temple.reports.pending', ['from_date' => $from, 'to_date' => $to]) : null; @endphp <{{ $pendingUrl ? 'a href='.$pendingUrl : 'div' }} class="report-index-stat-card">
{{ number_format($pendingCnt) }} pending
₹{{ number_format($pendingAmount, 2) }}
Pending Payments
{{-- Charts Section --}}
{{-- Collection Trend --}}

Collection Trend

@if($trendData->isEmpty())

No collections in the selected period.

@else @endif
{{-- Paid vs Pending --}}

Paid vs Pending

@if($paidAmount <= 0 && $pendingAmount <= 0)

No data for the selected period.

@else @endif
{{-- Quick Access --}}

Quick Access

Daily Report Receipts Vazhipads @if($pendingUrl) Pending Payments @endif
@endsection @push('scripts') @endpush