@extends('layouts.app') @section('title', 'Managed Rentals') @section('page-title', 'Managed Rentals') @section('content') {{-- Summary cards --}}
Total Rentals
{{ $totalCount }}
Active
{{ $activeCount }}
Expired
{{ $expiredCount }}
{{-- Colour-coding legend --}} @if($status === 'active')
Expiring within {{ $reminderDays }} days
Expiring within 60 days
More than 60 days remaining
@endif {{-- Filters --}}
@if($status === 'active' || $status === 'all')
@endif
Reset
{{-- Results --}}
@if($status === 'expired') Expired Rental Agreements @elseif($status === 'all') All Rental Agreements @else Active Rental Agreements @endif {{ $rentals->total() }}
@if($rentals->isEmpty())

No rental agreements found matching the selected filters.

@else
@include('partials._sort_th', ['column' => 'client_name', 'label' => 'Tenant', 'thClass' => 'ps-4']) @include('partials._sort_th', ['column' => 'agreement_end_date', 'label' => 'End Date']) @include('partials._sort_th', ['column' => 'monthly_rent', 'label' => 'Monthly Rent', 'thClass' => 'text-end']) @foreach($rentals as $rental) @php $lead = $rental->lead; $req = $lead ? $lead->requirement : null; $client = $req ? $req->client : null; $staff = ($lead && $lead->assignedTo) ? $lead->assignedTo : null; $daysLeft = null; if ($rental->agreement_end_date) { $daysLeft = (int) $today->diffInDays($rental->agreement_end_date, false); } $isExpired = $daysLeft !== null && $daysLeft < 0; $rowClass = ''; $daysColorClass = ''; $statusBadge = 'Active'; if ($isExpired) { $rowClass = ''; $statusBadge = 'Expired'; $daysColorClass = 'text-muted'; } elseif ($daysLeft !== null && $daysLeft <= $reminderDays) { $rowClass = 'table-danger'; $daysColorClass = 'text-danger fw-bold'; $statusBadge = 'Critical'; } elseif ($daysLeft !== null && $daysLeft <= 60) { $rowClass = 'table-warning'; $daysColorClass = 'text-warning fw-semibold'; $statusBadge = 'Expiring Soon'; } else { $daysColorClass = 'text-success'; } @endphp @endforeach
Property Owner Start DateDays Left Assigned Staff Collection Status Actions
@if($client) {{ $client->full_name }} @else {{ $rental->client_name ?: '—' }} @endif
@if($client && $rental->client_name && $rental->client_name !== $client->full_name)
{{ $rental->client_name }}
@endif
@if($rental->property) {{ $rental->property->title }} @if($rental->property->city)
{{ $rental->property->city }}
@endif @else — @endif
{{ $rental->owner_name ?: '—' }} {{ $rental->agreement_start_date ? $rental->agreement_start_date->format('d M Y') : '—' }} {{ $rental->agreement_end_date ? $rental->agreement_end_date->format('d M Y') : '—' }} {{ $rental->monthly_rent ? '₹ ' . number_format((float) $rental->monthly_rent, 0) : '—' }} @if($daysLeft !== null) {{ $isExpired ? abs($daysLeft) . 'd ago' : $daysLeft . 'd' }} @else — @endif {{ $staff ? $staff->name : '—' }} {{-- Collection Status: Not Managed until the Managed Rental module is built --}} Not Managed @if($lead) @endif @if($rental->document_path && $lead) @endif
@if($rentals->hasPages()) @endif @endif
@endsection