Estate & Letting Agents in Clifton-on-Yore, North Yorkshire

Find Estate Agents in Clifton-on-Yore, North Yorkshire

Search for agents

Enter a location above to find agents in your area.

initializeAllPremierCards() }); // Load detailed stats function function loadDetailedStats() { const button = document.getElementById('load-more-stats'); const statsContainer = document.getElementById('detailed-stats'); if (statsContainer.classList.contains('hidden')) { // Show loading state button.innerHTML = ` Loading... `; // Make AJAX call for detailed stats const location = 'Clifton-on-Yore, North Yorkshire'; const agentType = ''; fetch(`/api/agents/detailed-stats?location=${encodeURIComponent(location)}&type=${agentType}`) .then(response => response.json()) .then(data => { // Build detailed stats HTML let statsHtml = '
'; // Property types breakdown if (data.propertyTypes && Object.keys(data.propertyTypes).length > 0) { statsHtml += `
Property Types
`; for (const [type, count] of Object.entries(data.propertyTypes)) { const percentage = Math.round((count / data.totalProperties) * 100); statsHtml += `
${type}: ${count.toLocaleString()} (${percentage}%)
`; } statsHtml += '
'; } // Price ranges if (data.priceRanges) { statsHtml += `
Price Ranges
Avg Sale Price: £${data.priceRanges.avgSalePrice?.toLocaleString() || 'N/A'}
Avg Rent PCM: £${data.priceRanges.avgRentPrice?.toLocaleString() || 'N/A'}
`; } // Top performing agents if (data.topAgents && data.topAgents.length > 0) { statsHtml += `
Top Agents
`; data.topAgents.slice(0, 3).forEach(agent => { statsHtml += `
${agent.name}: ${agent.property_count} props
`; }); statsHtml += '
'; } statsHtml += '
'; // Show stats statsContainer.innerHTML = statsHtml; statsContainer.classList.remove('hidden'); // Update button button.innerHTML = ` Hide Insights `; }) .catch(error => { // If API fails, show some calculated stats from existing data const agents = []; let topAgents = []; agents.forEach(agent => { // Collect top agents if (agent.property_count > 0) { topAgents.push({ name: agent.name, property_count: agent.property_count }); } }); // Sort top agents topAgents.sort((a, b) => b.property_count - a.property_count); let statsHtml = '
'; // Show top agents if (topAgents.length > 0) { statsHtml += `
Top Performing Agents
`; topAgents.slice(0, 5).forEach(agent => { statsHtml += `
${agent.name}: ${agent.property_count} properties
`; }); statsHtml += '
'; } statsHtml += '
'; statsContainer.innerHTML = statsHtml; statsContainer.classList.remove('hidden'); button.innerHTML = ` Hide Insights `; }); } else { // Hide stats statsContainer.classList.add('hidden'); button.innerHTML = ` Load Detailed Insights `; } } // Open agent map function function openAgentMap(locationSlug) { // Use the floating view toggle button const mapBtn = document.getElementById('agent-view-map'); if (mapBtn) { mapBtn.click(); } else { // Fallback to old button const oldMapBtn = document.getElementById('view-map-btn'); if (oldMapBtn) { oldMapBtn.click(); } else { // Last resort - open map page window.location.href = `/agents/${locationSlug}/map`; } } }