@extends('member-new') @push('head-script') @endpush @push('content-header') @endpush @section('content')
@if(session('error')) @endif @if(session('status')) @endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@csrf @if(isset($declaration) && $declaration->id) @method('PUT') @endif @php $selectedRegime = old('regime', $profile->regime ?? 'old'); @endphp {{-- ===================== Two-column layout ===================== --}}
{{-- ---------- Left: declaration steps ---------- --}}
{{-- ---------- Accordion 1: Rent Details ---------- --}}

@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).
{{-- ---------- Accordion 2: Investment Declarations ---------- --}}

@php $existingDetails = []; if (isset($declaration) && $declaration->id && $declaration->details) { foreach ($declaration->details as $detail) { if ($detail->tax_section_head_id) { $existingDetails[$detail->tax_section_id]['heads'][$detail->tax_section_head_id] = $detail; } else { $existingDetails[$detail->tax_section_id] = $detail; } } } @endphp
@php $globalIndex = 0; $prevGroupKey = '__START__'; @endphp @foreach($taxSections as $section) @php $index = $globalIndex; $group = $section->sectionGroup; $groupKey = $group->id ?? 'ungrouped'; @endphp @if($groupKey !== $prevGroupKey) @php $prevGroupKey = $groupKey; // Skip the group header when the group is just a 1:1 wrapper // for a section (group code matches the section code). $groupCode = $group->code ?? null; $hideGroupHeader = $groupCode && strcasecmp(trim($groupCode), trim($section->section_code ?? '')) === 0; @endphp @unless($hideGroupHeader)
{{ $group->name ?? 'Other Deductions' }} @if(!empty($group->description)) ({{ $group->description }}) @endif @if(($group->group_limit ?? 0) > 0) Max Limit: ₹{{ number_format($group->group_limit, 0) }} @endif
@endunless @endif

@if($section->activeHeads->count() > 0) {{-- Section with heads — declared amount only --}}
@foreach($section->activeHeads as $hIdx => $head) @php $existingHead = $existingDetails[$section->id]['heads'][$head->id] ?? null; @endphp
{{ $head->name }} @if($head->description) ({{ $head->description }}) @endif @if($head->max_limit > 0) Max Limit: ₹{{ number_format($head->max_limit, 0) }} @endif
₹ max_limit > 0) data-head-max="{{ $head->max_limit }}" @endif data-section-index="{{ $index }}">
@endforeach
Section Total ₹ 0 @if($section->max_limit > 0) / ₹{{ number_format($section->max_limit, 0) }} @endif
@else {{-- Section without heads — declared amount only --}} @php $existingSection = isset($existingDetails[$section->id]) && !isset($existingDetails[$section->id]['heads']) ? $existingDetails[$section->id] : null; @endphp
Declared Amount @if($section->max_limit > 0) Max: ₹{{ number_format($section->max_limit, 0) }} @endif
₹
@endif
@php $globalIndex++; @endphp @endforeach
@if($taxSections->isEmpty())
No tax sections configured. Please contact your administrator.
@endif
{{-- ---------- Accordion 3: Monthly TDS Calculation ---------- --}}

This is an estimated computation only.
Description Old Regime New Regime
Projected Gross Salary 0 0
Less: Standard Deduction u/s 16 0 0
Gross Total Income 0 0
Less: HRA Exemption 0 —
Less: Deductions under Chapter VI-A 0 —
Total Taxable Income 0 0
Tax on Total Income 0 0
Add: Surcharge 0 0
Less: Rebate u/s 87A 0 0
Add: Health & Education Cess (4%) 0 0
Total Tax Liability 0 0
Less: Tax Deducted Till Date 0 0
Tax to be Deducted (Balance) 0 0
Remaining Months in FY
Monthly TDS (estimated) 0 0
{{-- /tdx-accordion --}}
{{-- /col-lg-8 --}} {{-- ---------- Right: Tax Regime ---------- --}}
{{-- /col-lg-4 --}}
{{-- /row --}}
{{-- Template for a new rent row (used by JS) --}}
@endsection @push('footer-script') @endpush