Comparables Search

Loading Comparables...
Search Comparables
Show Search Form
@csrf
Location
mile(s) or Draw on Map
@php // Extract School District - same logic as property-detail.blade.php $schoolDistrict = null; if ($property) { $area = $property['area'] ?? []; // Try area.schoolDistrict first (most reliable source) $schoolDistrict = $property['area']['schoolDistrict'] ?? $area['schoolDistrict'] ?? $property['_IDENTIFICATION']['@SchoolDistrict_ext'] ?? $property['identification']['@SchoolDistrict_ext'] ?? $property['_identification']['@SchoolDistrict_ext'] ?? $property['_IDENTIFICATION']['@SchoolDistrict'] ?? $property['identification']['@SchoolDistrict'] ?? $property['_identification']['@SchoolDistrict'] ?? null; // Try to extract from geoIdV4.SB if (empty($schoolDistrict) && isset($property['location']['geoIdV4']['SB'])) { $sbCodes = $property['location']['geoIdV4']['SB']; // If it's a string with multiple codes, take the first one or format it if (is_string($sbCodes)) { $sbArray = explode(', ', $sbCodes); $schoolDistrict = !empty($sbArray[0]) ? $sbArray[0] : $sbCodes; } else { $schoolDistrict = $sbCodes; } } // Fallback to other locations if (empty($schoolDistrict)) { $address = $property['address'] ?? []; $schoolDistrict = $property['address']['schoolDistrict'] ?? $address['schoolDistrict'] ?? null; } // Format School District - if it's a hash code or doesn't contain "DENVER COUNTY", set to "DENVER COUNTY 1" if (!empty($schoolDistrict) && $schoolDistrict !== 'N/A') { $schoolDistrictUpper = strtoupper(trim($schoolDistrict)); // If it's a hash code (long alphanumeric string), replace with "DENVER COUNTY 1" if (strlen($schoolDistrictUpper) > 20 || preg_match('/^[A-F0-9]{20,}$/', $schoolDistrictUpper)) { $schoolDistrict = 'DENVER COUNTY 1'; } elseif (strpos($schoolDistrictUpper, 'DENVER') !== false && strpos($schoolDistrictUpper, 'COUNTY') === false) { $schoolDistrict = 'DENVER COUNTY 1'; } elseif (strpos($schoolDistrictUpper, 'DENVER') === false && strpos($schoolDistrictUpper, 'COUNTY') === false) { // If it doesn't contain "DENVER" or "COUNTY", set to default $schoolDistrict = 'DENVER COUNTY 1'; } else { // Format like city (uppercase) $schoolDistrict = $schoolDistrictUpper; } } else { $schoolDistrict = 'DENVER COUNTY 1'; } } // Use pre-extracted values from controller, with fallback extraction $streetName = $formStreetName ?? ''; $zipCode = $formZipCode ?? ''; $city = $formCity ?? ''; // If controller didn't extract, try extraction here if (empty($streetName) && $property && !empty($property)) { $line1 = ''; // Try MAILING_ADDRESS_ext first (from Elasticsearch structure) if (isset($property['MAILING_ADDRESS_ext']) && is_array($property['MAILING_ADDRESS_ext'])) { $line1 = $property['MAILING_ADDRESS_ext']['@_StreetAddress'] ?? $property['MAILING_ADDRESS_ext']['_StreetAddress'] ?? ''; } // Try address object if (empty($line1) && isset($property['address']) && is_array($property['address'])) { $line1 = $property['address']['@_StreetAddress'] ?? $property['address']['_StreetAddress'] ?? $property['address']['line1'] ?? $property['address']['line'] ?? ''; } // Try top level if (empty($line1)) { $line1 = $property['@_StreetAddress'] ?? $property['_StreetAddress'] ?? ''; } if (empty($line1) && isset($property['address'])) { $line1 = $property['address']['streetAddress'] ?? $property['address']['street'] ?? $property['address']['addressLine1'] ?? ''; } if (!empty($line1)) { $parts = explode(' ', trim($line1)); if (count($parts) > 1) { array_shift($parts); $streetName = implode(' ', $parts); } else { $streetName = $line1; } } } if (empty($zipCode) && $property && !empty($property)) { // Try MAILING_ADDRESS_ext first (from Elasticsearch structure) if (isset($property['MAILING_ADDRESS_ext']) && is_array($property['MAILING_ADDRESS_ext'])) { $zipCode = $property['MAILING_ADDRESS_ext']['@_PostalCode'] ?? $property['MAILING_ADDRESS_ext']['_PostalCode'] ?? ''; } // Try address object if (empty($zipCode)) { $address = $property['address'] ?? []; $location = $property['location'] ?? []; $fullAddress = $address['oneLine'] ?? trim(($address['line1'] ?? '') . ' ' . ($address['locality'] ?? '') . ' ' . ($address['countrySubd'] ?? '') . ' ' . ($address['postal1'] ?? '')); $zipCode = $property['address']['@_PostalCode'] ?? $property['address']['_PostalCode'] ?? $property['address']['postal1'] ?? $property['address']['postalCode'] ?? $property['address']['zip'] ?? $property['address']['zipCode'] ?? $property['@_PostalCode'] ?? $property['_PostalCode'] ?? $address['@_PostalCode'] ?? $address['_PostalCode'] ?? $address['postal1'] ?? $address['postalCode'] ?? $address['zip'] ?? $address['zipCode'] ?? $location['@_PostalCode'] ?? $location['_PostalCode'] ?? $location['postal1'] ?? $location['postalCode'] ?? $location['zip'] ?? $location['zipCode'] ?? null; if (empty($zipCode)) { $zipCode = $property['address']['postal'] ?? $property['postal'] ?? $address['postal'] ?? null; } if (empty($zipCode) || $zipCode === 'N/A') { if (!empty($fullAddress) && preg_match('/\b(\d{5}(-\d{4})?)\b/', $fullAddress, $matches)) { $zipCode = $matches[1]; } } } if (!empty($zipCode) && $zipCode !== 'N/A') { $zipCode = preg_replace('/[^\d-]/', '', $zipCode); if (strlen($zipCode) > 5) { $zipCode = substr($zipCode, 0, 5); } } } if (empty($city) && $property && !empty($property)) { // Try MAILING_ADDRESS_ext first (from Elasticsearch structure) if (isset($property['MAILING_ADDRESS_ext']) && is_array($property['MAILING_ADDRESS_ext'])) { $city = $property['MAILING_ADDRESS_ext']['@_City'] ?? $property['MAILING_ADDRESS_ext']['_City'] ?? ''; } // Try address object if (empty($city) && isset($property['address']) && is_array($property['address'])) { $city = $property['address']['@_City'] ?? $property['address']['_City'] ?? $property['address']['locality'] ?? $property['address']['city'] ?? ''; } // Try top level if (empty($city)) { $city = $property['@_City'] ?? $property['_City'] ?? ''; } if (empty($city) && isset($property['address'])) { $city = $property['address']['cityName'] ?? $property['address']['municipality'] ?? $property['city'] ?? ''; } } // Ensure school district always has a value if (empty($schoolDistrict)) { $schoolDistrict = 'DENVER COUNTY 1'; } // Ensure zip code is displayed if available if (empty($zipCode) || $zipCode === 'N/A') { $zipCode = ''; } @endphp
Date & Price
or
To
Attributes
@php $classificationOptions = [ ['value' => '385', 'label' => 'Single Family Residence'], ['value' => '380', 'label' => 'Single Family: Residential (General/Single)'], ['value' => '383', 'label' => 'Single Family: Rural Residence'], ['value' => 'All Vacant', 'label' => 'All Vacant'], ['value' => '389', 'label' => 'Vacant Land'], ['value' => '392', 'label' => 'Vacant: Agricultural (Unimproved)'], ['value' => '102', 'label' => 'Vacant: Desert Or Barren Land'], ['value' => '394', 'label' => 'Vacant: Government'], ['value' => '395', 'label' => 'Vacant: Industrial'], ['value' => '398', 'label' => 'Vacant: Multi-family'], ['value' => '401', 'label' => 'Vacant: Residential'], ['value' => '393', 'label' => 'Vacant: Vacant Commercial'], ['value' => '404', 'label' => 'Vacant: Waste Land. Marsh. Swamp. Submerged'], ['value' => '406', 'label' => 'Vacant: Water Area (Lakes. River. Shore)'], ['value' => '256', 'label' => 'Vacant: Water Rights (Misc)'], ['value' => 'All Multi Family', 'label' => 'All Multi Family'], ['value' => '359', 'label' => 'Multi Family: Apartment House (100+ Units)'], ['value' => '361', 'label' => 'Multi Family: Apartment House (5+ Units)'], ['value' => '360', 'label' => 'Multi Family: Apartments (generic)'], ['value' => '418', 'label' => 'Multi Family: Condominium'], ['value' => '367', 'label' => 'Multi Family: Cooperative'], ['value' => '369', 'label' => 'Multi Family: Duplex (2 Units. Any Combination)'], ['value' => '372', 'label' => 'Multi Family: Dwellings (Generic. Any Combination)'], ['value' => '421', 'label' => 'Multi Family: High Rise Condo'], ['value' => '358', 'label' => 'Multi Family: High-rise Apartments'], ['value' => '378', 'label' => 'Multi Family: Quadplex (4 Units. Any Combination)'], ['value' => '381', 'label' => 'Multi Family: Residential Income (General/Multi-Family)'], ['value' => '386', 'label' => 'Multi Family: Townhouse'], ['value' => '388', 'label' => 'Multi Family: Triplex (3 Units. Any Combination)'], ]; $selectedClassifications = isset($searchParams['ddNJSalCls']) && is_array($searchParams['ddNJSalCls']) ? $searchParams['ddNJSalCls'] : (isset($searchParams['ddNJSalCls']) ? [$searchParams['ddNJSalCls']] : ['385']); @endphp @foreach($classificationOptions as $option)
@endforeach
To
To
@php $styleOptions = [ ['value' => '10', 'label' => 'A-Frame'], ['value' => '59', 'label' => 'Antique'], ['value' => '13', 'label' => 'Bungalow'], ['value' => '38', 'label' => 'Cabin'], ['value' => '14', 'label' => 'Cape Cod'], ['value' => '85', 'label' => 'Chalet'], ['value' => '7', 'label' => 'Colonial'], ['value' => '69', 'label' => 'Condo/Apartment'], ['value' => '8', 'label' => 'Contemporary'], ['value' => '1', 'label' => 'Conventional'], ['value' => '45', 'label' => 'Cottage'], ['value' => '78', 'label' => 'Cottage House'], ['value' => '86', 'label' => 'Custom Design'], ['value' => '30', 'label' => 'Dome'], ['value' => '31', 'label' => 'Duplex Single'], ['value' => '5', 'label' => 'English'], ['value' => '60', 'label' => 'European'], ['value' => '87', 'label' => 'Farm House'], ['value' => '77', 'label' => 'Federalist'], ['value' => '6', 'label' => 'French'], ['value' => '57', 'label' => 'Gambrel'], ['value' => '88', 'label' => 'Garage Apartment'], ['value' => '51', 'label' => 'Garrison'], ['value' => '68', 'label' => 'High Rise'], ['value' => '66', 'label' => 'Low Rise'], ['value' => '37', 'label' => 'Mansion'], ['value' => '90', 'label' => 'Mediterranean'], ['value' => '67', 'label' => 'Mid Rise'], ['value' => '19', 'label' => 'Mobile Home'], ['value' => '2', 'label' => 'Modern'], ['value' => '82', 'label' => 'Modular'], ['value' => '56', 'label' => 'Old Style'], ['value' => '12', 'label' => 'Other'], ['value' => '34', 'label' => 'Quadraplex'], ['value' => '27', 'label' => 'Rambler'], ['value' => '11', 'label' => 'Ranch'], ['value' => '53', 'label' => 'Row End or Row Middle'], ['value' => '83', 'label' => 'Salt Box'], ['value' => '4', 'label' => 'Spanish'], ['value' => '16', 'label' => 'Split Entry'], ['value' => '17', 'label' => 'Split Level'], ['value' => '89', 'label' => 'TLog Home'], ['value' => '36', 'label' => 'Townhouse'], ['value' => '50', 'label' => 'Traditional'], ['value' => '33', 'label' => 'Triplex'], ['value' => '52', 'label' => 'Tudor'], ['value' => '76', 'label' => 'Two Family'], ['value' => '18', 'label' => 'Victorian'], ]; $selectedStyles = isset($searchParams['ddCmaStyle']) && is_array($searchParams['ddCmaStyle']) ? $searchParams['ddCmaStyle'] : (isset($searchParams['ddCmaStyle']) ? [$searchParams['ddCmaStyle']] : []); @endphp @foreach($styleOptions as $option)
@endforeach
To
To
To

Note: Square Footage, Year Built, and Style may not be available in certain areas.

@php $comparablesCount = isset($comparables) && is_array($comparables) ? count($comparables) : 0; // Show results section if comparables exist OR if a search was performed (even if no results) $searchPerformed = request()->isMethod('POST') || (request()->isMethod('GET') && request()->has('search')); $shouldShowResults = $comparablesCount > 0 || $searchPerformed; @endphp @if($shouldShowResults) @if(isset($comparables) && is_array($comparables) && $comparablesCount > 0)

Comparables Results

Showing {{ $comparablesCount }} Comparables

Map View

Note: Sales highlighted in yellow are Potential Flips; green are Potential Distressed Sales.

@foreach($comparables as $index => $comp) @php $saleDate = $comp['saleDate'] ?? $comp['sale_date'] ?? ''; if ($saleDate) { try { $date = new DateTime($saleDate); $saleDate = $date->format('m/d/Y'); } catch (Exception $e) { // Keep original format if parsing fails } } $distance = $comp['distance'] ?? 0; $distanceFormatted = number_format($distance, 2); $sqft = $comp['sqft'] ?? $comp['squareFeet'] ?? $comp['square_feet'] ?? 0; $price = $comp['price'] ?? $comp['salePrice'] ?? $comp['sale_price'] ?? 0; $pricePerSqft = $comp['pricePerSqft'] ?? $comp['price_per_sqft'] ?? ($sqft > 0 && $price > 0 ? round($price / $sqft) : 0); // Try multiple fields to get propertyId/attomId $propertyId = $comp['propertyId'] ?? $comp['property_id'] ?? $comp['attomId'] ?? $comp['identifier']['attomId'] ?? $comp['identifier']['Id'] ?? $comp['_id'] ?? ''; $address = $comp['address'] ?? $comp['fullAddress'] ?? 'N/A'; $subdivision = $comp['subdivision'] ?? $comp['subdname'] ?? ''; // Use classStyle from controller (already built from @StandardUseDescription_ext or combined propertyClass + style) $classStyle = $comp['classStyle'] ?? $comp['class_style'] ?? ''; // Fallback: if classStyle not available, build from propertyClass and style if (empty($classStyle)) { $propertyClass = $comp['propertyClass'] ?? $comp['property_class'] ?? $comp['class'] ?? ''; $style = $comp['style'] ?? $comp['archStyle'] ?? ''; if ($propertyClass && $style) { $classStyle = $propertyClass . ', ' . $style; } elseif ($propertyClass) { $classStyle = $propertyClass; } elseif ($style) { $classStyle = $style; } } // Extract School District - format it properly $schoolDistrict = $comp['schoolDistrict'] ?? $comp['school_district'] ?? $comp['munname'] ?? ''; // Format School District - if it's a hash code or doesn't contain "DENVER COUNTY", set to "DENVER COUNTY 1" if (!empty($schoolDistrict)) { $schoolDistrictUpper = strtoupper(trim($schoolDistrict)); // If it's a hash code (long alphanumeric string), replace with "DENVER COUNTY 1" if (strlen($schoolDistrictUpper) > 20 || preg_match('/^[A-F0-9]{20,}$/', $schoolDistrictUpper)) { $schoolDistrict = 'DENVER COUNTY 1'; } elseif (strpos($schoolDistrictUpper, 'DENVER') !== false && strpos($schoolDistrictUpper, 'COUNTY') === false) { $schoolDistrict = 'DENVER COUNTY 1'; } elseif (strpos($schoolDistrictUpper, 'DENVER') === false && strpos($schoolDistrictUpper, 'COUNTY') === false) { // If it doesn't contain "DENVER" or "COUNTY", set to default $schoolDistrict = 'DENVER COUNTY 1'; } else { // Capitalize properly: "Denver County 1" $schoolDistrict = ucwords(strtolower($schoolDistrict)); } } else { $schoolDistrict = 'DENVER COUNTY 1'; } $yearBuilt = $comp['yearBuilt'] ?? $comp['year_built'] ?? $comp['built'] ?? ''; $lot = $comp['lot'] ?? $comp['lotSize'] ?? $comp['lot_size'] ?? ''; $rooms = $comp['rooms'] ?? $comp['totalRooms'] ?? $comp['total_rooms'] ?? ''; $beds = $comp['beds'] ?? $comp['bedrooms'] ?? ''; $baths = $comp['baths'] ?? $comp['bathrooms'] ?? $comp['bathstotal'] ?? ''; $garage = $comp['garage'] ?? $comp['garageType'] ?? $comp['garage_type'] ?? ''; $buyer = $comp['buyer'] ?? $comp['buyerName'] ?? ''; $seller = $comp['seller'] ?? $comp['sellerName'] ?? ''; $parties = ''; if ($buyer || $seller) { $parties = ($buyer ? 'B: ' . $buyer : '') . ($buyer && $seller ? ', S: ' : ($seller ? 'S: ' : '')) . ($seller ?? ''); } // Check for potential flip or distressed sale $isPotentialFlip = $comp['isPotentialFlip'] ?? false; $isDistressed = $comp['isDistressed'] ?? false; $rowStyle = ''; if ($isPotentialFlip) { $rowStyle = 'background-color: #fef3c7;'; } elseif ($isDistressed) { $rowStyle = 'background-color: #d1fae5;'; } // Build address string for row data attribute (with comma format) $addressLine = $comp['address'] ?? $comp['fullAddress'] ?? $comp['line1'] ?? ''; $stateForAddress = $comp['state'] ?? $comp['countrySubd'] ?? ''; if ($addressLine && isset($comp['locality'])) { $addressLine .= ', ' . $comp['locality']; } elseif ($addressLine && isset($comp['city'])) { $addressLine .= ', ' . $comp['city']; } if ($addressLine && $stateForAddress) { $addressLine .= ', ' . $stateForAddress; } if ($addressLine && isset($comp['postal1'])) { $addressLine .= ' ' . $comp['postal1']; } elseif ($addressLine && isset($comp['zip'])) { $addressLine .= ' ' . $comp['zip']; } @endphp @php $isSubjectRow = $comp['isSubject'] ?? false; $subjectRowStyle = $isSubjectRow ? 'background-color: #e0f2fe;' : ''; @endphp @endforeach
# Photo Dist Address Subdivision Class/Style School District Sqft Built Lot Rms Beds Bths Garage Price PPSFT Sale Date Parties
@php $isSubject = $comp['isSubject'] ?? false; // Count non-subject comparables before this one for numbering $comparableNumber = 0; if (!$isSubject) { // Count how many non-subject comparables are before this one foreach ($comparables as $i => $c) { if ($i < $index && !($c['isSubject'] ?? false)) { $comparableNumber++; } } $comparableNumber++; // This is the next comparable number } @endphp @if($isSubject) S @else {{ $comparableNumber }} @endif
@php // Get location data (needed for both image URL and display) $county = $comp['county'] ?? $comp['countyName'] ?? $comp['munname'] ?? ''; $state = $comp['state'] ?? $comp['countrySubd'] ?? ''; // Get coordinates $lat = $comp['latitude'] ?? $comp['lat'] ?? $comp['location']['latitude'] ?? $comp['location']['lat'] ?? null; $lng = $comp['longitude'] ?? $comp['lng'] ?? $comp['lon'] ?? $comp['location']['longitude'] ?? $comp['location']['lon'] ?? null; // Build address string for image URL (with comma format) $addressLine = $comp['address'] ?? $comp['fullAddress'] ?? $comp['line1'] ?? ''; if ($addressLine && isset($comp['locality'])) { $addressLine .= ', ' . $comp['locality']; } elseif ($addressLine && isset($comp['city'])) { $addressLine .= ', ' . $comp['city']; } if ($addressLine && $state) { $addressLine .= ', ' . $state; } if ($addressLine && isset($comp['postal1'])) { $addressLine .= ' ' . $comp['postal1']; } elseif ($addressLine && isset($comp['zip'])) { $addressLine .= ' ' . $comp['zip']; } $addressEncoded = urlencode($addressLine); // Build formatted address for display (separate lines) $displayAddressLine1 = $comp['address'] ?? $comp['fullAddress'] ?? $comp['line1'] ?? 'N/A'; $displayAddressLine2 = ''; if (isset($comp['locality']) || isset($comp['city'])) { $city = $comp['locality'] ?? $comp['city'] ?? ''; $stateDisplay = $comp['state'] ?? $comp['countrySubd'] ?? ''; $zip = $comp['postal1'] ?? $comp['zip'] ?? ''; $displayAddressLine2 = trim($city . ' ' . $stateDisplay . ' ' . $zip); } $displayAddressLine3 = $comp['subdivision'] ?? $comp['subdname'] ?? $comp['area']['subdname'] ?? ''; @endphp @if($propertyId) @php // Build Property Image URL using ATTOM Property Navigator API (similar to subject property) $imageUrl = 'https://via.placeholder.com/80x80?text=Property'; // Get imageId (ATTOM ID) $imageId = $propertyId; // Format: CO-Denver (state-county) $countyState = ''; if ($state && $county) { $countyState = $state . '-' . $county; } elseif ($state) { $countyState = $state; } // Build ATTOM Property Navigator image URL if ($imageId) { $imageUrl = 'https://propertynavigator.attomdata.com/ShowImage.ashx?imageid=' . $imageId . '&Darkmode=false'; if ($countyState) { $imageUrl .= '&countty=' . urlencode($countyState); } if ($addressEncoded) { $imageUrl .= '&address=' . $addressEncoded; } if ($lat && $lng) { $imageUrl .= '&latitude=' . $lat . '&longitude=' . $lng; } $imageUrl .= '&width=80&height=80'; } @endphp @if($propertyId && $propertyId != '') @php $detailUrl = route('property.show', ['attomId' => $propertyId]); @endphp Property @elseif($addressLine && $addressLine != 'N/A') @php // Use address as-is (it should already be in full format from controller) $fullAddressForSearch = $addressLine; $addressSearchUrl = route('property.by.address') . '?address=' . urlencode($fullAddressForSearch); @endphp Property @else Property @endif @else
No Image
@endif
{{ $distanceFormatted }} @if($propertyId && $propertyId != '') @php $detailUrl = route('property.show', ['attomId' => $propertyId]); @endphp {{ $displayAddressLine1 }}
@if($displayAddressLine2) {{ $displayAddressLine2 }}
@endif @if($displayAddressLine3) {{ $displayAddressLine3 }} @endif
@elseif($addressLine && $addressLine != 'N/A') @php $fullAddressForSearch = $addressLine; $addressSearchUrl = route('property.by.address') . '?address=' . urlencode($fullAddressForSearch); @endphp {{ $displayAddressLine1 }}
@if($displayAddressLine2) {{ $displayAddressLine2 }}
@endif @if($displayAddressLine3) {{ $displayAddressLine3 }} @endif
@else {{ $displayAddressLine1 }}
@if($displayAddressLine2) {{ $displayAddressLine2 }}
@endif @if($displayAddressLine3) {{ $displayAddressLine3 }} @endif
@endif
{{ $subdivision ?: '-' }} {{ $classStyle ?: '-' }} {{ $schoolDistrict ?: '-' }} {{ $sqft > 0 ? number_format($sqft, 0) : '-' }} {{ $yearBuilt ?: '-' }} {{ $lot ?: '-' }} {{ $rooms ?: '-' }} {{ $beds ?: '-' }} {{ $baths ?: '-' }} {{ $garage ?: '-' }} {{ $price > 0 ? '$' . number_format($price, 0) : '-' }} {{ $pricePerSqft > 0 ? '$' . number_format($pricePerSqft, 0) : '-' }} {{ $saleDate ?: '-' }} {{ $parties ?: '-' }}
@else

No Comparables Found

@if($request->isMethod('post') || $request->has('search')) No comparables were found matching your search criteria. Please try adjusting your search parameters. @else Please use the search form above to find comparables for this property. @endif

@endif @endif