@extends('temple.layouts.app') @section('title', 'Receipt #' . str_pad($receipt->id, 6, '0', STR_PAD_LEFT)) @section('content')
{{-- ========================================================= SUCCESS ALERT ========================================================== --}} @if(session('success'))
{{ session('success') }}
@endif {{-- ========================================================= TOP ACTION TOOLBAR ========================================================== --}}
{{-- Back --}} Back to Receipts {{-- Payment --}} Payment for Receipt
{{-- New Receipt --}} New Receipt
{{-- ========================================================= RECEIPT ========================================================== --}}
{{-- ===================================================== TEMPLE HEADER ====================================================== --}}
|| ഓം നമഃ ശിവായ || ശുഭം ഭവതു ||

TempleMitra Devasthanam

Official Vazhipad & Pooja Dakshina Voucher
{{-- ===================================================== RECEIPT META ====================================================== --}}
{{-- Receipt Number --}}
Receipt Number
#RC-{{ str_pad($receipt->id, 6, '0', STR_PAD_LEFT) }}
{{-- Receipt Date --}}
Receipt Date
{{ $receipt->receipts_date ? \Carbon\Carbon::parse($receipt->receipts_date)->format('d M Y') : 'N/A' }}
{{-- Booking Status --}}
Booking Status
{{ ucfirst($receipt->status ?? 'Confirmed') }}
{{-- Generated --}}
Generated On
{{ $receipt->created_at ? $receipt->created_at->format('d/m/Y h:i A') : date('d/m/Y') }}
{{-- ===================================================== ALL DEVOTEES ====================================================== --}} @php $devotees = $receipt->devotees ?? collect(); if (! $devotees instanceof \Illuminate\Support\Collection) { $devotees = collect($devotees); } $grandTotal = 0; $grandQuantity = 0; @endphp @if($devotees->isNotEmpty()) {{-- ================================================= DEVOTEE SECTIONS ================================================== --}} @foreach($devotees as $devotee) @php $devoteeItems = $devotee->items ?? collect(); if (! $devoteeItems instanceof \Illuminate\Support\Collection) { $devoteeItems = collect($devoteeItems); } $devoteeTotal = $devoteeItems->sum(function ($item) { return (float) ($item->amount ?? 0); }); $devoteeQuantity = $devoteeItems->sum(function ($item) { return (int) ($item->quantity ?? 0); }); $grandTotal += $devoteeTotal; $grandQuantity += $devoteeQuantity; @endphp {{-- ================================================= DEVOTEE HEADER ================================================== --}}
Devotee {{ $loop->iteration }}

{{ $devotee->devotee_name ?? 'Walk-in Devotee' }}

Offering dedicated in accordance with temple rituals
{{-- Nakshatram --}} @if(!empty($devotee->nakshatram))
Birth Star (Nakshatram)
{{ $devotee->nakshatram }}
@endif
{{-- ================================================= DEVOTEE VAZHIPAD TABLE ================================================== --}} @forelse($devoteeItems as $item) @php $vazhipad = $item->vazhipad ?? null; $vazhipadName = $vazhipad?->name ?? $vazhipad?->vazhipad_name ?? 'Vazhipad Offering'; $rate = $item->rate ?? 0; $amount = $item->amount ?? 0; @endphp {{-- Number --}} {{-- Vazhipad --}} {{-- Quantity --}} {{-- Rate --}} {{-- Amount --}} @empty @endforelse {{-- Devotee Total --}}
# Vazhipad / Offering Name Qty Rate Amount (₹)
{{ $loop->iteration }} {{ $vazhipadName }} @if($vazhipad && !empty($vazhipad->description))
{{ Str::limit($vazhipad->description, 60) }}
@endif
{{ $item->quantity ?? 1 }} ₹{{ number_format((float) $rate, 2) }} ₹{{ number_format((float) $amount, 2) }}
No Vazhipad items found.
{{ $devotee->devotee_name ?? 'Devotee' }} Total {{ $devoteeQuantity }} ₹{{ number_format($devoteeTotal, 2) }}
@endforeach @else {{-- ================================================= NO DEVOTEES ================================================== --}}
Devotee

{{ $receipt->devotee_name ?? 'Walk-in Devotee' }}

@if(!empty($receipt->nakshatram))
Nakshatram: {{ $receipt->nakshatram }}
@endif
@endif {{-- ===================================================== GRAND TOTAL ====================================================== --}}
Grand Total Dakshina Contribution {{ $grandQuantity }} items ₹ {{ number_format($grandTotal, 2) }}
{{-- ===================================================== PAYMENT INFORMATION ====================================================== --}}
Payment Status {{ ucfirst(str_replace('_', ' ', $receipt->payment_status ?? 'Pending')) }}
@if(!empty($receipt->payment_method))
Payment Method {{ ucfirst($receipt->payment_method) }}
@endif
{{-- ===================================================== FOOTER ====================================================== --}}
@endsection