@extends('portal.layout') @section('title', $scenario->title.' — Report #'.str_pad($report->id, 5, '0', STR_PAD_LEFT)) @section('content') @php $typeLabels = [ 'what_if' => 'What-If Analysis', 'optimizer' => 'Auto-Optimizer', 'tdr' => 'TDR Calculator', 'premium_fsi' => 'Premium FSI', 'amalgamation' => 'Amalgamation', ]; $typeBadgeColors = [ 'what_if' => '#60a5fa', 'optimizer' => '#22c55e', 'tdr' => '#f97316', 'premium_fsi' => '#eab308', 'amalgamation' => '#a78bfa', ]; $typeLabel = $typeLabels[$scenario->type] ?? $scenario->type; $badgeColor = $typeBadgeColors[$scenario->type] ?? 'var(--primary)'; $rec = $scenario->recommendation; @endphp
@include('portal.partials.report-sidebar')
{{-- Header --}}

{{ $scenario->title }}

{{ $typeLabel }}
{{ $report->address ?? 'Plot' }} — {{ $scenario->created_at->format('d M Y H:i') }}
← Back to Scenarios
{{-- Base Parameters --}} @if($scenario->base_params)
Base Parameters
@foreach($scenario->base_params as $key => $val)
{{ ucwords(str_replace('_', ' ', $key)) }}: {{ is_numeric($val) ? number_format($val) : $val }}
@endforeach
@endif {{-- Recommendation --}} @if($rec)
{{ ($rec['should_amalgamate'] ?? $rec['best_scenario'] ?? $rec['best_type'] ?? $rec['optimal_tdr_pct'] ?? $rec['optimal_extra_far'] ?? false) ? '✓ Recommendation' : '✗ Analysis Result' }}
@if(isset($rec['best_scenario']))
Best: {{ $rec['best_scenario'] }}
@endif @if(isset($rec['best_type']))
Best Type: {{ ucfirst($rec['best_type']) }}
@endif @if(isset($rec['optimal_tdr_pct']))
Optimal TDR: {{ $rec['optimal_tdr_pct'] }}% — Net Gain: ₹{{ number_format($rec['net_gain_inr'] ?? 0) }}
@endif @if(isset($rec['optimal_extra_far']))
Optimal Extra FSI: {{ $rec['optimal_extra_far'] }} — Net Gain: ₹{{ number_format($rec['net_gain_inr'] ?? 0) }}
@endif
{{ $rec['reason'] ?? '' }}
@endif {{-- Scenario Data Table --}} @if($scenario->scenarios && count($scenario->scenarios))
{{ $scenario->type === 'optimizer' ? 'Configuration Results' : 'Scenarios' }}
@if($scenario->type === 'what_if')
@foreach($scenario->scenarios as $sc) @endforeach
Scenario Buildable (sqm) Floors Score
{{ $sc['label'] ?? 'Scenario' }} {{ number_format($sc['result']['max_buildable_area_sqm'] ?? 0) }} {{ $sc['result']['max_floors'] ?? '—' }} {{ $sc['result']['feasibility_score'] ?? '—' }}
@elseif($scenario->type === 'optimizer')
@foreach($scenario->scenarios as $i => $cfg)
@if($i === 0)
Best
@endif
{{ $cfg['project_type'] ?? '' }}
Buildable: {{ number_format($cfg['max_buildable_sqm'] ?? 0) }} sqm
Floors: {{ $cfg['max_floors'] ?? '—' }}
Profit: ₹{{ number_format($cfg['profit_inr'] ?? 0) }}
ROI: {{ $cfg['roi_pct'] ?? 0 }}%
@if(!empty($cfg['unit_mix']))
@foreach($cfg['unit_mix'] as $u)
{{ $u['type'] }} {{ $u['count'] }} units
@endforeach
@endif
@endforeach
@elseif(in_array($scenario->type, ['tdr', 'premium_fsi']))
@foreach($scenario->scenarios as $tier) @endforeach
{{ $scenario->type === 'tdr' ? 'TDR %' : 'Extra FSI' }} New FAR Extra Area Cost Net Gain Viable
{{ $scenario->type === 'tdr' ? ($tier['tdr_pct'] ?? '').'%' : ($tier['extra_far'] ?? '') }} {{ $tier['new_far'] ?? '—' }} {{ number_format($tier['additional_area_sqm'] ?? 0) }} sqm ₹{{ number_format($tier[$scenario->type === 'tdr' ? 'tdr_cost_inr' : 'premium_cost_inr'] ?? 0) }} ₹{{ number_format($tier['net_gain_inr'] ?? 0) }} {{ ($tier['is_viable'] ?? false) ? '✅' : '❌' }}
@elseif($scenario->type === 'amalgamation')
@foreach($scenario->scenarios as $plot)
{{ $plot['label'] ?? 'Plot' }}
{{ number_format($plot['area_sqm'] ?? 0) }} sqm — Road: {{ $plot['road_width'] ?? '—' }}m
{{ number_format($plot['result']['max_buildable_area_sqm'] ?? 0) }} sqm
buildable
@endforeach
@endif
@endif {{-- Comparison Table --}} @if($scenario->comparison && count($scenario->comparison))
Comparison Summary
@if($scenario->type === 'amalgamation')
@php $comp = $scenario->comparison; @endphp
{{ number_format($comp['synergy_sqm'] ?? 0) }}
Synergy (sqm)
{{ $comp['synergy_pct'] ?? 0 }}%
Synergy %
₹{{ number_format($comp['profit_diff_inr'] ?? 0) }}
Profit Diff
{{ $comp['combined_floors'] ?? '—' }}
Combined Floors
@else
@php // Determine how many scenario columns exist from the first comparison row $firstRow = $scenario->comparison[0] ?? []; $scenarioColCount = 0; while (isset($firstRow['scenario_' . $scenarioColCount])) { $scenarioColCount++; } @endphp @for($s = 0; $s < $scenarioColCount; $s++) @endfor @foreach($scenario->comparison as $row) @for($j = 0; isset($row['scenario_' . $j]); $j++) @endfor @endforeach
Metric BaseScenario {{ $s + 1 }}
{{ ucwords(str_replace('_', ' ', $row['metric'] ?? '')) }} {{ is_numeric($row['base'] ?? null) ? number_format($row['base']) : ($row['base'] ?? '—') }}{{ is_numeric($row['scenario_'.$j]) ? number_format($row['scenario_'.$j]) : $row['scenario_'.$j] }}
@endif
@endif {{-- Actions --}}
← Run New Scenario View Report
{{-- .report-content --}}
{{-- .report-layout --}} @endsection