@extends('layouts.app') @section('page-title', 'Rent Payment History - ' . $gym->name) @section('content')

Rent Payment History

{{ $gym->name }}

Back to Gyms
@forelse($payments as $payment) @php // For history, show the ACTUAL historical status // A payment that was paid should always show as paid in history $status = $payment->status ?? 'pending'; // If payment has paid_date, it was definitely paid (historical record) if ($payment->paid_date) { $status = 'paid'; } // If status is 'paid' in database, show as paid (even if no paid_date set) elseif ($status == 'paid') { $status = 'paid'; } // For pending payments, check if overdue elseif ($status == 'pending' && $payment->next_payment_due_date) { $daysUntilDue = now()->diffInDays($payment->next_payment_due_date, false); if ($daysUntilDue < 0) { $status = 'overdue'; } } @endphp @empty @endforelse
Invoice # Payment Date Amount Next Payment Due Paid Date Status Action
{{ $payment->invoice_number ?? 'N/A' }} {{ $payment->payment_date->format('M d, Y') }} Rs {{ number_format($payment->amount, 2) }} {{ $payment->next_payment_due_date?->format('M d, Y') ?? 'N/A' }} {{ $payment->paid_date ? \Carbon\Carbon::parse($payment->paid_date)->format('M d, Y') : 'N/A' }} @if($status == 'paid') Paid @elseif($status == 'overdue') Overdue @else Pending @endif
@if($status == 'pending' || $status == 'overdue') @if(auth()->user()->isSuperAdmin())
@csrf
@endif @endif
No rent payment history found for this gym.
@endsection @push('scripts') @endpush