@props(['lead' => []])

Comps

@php // Decode JSON-encoded strings safely for edit form $comps = isset($lead['requirements'][0]['comps']) ? json_decode($lead['requirements'][0]['comps'], true) : []; $sellerPriceMin = isset($lead['requirements'][0]['seller_price_min']) ? json_decode($lead['requirements'][0]['seller_price_min'], true) : []; $sellerPriceMax = isset($lead['requirements'][0]['seller_price_max']) ? json_decode($lead['requirements'][0]['seller_price_max'], true) : []; $pricePerSqrFT = isset($lead['requirements'][0]['price_per_sqrFT']) ? json_decode($lead['requirements'][0]['price_per_sqrFT'], true) : []; $sellerCompsFile = isset($lead['requirements'][0]['seller_comps_file']) ? json_decode($lead['requirements'][0]['seller_comps_file'], true) : []; // Ensure values are arrays $comps = is_array($comps) ? $comps : []; $sellerPriceMin = is_array($sellerPriceMin) ? $sellerPriceMin : []; $sellerPriceMax = is_array($sellerPriceMax) ? $sellerPriceMax : []; $pricePerSqrFT = is_array($pricePerSqrFT) ? $pricePerSqrFT : []; $sellerCompsFile = is_array($sellerCompsFile) ? $sellerCompsFile : []; // If creating a new form, ensure there is at least one empty row if (empty($comps)) { $comps = [""]; $sellerPriceMin = [""]; $sellerPriceMax = [""]; $pricePerSqrFT = [""]; $sellerCompsFile = [""]; } @endphp @foreach($comps as $index => $comp)
$
$
@if(isset($sellerCompsFile[$index]) && $sellerCompsFile[$index]) View File @endif
@if($index === 0) @else
@endif
@endforeach