📊 Comparison Results
{{-- Score Headers --}}
@foreach([$plot1, $plot2] as $pi => $p)
@php $res = $p['result']; @endphp
@if($p['error'])
⚠ {{ $p['error'] }}
@else
{{ $res['feasibility_score'] ?? '—' }}
Feasibility Score
{{ $res['address'] ?? 'Plot '.($pi+1) }}
@endif
@endforeach
@if(!$plot1['error'] && !$plot2['error'])
@php
$r1 = $plot1['result'];
$r2 = $plot2['result'];
$c1 = $r1['cost_estimates'] ?? [];
$c2 = $r2['cost_estimates'] ?? [];
$rows = [
['— PLOT DETAILS —', null, null, null],
compRow('Plot Area (sqm)', number_format($r1['plot_area_sqm'] ?? 0), number_format($r2['plot_area_sqm'] ?? 0)),
compRow('Road Width (m)', $r1['road_width_m'] ?? '—', $r2['road_width_m'] ?? '—'),
['— DEVELOPMENT POTENTIAL —', null, null, null],
compRow('FAR / FSI', $r1['max_far'] ?? '—', $r2['max_far'] ?? '—'),
compRow('Max Buildable Area (sqm)', number_format($r1['max_buildable_area_sqm'] ?? 0), number_format($r2['max_buildable_area_sqm'] ?? 0)),
compRow('Max Floors', $r1['max_floors'] ?? '—', $r2['max_floors'] ?? '—'),
compRow('Max Height (m)', $r1['max_height_m'] ?? '—', $r2['max_height_m'] ?? '—'),
compRow('Ground Coverage (sqm)', number_format($r1['ground_coverage_sqm'] ?? 0), number_format($r2['ground_coverage_sqm'] ?? 0)),
compRow('Parking Required (ECS)', $r1['parking_required_ecs'] ?? '—', $r2['parking_required_ecs'] ?? '—', false),
['— SETBACKS (m) —', null, null, null],
['Front Setback', ($r1['front_setback_m'] ?? '—').'m', ($r2['front_setback_m'] ?? '—').'m', null],
['Side Setback', ($r1['side_setback_m'] ?? '—').'m', ($r2['side_setback_m'] ?? '—').'m', null],
['Rear Setback', ($r1['rear_setback_m'] ?? '—').'m', ($r2['rear_setback_m'] ?? '—').'m', null],
['— COST & ROI ESTIMATES —', null, null, null],
compRow('Construction Cost (min)', !empty($c1) ? '₹'.number_format($c1['construction_cost_min_inr']) : '—', !empty($c2) ? '₹'.number_format($c2['construction_cost_min_inr']) : '—', false),
compRow('Construction Cost (max)', !empty($c1) ? '₹'.number_format($c1['construction_cost_max_inr']) : '—', !empty($c2) ? '₹'.number_format($c2['construction_cost_max_inr']) : '—', false),
compRow('Gross Dev. Value', !empty($c1) ? '₹'.number_format($c1['gross_development_value_inr']) : '—', !empty($c2) ? '₹'.number_format($c2['gross_development_value_inr']) : '—'),
compRow('Est. Profit', !empty($c1) ? '₹'.number_format($c1['estimated_profit_inr']) : '—', !empty($c2) ? '₹'.number_format($c2['estimated_profit_inr']) : '—'),
compRow('ROI %', !empty($c1) ? $c1['roi_pct'].'%' : '—', !empty($c2) ? $c2['roi_pct'].'%' : '—'),
compRow('Monthly Rent Est.', !empty($c1) ? '₹'.number_format($c1['monthly_rent_estimate_inr']) : '—', !empty($c2) ? '₹'.number_format($c2['monthly_rent_estimate_inr']) : '—'),
compRow('Break-even (yrs)', !empty($c1) ? ($c1['breakeven_years'] ?? '—') : '—', !empty($c2) ? ($c2['breakeven_years'] ?? '—') : '—', false),
['— ZONE INFO —', null, null, null],
['Zone Name', $r1['zone_name'] ?? '—', $r2['zone_name'] ?? '—', null],
['Zone Type', $r1['zone_type'] ?? '—', $r2['zone_type'] ?? '—', null],
['Project Type', ucfirst($r1['project_type'] ?? '—'), ucfirst($r2['project_type'] ?? '—'), null],
['Regulation', $r1['rule_source'] ?? '—', $r2['rule_source'] ?? '—', null],
];
@endphp
@foreach($rows as [$label, $val1, $val2, $winner])
@if($val1 === null)
{{-- Section header --}}
@else
{{ $label }}
@foreach([[$val1, $winner === 1], [$val2, $winner === 2]] as [$val, $isWinner])
{{ $val }}
@if($isWinner)Better@endif
@endforeach
@endif
@endforeach
{{-- Winner summary --}}
@php
$s1 = $r1['feasibility_score'] ?? 0;
$s2 = $r2['feasibility_score'] ?? 0;
$winnerIdx = $s1 > $s2 ? 1 : ($s2 > $s1 ? 2 : 0);
@endphp
@if($winnerIdx > 0)
🏆 Plot {{ $winnerIdx }} is the better opportunity
Score: {{ $winnerIdx === 1 ? $s1 : $s2 }} vs {{ $winnerIdx === 1 ? $s2 : $s1 }}
@if(!empty($c1) && !empty($c2))
| ROI: {{ $winnerIdx === 1 ? ($c1['roi_pct'] ?? '—') : ($c2['roi_pct'] ?? '—') }}%
vs {{ $winnerIdx === 1 ? ($c2['roi_pct'] ?? '—') : ($c1['roi_pct'] ?? '—') }}%
@endif
@endif
@endif {{-- no errors --}}