Spaces:
Running

DISSASTER commited on
Commit
012fef3
·
verified ·
1 Parent(s): 011fab4

Маркеры на карте должны быть размещены в соответствии с координатами - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +81 -81
index.html CHANGED
@@ -164,6 +164,19 @@
164
  position: relative;
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  .map-placeholder {
168
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
169
  display: flex;
@@ -491,10 +504,10 @@
491
  <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
492
  <!-- Property 1 -->
493
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
494
- data-city="Кишинёв" data-district="Буюканы" data-type="premium"
495
  data-price="450000" data-area="250" data-rooms="5" data-floors="2"
496
  data-year="2018" data-land="10" data-parking="2" data-address="ул. Мирча чел Бэтрын 15"
497
- data-full-address="Кишинёв, сектор Буюканы, ул. Мирча чел Бэтрын 15"
498
  data-description="Элитная вилла в престижном районе Буюканы. Просторные светлые помещения, высокие потолки, панорамные окна. Современная отделка премиальными материалами. Кухня-гостиная с выходом на террасу и в сад. Мастер-спальня с гардеробной и собственной ванной комнатой. Дополнительно: камин, система 'умный дом', видеонаблюдение, автономное отопление. Ухоженный сад с зоной отдыха и летней кухней.">
499
  <div class="relative">
500
  <img src="https://images.unsplash.com/photo-1564013799919-ab600027ffc6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Luxury House" class="w-full h-64 object-cover">
@@ -534,7 +547,7 @@
534
 
535
  <!-- Property 2 -->
536
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
537
- data-city="Кишинёв" data-district="Центр" data-type="Вторичка"
538
  data-price="220000" data-area="120" data-rooms="3" data-floors="7"
539
  data-year="2015" data-parking="1" data-address="ул. 31 Августа 78"
540
  data-full-address="Кишинёв, сектор Центр, ул. 31 Августа 78"
@@ -577,7 +590,8 @@
577
 
578
  <!-- Property 3 -->
579
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
580
- data-city="Кишинёв" data-district="Рышкановка" data-price="380000"
 
581
  data-area="180" data-rooms="4"
582
  data-full-address="Кишинёв, сектор Рышкановка, ул. Албишоара 42">
583
  <div class="relative">
@@ -618,7 +632,8 @@
618
 
619
  <!-- Property 4 -->
620
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
621
- data-city="Вадул-луй-Водэ" data-district="" data-price="320000"
 
622
  data-area="300" data-rooms="6" data-land="15"
623
  data-full-address="Вадул-луй-Водэ, ул. Кодрулор 15">
624
  <div class="relative">
@@ -659,7 +674,7 @@
659
 
660
  <!-- Property 5 -->
661
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
662
- data-full-address="Кишинёв, сектор Центр, ул. Пушкина 28, офис 5">
663
  <div class="relative">
664
  <img src="https://images.unsplash.com/photo-1600607688969-a5bfcd646154?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Office Space" class="w-full h-64 object-cover">
665
  <div class="type-tag commercial-tag">КОММЕРЧЕСКАЯ</div>
@@ -698,7 +713,7 @@
698
 
699
  <!-- Property 6 -->
700
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
701
- data-full-address="Кишинёв, сектор Чеканы, ул. Дачия 56, кв. 34">
702
  <div class="relative">
703
  <img src="https://images.unsplash.com/photo-1600566752355-35792bedcfea?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Luxury Apartment" class="w-full h-64 object-cover">
704
  <div class="type-tag newbuilding-tag">НОВОСТРОЙ</div>
@@ -1187,63 +1202,7 @@
1187
  let mainMap, propertyMap;
1188
  const propertyMarkers = [];
1189
 
1190
- // Sample property coordinates (replace with your actual data)
1191
- const propertyLocations = [
1192
- {
1193
- id: 1,
1194
- lat: 47.025467,
1195
- lng: 28.830689,
1196
- title: "Вилла в Буюканах",
1197
- price: "€450,000",
1198
- address: "Кишинёв, сектор Буюканы, ул. Мирча чел Бэтрын 15",
1199
- type: "premium"
1200
- },
1201
- {
1202
- id: 2,
1203
- lat: 47.024581,
1204
- lng: 28.828382,
1205
- title: "Апартаменты в Центре",
1206
- price: "€220,000",
1207
- address: "Кишинёв, сектор Центр, ул. 31 Августа 78",
1208
- type: "secondary"
1209
- },
1210
- {
1211
- id: 3,
1212
- lat: 47.032456,
1213
- lng: 28.831267,
1214
- title: "Пентхаус на Рышкановке",
1215
- price: "€380,000",
1216
- address: "Кишинёв, сектор Рышкановка, ул. Албишоара 42",
1217
- type: "premium"
1218
- },
1219
- {
1220
- id: 4,
1221
- lat: 47.091234,
1222
- lng: 28.875678,
1223
- title: "Загородный дом",
1224
- price: "€320,000",
1225
- address: "Вадул-луй-Водэ, ул. Кодрулор 15",
1226
- type: "premium"
1227
- },
1228
- {
1229
- id: 5,
1230
- lat: 47.023789,
1231
- lng: 28.827654,
1232
- title: "Офисное помещение",
1233
- price: "€280,000",
1234
- address: "Кишинёв, сектор Центр, ул. Пушкина 28, офис 5",
1235
- type: "commercial"
1236
- },
1237
- {
1238
- id: 6,
1239
- lat: 47.028765,
1240
- lng: 28.842109,
1241
- title: "Апартаменты на Чеканах",
1242
- price: "€190,000",
1243
- address: "Кишинёв, сектор Чеканы, ул. Дачия 56, кв. 34",
1244
- type: "newbuilding"
1245
- }
1246
- ];
1247
 
1248
  function initMainMap() {
1249
  mainMap = L.map('main-map').setView([47.0245, 28.8323], 13);
@@ -1283,32 +1242,73 @@
1283
  iconSize: [30, 30]
1284
  });
1285
 
1286
- // Add markers for each property with type-specific icons
1287
- propertyLocations.forEach(property => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1288
  let icon;
1289
- switch(property.type) {
1290
- case 'premium':
1291
  icon = iconPremium;
1292
  break;
1293
- case 'secondary':
1294
  icon = iconSecondary;
1295
  break;
1296
- case 'newbuilding':
1297
  icon = iconNewbuilding;
1298
  break;
1299
- case 'commercial':
1300
  icon = iconCommercial;
1301
  break;
1302
- case 'rental':
1303
  icon = iconRental;
1304
  break;
1305
  default:
1306
  icon = iconPremium;
1307
  }
1308
 
1309
- const marker = L.marker([property.lat, property.lng], {icon})
1310
- .addTo(mainMap)
1311
- .bindPopup(`<b>${property.title}</b><br>${property.price}<br><small>${property.type}</small>`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1312
 
1313
  propertyMarkers.push(marker);
1314
  });
@@ -1461,15 +1461,15 @@
1461
  item.querySelector('img').src = propertyImg;
1462
  });
1463
 
1464
- // Find property location and init map after slight delay to allow DOM update
1465
- const propertyId = parseInt(button.dataset.property);
1466
- const property = propertyLocations.find(p => p.id === propertyId);
1467
- if (property) {
1468
  setTimeout(() => {
1469
- initPropertyMap(property.lat, property.lng);
1470
  }, 100);
1471
  } else {
1472
- // Default coordinates if property not found in locations
1473
  setTimeout(() => {
1474
  initPropertyMap(47.0245, 28.8323);
1475
  }, 100);
 
164
  position: relative;
165
  }
166
 
167
+ .map-popup-container .leaflet-popup-content {
168
+ margin: 12px;
169
+ }
170
+
171
+ .map-popup {
172
+ font-family: 'Montserrat', sans-serif;
173
+ }
174
+
175
+ .map-popup h4 {
176
+ margin-bottom: 6px;
177
+ font-size: 16px;
178
+ }
179
+
180
  .map-placeholder {
181
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
182
  display: flex;
 
504
  <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
505
  <!-- Property 1 -->
506
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
507
+ data-city="Кишинёв" data-district="Буюканы" data-type="premium" data-coords="47.038673, 28.770806"
508
  data-price="450000" data-area="250" data-rooms="5" data-floors="2"
509
  data-year="2018" data-land="10" data-parking="2" data-address="ул. Мирча чел Бэтрын 15"
510
+ data-full-address="Кишинёв, сектор Буюканы, ул. Алба Юлия 194/2"
511
  data-description="Элитная вилла в престижном районе Буюканы. Просторные светлые помещения, высокие потолки, панорамные окна. Современная отделка премиальными материалами. Кухня-гостиная с выходом на террасу и в сад. Мастер-спальня с гардеробной и собственной ванной комнатой. Дополнительно: камин, система 'умный дом', видеонаблюдение, автономное отопление. Ухоженный сад с зоной отдыха и летней кухней.">
512
  <div class="relative">
513
  <img src="https://images.unsplash.com/photo-1564013799919-ab600027ffc6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Luxury House" class="w-full h-64 object-cover">
 
547
 
548
  <!-- Property 2 -->
549
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
550
+ data-city="Кишинёв" data-district="Центр" data-type="Вторичка" data-coords="47.025467,28.830689"
551
  data-price="220000" data-area="120" data-rooms="3" data-floors="7"
552
  data-year="2015" data-parking="1" data-address="ул. 31 Августа 78"
553
  data-full-address="Кишинёв, сектор Центр, ул. 31 Августа 78"
 
590
 
591
  <!-- Property 3 -->
592
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
593
+ data-city="Кишинёв" data-district="Рышкановка" data-price="380000" data-coords="47.032456,28.831267"
594
+ data-address="ул. Албишоара 42"
595
  data-area="180" data-rooms="4"
596
  data-full-address="Кишинёв, сектор Рышкановка, ул. Албишоара 42">
597
  <div class="relative">
 
632
 
633
  <!-- Property 4 -->
634
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
635
+ data-city="Вадул-луй-Водэ" data-district="" data-price="320000" data-coords="47.091234,28.875678"
636
+ data-address="ул. Кодрулор 15"
637
  data-area="300" data-rooms="6" data-land="15"
638
  data-full-address="Вадул-луй-Водэ, ул. Кодрулор 15">
639
  <div class="relative">
 
674
 
675
  <!-- Property 5 -->
676
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
677
+ data-full-address="Кишинёв, сектор Центр, ул. Пушкина 28, офис 5" data-coords="47.023789,28.827654">
678
  <div class="relative">
679
  <img src="https://images.unsplash.com/photo-1600607688969-a5bfcd646154?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Office Space" class="w-full h-64 object-cover">
680
  <div class="type-tag commercial-tag">КОММЕРЧЕСКАЯ</div>
 
713
 
714
  <!-- Property 6 -->
715
  <div class="property-card glass-effect rounded-xl overflow-hidden transition duration-500 ease-in-out hover:shadow-lg"
716
+ data-full-address="Кишинёв, сектор Чеканы, ул. Дачия 56, кв. 34" data-coords="47.028765,28.842109">
717
  <div class="relative">
718
  <img src="https://images.unsplash.com/photo-1600566752355-35792bedcfea?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Luxury Apartment" class="w-full h-64 object-cover">
719
  <div class="type-tag newbuilding-tag">НОВОСТРОЙ</div>
 
1202
  let mainMap, propertyMap;
1203
  const propertyMarkers = [];
1204
 
1205
+ // Property coordinates will be read from data-coords attribute
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1206
 
1207
  function initMainMap() {
1208
  mainMap = L.map('main-map').setView([47.0245, 28.8323], 13);
 
1242
  iconSize: [30, 30]
1243
  });
1244
 
1245
+ // Add markers for each property card with precise coordinates
1246
+ document.querySelectorAll('.property-card').forEach((card, index) => {
1247
+ const coords = card.dataset.coords;
1248
+ if (!coords) {
1249
+ console.warn('Property card missing coordinates:', card.querySelector('h3').textContent);
1250
+ return;
1251
+ }
1252
+
1253
+ // Parse coordinates carefully
1254
+ const [latStr, lngStr] = coords.split(',');
1255
+ const lat = parseFloat(latStr.trim());
1256
+ const lng = parseFloat(lngStr.trim());
1257
+
1258
+ if (isNaN(lat) || isNaN(lng)) {
1259
+ console.error('Invalid coordinates for property:', card.querySelector('h3').textContent, coords);
1260
+ return;
1261
+ }
1262
+
1263
+ const title = card.querySelector('h3').textContent;
1264
+ const price = card.querySelector('.price-tag').textContent;
1265
+ const typeTag = card.querySelector('.type-tag');
1266
+ const type = typeTag ? typeTag.textContent.trim() : '';
1267
+
1268
  let icon;
1269
+ switch(type.toLowerCase()) {
1270
+ case 'премиум':
1271
  icon = iconPremium;
1272
  break;
1273
+ case 'вторичка':
1274
  icon = iconSecondary;
1275
  break;
1276
+ case 'новострой':
1277
  icon = iconNewbuilding;
1278
  break;
1279
+ case 'коммерческая':
1280
  icon = iconCommercial;
1281
  break;
1282
+ case 'аренда':
1283
  icon = iconRental;
1284
  break;
1285
  default:
1286
  icon = iconPremium;
1287
  }
1288
 
1289
+ // Create marker with precise position
1290
+ const marker = L.marker([lat, lng], {
1291
+ icon: icon,
1292
+ title: title
1293
+ }).addTo(mainMap);
1294
+
1295
+ // Customize popup content
1296
+ const popupContent = `
1297
+ <div class="map-popup">
1298
+ <h4 class="font-bold">${title}</h4>
1299
+ <div class="text-gold-600">${price}</div>
1300
+ <div class="text-sm">${type}</div>
1301
+ <button class="mt-2 px-2 py-1 bg-gold-500 text-black text-sm rounded hover:bg-gold-600 transition"
1302
+ onclick="document.querySelector('[data-coords=\"${coords}\"] .view-details-btn').click()">
1303
+ Подробнее
1304
+ </button>
1305
+ </div>
1306
+ `;
1307
+
1308
+ marker.bindPopup(popupContent, {
1309
+ maxWidth: 250,
1310
+ className: 'map-popup-container'
1311
+ });
1312
 
1313
  propertyMarkers.push(marker);
1314
  });
 
1461
  item.querySelector('img').src = propertyImg;
1462
  });
1463
 
1464
+ // Get coordinates from property card and init map
1465
+ const coords = propertyCard.dataset.coords;
1466
+ if (coords) {
1467
+ const [lat, lng] = coords.split(',').map(Number);
1468
  setTimeout(() => {
1469
+ initPropertyMap(lat, lng);
1470
  }, 100);
1471
  } else {
1472
+ // Default coordinates if no coords specified
1473
  setTimeout(() => {
1474
  initPropertyMap(47.0245, 28.8323);
1475
  }, 100);