@extends('layouts.app') @section('title', 'Simulation Results') @section('content')
Back to {{ $cropPlan->name }}

What-If Comparison

{{ $cropPlan->crop }} in {{ $cropPlan->location }} — {{ count($scenarios) }} scenarios compared

{{-- Summary cards --}}
@foreach($scenarios as $scenario)
{{ $scenario['month_name'] }} @if($scenario['month'] === $cropPlan->planting_month) Current plan @endif
@if(isset($scenario['error']))
{{ $scenario['error'] }}
@else @php $sc = $scenario['feasibility']; $badgeClass = match($sc) { 'suitable' => 'badge-suitable', 'risky' => 'badge-risky', 'not_suitable' => 'badge-not-suitable', default => 'bg-secondary' }; $badgeText = match($sc) { 'suitable' => 'Suitable', 'risky' => 'Risky', 'not_suitable' => 'Not Suitable', default => 'Unknown' }; @endphp {{ $badgeText }}
Yield: {{ $scenario['yield'] }} t/ha
Profit est: ₹{{ number_format($scenario['estimated_profit']) }}
@endif
@endforeach
{{-- Full comparison table --}}

Full Comparison

@foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach @foreach($scenarios as $scenario) @endforeach
Metric {{ $scenario['month_name'] }} @if($scenario['month'] === $cropPlan->planting_month)
Current @endif
Verdict @if(isset($scenario['error'])) Error @else @php $sc = $scenario['feasibility']; $bc = match($sc) { 'suitable' => 'badge-suitable', 'risky' => 'badge-risky', 'not_suitable' => 'badge-not-suitable', default => 'bg-secondary' }; $bt = match($sc) { 'suitable' => 'Suitable', 'risky' => 'Risky', 'not_suitable' => 'Not Suitable', default => 'Unknown' }; @endphp {{ $bt }} @endif
Confidence {{ isset($scenario['confidence']) ? round($scenario['confidence'] * 100) . '%' : '—' }}
Expected yield {{ isset($scenario['yield']) ? $scenario['yield'] . ' t/ha' : '—' }}
Rainfall forecast {{ isset($scenario['rainfall']) ? $scenario['rainfall'] . ' mm' : '—' }}
Trend {{ $scenario['trend'] ?? '—' }}
Market price {{ isset($scenario['market_price']) ? '₹' . $scenario['market_price'] : '—' }}
Est. profit/ha @if(isset($scenario['estimated_profit'])) ₹{{ number_format($scenario['estimated_profit']) }} @else — @endif
Loss risk/ha @if(isset($scenario['estimated_loss'])) ₹{{ number_format($scenario['estimated_loss']) }} @else — @endif
Run Again Back to Plan
@endsection