| Sr.No. | Farmer Code | Farmer Name | Farmer Type | Producer Group | Cotton Land | Country | State | District | Block | Village | Field Executive | @php // Normalize to lowercase for safe comparison $type = strtolower(trim($anomalyType)); // All datasets mapped by lowercase keys $dataMap = [ 'input cost' => $inputCostData ?? [], 'water use' => $waterUseData ?? [], 'profit' => $profitData ?? [], 'cotton picking vs estimated quantity' =>$cottonPickingVsEstimatedData ??[], ]; @endphp @if (!in_array($type, ['input cost', 'water use', 'profit','cotton picking vs estimated quantity'])){{ ucfirst($anomalyType) }} Anomaly | @else @php $sampleData = current($dataMap[$type] ?? []); $firstFarmer = !empty($sampleData) ? current($sampleData) : []; @endphp @if (!empty($firstFarmer) && isset($firstFarmer)) @foreach (array_keys($firstFarmer) as $col){{ $col }} | @endforeach @endif @endif|||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ $count }} | {{ $row->code ?? '-' }} | {{ $row->name ?? '-' }} | {{ $row->farmer_type ?? '-' }} | {{ $row->pgName ?? '-' }} {{ $row->pgCode ? ($row->pgCode) : '-' }} | {{ $row->cottonArea ?? '-' }} | {{ $row->country ?? '-' }} | {{ $row->state ?? '-' }} | {{ $row->district ?? '-' }} | {{ $row->block ?? '-' }} | {{ $row->village ?? '-' }} | {{ (!empty($aFE[$row->fe_sync])) ? $aFE[$row->fe_sync] : '-' }} | @php // Map again in lowercase for per-row lookup $dataMap = [ 'fertilizer' => $fertilizerData ?? [], 'pesticide' => $pesticideData ?? [], 'pest management' => $PesticideManagementData ?? [], 'input cost' => $inputCostData ?? [], 'water use' => $waterUseData ?? [], 'profit' => $profitData ?? [], 'cotton picking vs estimated quantity' =>$cottonPickingVsEstimatedData ??[], ]; $rowType = strtolower(trim($row->anomalyType ?? '')); @endphp @if (!empty($row->anomaly_data) && array_key_exists($rowType, $dataMap)) @php $aData = $dataMap[$rowType]; @endphp @if (array_key_exists($row->code, $aData)) @if (in_array($rowType, ['input cost', 'water use', 'profit','cotton picking vs estimated quantity'])) @foreach ($aData[$row->code][0] as $v){{ $v}} | @endforeach @else {{-- ✅ Show nested table for other anomalies --}}
|
@endif
@endif
@else
{{-- If no anomaly data --}}
@if (!in_array($type, ['input cost', 'water use', 'profit']))
- | @endif @endif
No data available
@endif