@php use App\Services\AreaLookupService; $states = config('us_states', []); $currentState = strtoupper(trim($currentState ?? request('state', ''))); if ($currentState !== '' && !array_key_exists($currentState, $states)) { $currentState = ''; } $currentCounty = trim($currentCounty ?? request('ddlCountiesByState', '')); $stateSelectId = $stateSelectId ?? 'ddNationwide'; $countySelectId = $countySelectId ?? 'ddlCountiesByState'; $reloadOnStateChange = $reloadOnStateChange ?? false; $reloadOnLocationChange = $reloadOnLocationChange ?? false; $syncFormLookups = $syncFormLookups ?? false; $lookupsPreloaded = $lookupsPreloaded ?? false; $lookupsLoadedKey = ($lookupsPreloaded && $currentState !== '' && $currentCounty !== '') ? $currentState . '|' . $currentCounty : ''; $counties = $counties ?? []; if ($currentState !== '' && empty($counties)) { try { $counties = app(AreaLookupService::class)->getCountiesByState($currentState); } catch (\Throwable $e) { $counties = []; } } $normalizeCountyLabel = static function (string $name): string { $name = trim($name); $name = preg_replace('/\s+planning region$/i', '', $name) ?? $name; $name = preg_replace('/\s+county$/i', '', $name) ?? $name; return strtolower(trim($name)); }; $countyIsSelected = static function (string $countyName) use ($currentCounty, $normalizeCountyLabel): bool { if ($currentCounty === '') { return false; } $selectedKey = $normalizeCountyLabel($currentCounty); $optionKey = $normalizeCountyLabel($countyName); return $selectedKey === $optionKey || str_contains($optionKey, $selectedKey) || str_contains($selectedKey, $optionKey); }; $currentCountyInList = false; if ($currentCounty !== '' && !empty($counties)) { foreach ($counties as $countyName) { if ($countyIsSelected($countyName)) { $currentCountyInList = true; break; } } } // Use the incoming request root so AJAX URLs work when the app lives in a subdirectory // (e.g. /attomapidata.com/AttomApi/public) even if APP_URL in .env is wrong. $appRoot = rtrim(request()->root(), '/'); $locationSelectsPath = public_path('js/location-selects.js'); $locationSelectsVersion = is_file($locationSelectsPath) ? (string) filemtime($locationSelectsPath) : (string) time(); @endphp
@if(!empty($newSearchLink)) New Search @endif