@extends('portal.layout') @section('title', 'Survey Analysis Results') @section('content') @php $statusColors = ['pending'=>'#f59e0b','processing'=>'#3b82f6','completed'=>'#22c55e','failed'=>'#ef4444']; $r = $survey->ai_analysis_raw ?? []; $dims = $survey->dimensions_detected ?? []; @endphp
{{-- Header --}}
← Back to Analysis

Survey Analysis Results

{{ $survey->original_filename }} · {{ $survey->created_at->diffForHumans() }}
{{ ucfirst($survey->ai_status) }}
@if(session('success'))
{{ session('success') }}
@endif @if($survey->ai_status === 'failed')
Analysis Failed
{{ $survey->ai_error }}
@csrf
@endif @if($survey->ai_status === 'completed') {{-- Key metrics --}}
@php $metrics = [ ['Plot Area', $survey->extracted_area_sqm ? number_format($survey->extracted_area_sqm, 2).' sqm' : '—', '#3b82f6', 'maximize-2'], ['Dimensions', ($survey->plot_length_m && $survey->plot_width_m) ? $survey->plot_length_m.'m × '.$survey->plot_width_m.'m' : '—', '#8b5cf6', 'ruler'], ['Road Frontage', $survey->road_frontage_m ? $survey->road_frontage_m.'m' : '—', '#10b981', 'road'], ['Survey No.', $survey->survey_number ?? '—', '#f59e0b', 'hash'], ['Land Use', $survey->land_use_type ? ucfirst($survey->land_use_type) : '—', '#ec4899', 'tag'], ['Ownership', $survey->ownership_type ? ucfirst($survey->ownership_type) : '—', '#64748b', 'user'], ]; @endphp @foreach($metrics as [$label, $value, $color, $icon])
{{ $label }}
{{ $value }}
@endforeach
{{-- Location details --}} @if($survey->village_name || $survey->taluka_name || $survey->district_name)
Location Details from Survey
@if($survey->village_name)
Village:
{{ $survey->village_name }}
@endif @if($survey->taluka_name)
Taluka:
{{ $survey->taluka_name }}
@endif @if($survey->district_name)
District:
{{ $survey->district_name }}
@endif
@endif {{-- Boundary information --}} @if(!empty($r['north_boundary']) || !empty($r['south_boundary']))
Boundaries Extracted
@foreach(['north'=>'N','south'=>'S','east'=>'E','west'=>'W'] as $dir => $label) @if(!empty($r["{$dir}_boundary"]))
{{ $label }} {{ $r["{$dir}_boundary"] }}
@endif @endforeach
@endif {{-- Dimensions detected --}} @if(count($dims) > 0)
All Dimensions Detected
@foreach($dims as $dim) {{ ucfirst($dim['side'] ?? '') }}: {{ $dim['length_m'] ?? '?' }}m @if(!empty($dim['annotation'])) — {{ $dim['annotation'] }}@endif @endforeach
@endif {{-- Area confirmation --}}
@if($survey->area_confirmed) ✓ Area Confirmed @else Confirm Plot Area @endif

AI extracted {{ number_format($survey->extracted_area_sqm ?? 0, 2) }} sqm ({{ number_format(($survey->extracted_area_sqm ?? 0) / 0.8361, 2) }} sq yd). @if(!$survey->area_confirmed) Please verify and correct if needed before proceeding. @endif

@if(!$survey->area_confirmed)
@csrf sq metres
@else
{{ number_format($survey->confirmed_area_sqm ?? $survey->extracted_area_sqm, 2) }} sq metres confirmed
@endif
{{-- CTA --}}
@php $analyzeUrl = route('portal.analyze.form', ($survey->feasibility_report_id ? [] : [ 'plot_area' => round($survey->effective_area_sqm ?? 0), 'survey_id' => $survey->id, ])); @endphp Run Feasibility Analysis
@csrf
{{-- Bhulekh link --}} @if(!empty($survey->bhulekh_data['portal_url']))
Verify on official land records portal: {{ $survey->bhulekh_data['portal_url'] }}
@endif @endif {{-- ai_status === completed --}} {{-- AI confidence badge --}} @if(!empty($r['confidence']))
AI extraction confidence: {{ round($r['confidence'] * 100) }}% · Document type: {{ $r['document_type'] ?? 'Unknown' }}
@endif
@endsection