@extends('layouts.app') @section('page-title', 'Gyms That Pay Rent') @section('content')

Gyms That Pay Rent ({{ $gyms->count() }})

@forelse($gyms as $gym) @empty @endforelse
Gym Name City Monthly Rent Last Payment Next Payment Due Status Action
{{ $gym->name }} {{ $gym->city ?? 'N/A' }} Rs {{ number_format($gym->rent_amount, 2) }} @if($gym->rentPayments->where('status', 'paid')->count() > 0) {{ $gym->rentPayments->where('status', 'paid')->sortByDesc('payment_date')->first()->payment_date->format('M d, Y') }} @else No payment yet @endif @if($gym->rentPayments->where('status', 'paid')->count() > 0) @php $lastPayment = $gym->rentPayments->where('status', 'paid')->sortByDesc('payment_date')->first(); $dueDate = $lastPayment->next_payment_due_date; @endphp @if($dueDate && $dueDate < now()) {{ $dueDate->format('M d, Y') }} (Overdue) @else {{ $dueDate?->format('M d, Y') ?? 'N/A' }} @endif @else Due Now @endif @if($gym->rentPayments->where('status', 'paid')->count() > 0) @php $lastPayment = $gym->rentPayments->where('status', 'paid')->sortByDesc('payment_date')->first(); $dueDate = $lastPayment->next_payment_due_date; @endphp @if($dueDate && $dueDate < now()) Overdue @else Paid @endif @else Pending @endif Mark Paid
No rent gyms found.
@endsection @push('scripts') @endpush