@php
$rentRows = old('rent_details');
if ($rentRows === null) {
$rentRows = (isset($declaration) && $declaration->id && $declaration->rentDetails)
? $declaration->rentDetails->map(function ($r) {
return [
'from_date' => optional($r->from_date)->format('Y-m-d'),
'to_date' => optional($r->to_date)->format('Y-m-d'),
'rent_per_month' => $r->rent_per_month,
'is_metro' => $r->is_metro ? 1 : 0,
'address' => $r->address,
'landlord_name' => $r->landlord_name,
'landlord_address' => $r->landlord_address,
'landlord_pan' => $r->landlord_pan,
'landlord_aadhaar' => $r->landlord_aadhaar,
'landlord_relationship' => $r->landlord_relationship,
];
})->toArray()
: [];
}
@endphp
@forelse($rentRows as $i => $row)
@include('tdx.employee.declarations.partials.rent-row', ['i' => $i, 'row' => $row])
@empty
@include('tdx.employee.declarations.partials.rent-row', ['i' => 0, 'row' => []])
@endforelse
Annual rent for HRA exemption is computed from these rows (rent × months covered).