@extends('temple.layouts.app') @section('title', 'Vazhipad Receipts') @section('content')
{{-- ================================================================ FLASH NOTIFICATIONS ================================================================= --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- ================================================================ PAGE HEADER ================================================================= --}}

Vazhipad Receipts

Manage devotee booking receipts, sankalpam details, and dakshina accounts

{{-- ================================================================ SUMMARY CALCULATIONS ================================================================= --}} @php $totalReceiptsCount = ($receiptss instanceof \Illuminate\Pagination\AbstractPaginator) ? $receiptss->total() : $receiptss->count(); @endphp {{-- ================================================================ SEARCH & FILTER ================================================================= --}}
{{-- ================================================================ RECEIPTS TABLE ================================================================= --}}
@forelse($receiptss as $receipts) @php /* |-------------------------------------------------------------------------- | DEVOTEES (always a Collection - prevents "filter() on null") |-------------------------------------------------------------------------- */ $devotees = $receipts->devotees; if (! $devotees instanceof \Illuminate\Support\Collection) { $devotees = collect($devotees ?? []); } $devoteeCount = $devotees->count(); $firstDevotee = $devotees->first(); $devoteeName = $firstDevotee?->devotee_name ?? 'Walk-in Devotee'; $nakshatram = $firstDevotee?->nakshatram; /* |-------------------------------------------------------------------------- | ALL ITEMS (collected from every devotee) |-------------------------------------------------------------------------- */ $allItems = collect(); foreach ($devotees as $devotee) { $devoteeItems = $devotee->items ?? collect(); if (! $devoteeItems instanceof \Illuminate\Support\Collection) { $devoteeItems = collect($devoteeItems); } foreach ($devoteeItems as $devoteeItem) { $allItems->push($devoteeItem); } } /* |-------------------------------------------------------------------------- | PAYMENT STATUS |-------------------------------------------------------------------------- */ $paymentStatus = strtolower( $receipts->payment_status ?? $receipts->status ?? 'pending' ); $status = $paymentStatus === 'paid' ? 'confirmed' : ( in_array($paymentStatus, ['pending', 'unpaid', 'partial', 'partially_paid']) ? 'pending' : $paymentStatus ); /* |-------------------------------------------------------------------------- | RECEIPT DATE |-------------------------------------------------------------------------- */ $receiptDate = $receipts->receipts_date ?? $receipts->receipt_date ?? $receipts->created_at; /* |-------------------------------------------------------------------------- | VAZHIPAD NAMES |-------------------------------------------------------------------------- */ $vazhipadNames = $allItems ->map(function ($item) { return $item->vazhipad?->name ?? $item->vazhipad?->vazhipad_name ?? ''; }) ->filter() ->implode(' '); /* |-------------------------------------------------------------------------- | SEARCH DATA |-------------------------------------------------------------------------- */ $searchHaystack = strtolower( ($receipts->id ?? '') . ' ' . ($receipts->receipt_number ?? '') . ' ' . ($devoteeName ?? '') . ' ' . ($nakshatram ?? '') . ' ' . ($vazhipadNames ?? '') . ' ' . ($receipts->payment_method ?? '') . ' ' . ($receipts->type ?? '') ); @endphp {{-- ================================================= RECEIPT NUMBER ================================================== --}} {{-- ================================================= DEVOTEE & NAKSHATRAM ================================================== --}} {{-- ================================================= VAZHIPAD OFFERING ================================================== --}} {{-- ================================================= RECEIPT DATE ================================================== --}} {{-- ================================================= TOTAL DAKSHINA ================================================== --}} {{-- ================================================= ACTION ================================================== --}} @empty @endforelse
Receipt No Devotee & Nakshatram Vazhipad Offering Receipt Date Total Dakshina Action
{{ $receipts->receipt_number ?: '#RC-' . str_pad($receipts->id, 6, '0', STR_PAD_LEFT) }}
{{ $devoteeName }} @if($devoteeCount > 1) +{{ $devoteeCount - 1 }} more @endif @if(!empty($nakshatram)) {{ $nakshatram }} @endif
@forelse($allItems->take(3) as $item) @php $vazhipad = $item->vazhipad ?? null; $vazhipadName = $vazhipad?->name ?? $vazhipad?->vazhipad_name ?? 'Deleted Vazhipad'; @endphp {{ $vazhipadName }} @if((int) ($item->quantity ?? 1) > 1) × {{ $item->quantity }} @endif @empty No Vazhipad @endforelse @if($allItems->count() > 3) +{{ $allItems->count() - 3 }} more item(s) @endif
@if($receiptDate) {{ \Carbon\Carbon::parse($receiptDate)->format('d M Y') }} @else No Date @endif
₹ {{ number_format((float) ($receipts->total_amount ?? 0), 2) }} View
No receipts found.
{{-- ================================================================ PAGINATION ================================================================= --}} @if($receiptss instanceof \Illuminate\Contracts\Pagination\Paginator)
{{ $receiptss->links() }}
@endif
{{-- ================================================================ NO SEARCH RESULTS ================================================================= --}}

No Matching Receipts

No receipt records match your current search query or filter selection.

{{-- ================================================================ JAVASCRIPT ================================================================= --}} @push('scripts') @endpush @endsection