fix: correct property card template - use 'property' variable consistently

- Fixed undefined 'prop' variable error
- All references now use 'property' variable consistently
- Added slug to all hardcoded properties for navigation
- Fixed template literals for proper variable substitution
This commit is contained in:
TenerifeProp Dev
2026-04-05 19:45:24 +01:00
parent 5a599e24c6
commit c426dde185

View File

@@ -2370,6 +2370,7 @@ Deje sus criterios y le encontraremos la propiedad perfecta. Nuestro equipo anal
},
{
id: 4,
slug: 'terreno-vista-orotava',
type: 'agricultural',
badge: '',
title: { es: 'Terreno Rustico en La Orotava', ru: 'Сельский участок в Ла Оротаве' },
@@ -2387,6 +2388,7 @@ Deje sus criterios y le encontraremos la propiedad perfecta. Nuestro equipo anal
},
{
id: 5,
slug: 'apartamento-playa-las-americas',
type: 'apartment',
badge: 'exclusive',
title: { es: 'Apartamento en Puerto de la Cruz', ru: 'Апартаменты в Пуэрто де ла Крус' },
@@ -2407,6 +2409,7 @@ Deje sus criterios y le encontraremos la propiedad perfecta. Nuestro equipo anal
},
{
id: 6,
slug: 'villa-piscina-san-miguel',
type: 'ruins',
badge: 'new',
title: { es: 'Casa Ruina para Reconstruir', ru: 'Дом-руина для восстановления' },
@@ -2424,6 +2427,7 @@ Deje sus criterios y le encontraremos la propiedad perfecta. Nuestro equipo anal
},
{
id: 7,
slug: 'terreno-urbanizable-granadilla',
type: 'urban',
badge: '',
title: { es: 'Parcela Urbana en Granadilla', ru: 'Городской участок в Гранадилье' },
@@ -2441,6 +2445,7 @@ Deje sus criterios y le encontraremos la propiedad perfecta. Nuestro equipo anal
},
{
id: 8,
slug: 'chalet-santa-cruz',
type: 'house',
badge: 'exclusive',
title: { es: 'Chalet Independiente', ru: 'Отдельный шале' },
@@ -2461,6 +2466,7 @@ Deje sus criterios y le encontraremos la propiedad perfecta. Nuestro equipo anal
},
{
id: 9,
slug: 'finca-platanos-canarios',
type: 'agricultural',
badge: '',
title: { es: 'Finca con Palmeras', ru: 'Финка с пальмами' },
@@ -2771,15 +2777,66 @@ Deje sus criterios y le encontraremos la propiedad perfecta. Nuestro equipo anal
const typeLabel = getTypeLabel(property.type);
const location = property.location[currentLang];
const title = property.title[currentLang];
const mainImage = property.image;
const priceFormatted = formatPrice(property.price);
const areaFormatted = property.area.toLocaleString();
const card = `
<div class="col-lg-4 col-md-6" data-aos="fade-up" data-aos-delay="${index * 100}">
<div class="property-card">
<div class="property-image">
<a href="/property/${prop.slug}" data-property-id="${prop.id}">
<img src="${mainImage}" alt="${prop.title}" loading="lazy">
</a>
</div>
<div class="property-card">
<div class="property-image">
<a href="/property/${property.slug || property.id}" data-property-id="${property.id}">
<img src="${mainImage}" alt="${title}" loading="lazy">
</a>
<div class="property-badges">
<span class="property-badge ${badgeClass}">${typeLabel}</span>
${property.badge === 'exclusive' ? '<span class="property-badge badge-exclusive">Exclusivo</span>' : ''}
</div>
<button class="property-favorite" onclick="toggleFavorite(${property.id})" title="Añadir a favoritos">
<i class="bi bi-heart"></i>
</button>
</div>
<div class="property-content">
<div class="property-type">${typeLabel}</div>
<a href="/property/${property.slug || property.id}" class="property-title">${title}</a>
<p class="property-location">
<i class="bi bi-geo-alt"></i>
${location}
</p>
<div class="property-features">
<div class="property-feature">
<i class="bi bi-rulers"></i>
<span>${areaFormatted} m²</span>
</div>
${property.rooms ? `
<div class="property-feature">
<i class="bi bi-door-open"></i>
<span>${property.rooms} ${currentLang === 'es' ? 'hab.' : 'комн.'}</span>
</div>
` : ''}
${property.bathrooms ? `
<div class="property-feature">
<i class="bi bi-droplet"></i>
<span>${property.bathrooms} ${currentLang === 'es' ? 'baños' : 'ванн'}</span>
</div>
` : ''}
</div>
<div class="property-utilities">
${getUtilityIcons(property)}
</div>
<div class="property-price">
${priceFormatted}
<span>${Math.round(property.price / property.area)} €/m²</span>
</div>
<div class="property-actions">
<a href="/property/${property.slug || property.id}" class="btn btn-primary-custom">
<i class="bi bi-eye me-2"></i>${currentLang === 'es' ? 'Ver' : 'Смотреть'}
</a>
<a href="https://wa.me/34600123456?text=${encodeURIComponent((currentLang === 'es' ? 'Hola, me interesa esta propiedad: ' : 'Здравствуйте, интересует объект: ') + title)}"
target="_blank" class="btn btn-whatsapp">
<i class="bi bi-whatsapp"></i>
</a>
</div>
</div>
</div>
</div>