Download all files FTP
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -3,10 +3,17 @@
|
||||
&__wrapper {
|
||||
position: relative;
|
||||
width: 1264px;
|
||||
margin: 0 auto;
|
||||
max-width: 100%;
|
||||
margin: 0 auto 40px;
|
||||
padding: 93px 126px 26px;
|
||||
border: 4px solid #192c44;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
width: 100%;
|
||||
padding: 50px 16px 20px;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
.apartament-card__title {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
@@ -24,6 +31,12 @@
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
padding: 5px 70px 8px;
|
||||
white-space: nowrap;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 22px;
|
||||
padding: 5px 30px 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +51,13 @@
|
||||
|
||||
width: 43px;
|
||||
height: 119px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
transform: none;
|
||||
left: 4px;
|
||||
width: 30px;
|
||||
height: 60px;
|
||||
}
|
||||
}
|
||||
.swiper-button-next {
|
||||
right: 0;
|
||||
@@ -45,6 +65,13 @@
|
||||
|
||||
width: 43px;
|
||||
height: 119px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
transform: none;
|
||||
right: 4px;
|
||||
width: 30px;
|
||||
height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
@@ -65,10 +92,20 @@
|
||||
gap: 26px;
|
||||
margin-bottom: 15px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.apartament-card__info_col1 {
|
||||
border: 4px solid #192c44;
|
||||
padding: 25px 10% 10px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
border-width: 2px;
|
||||
padding: 16px 12px 10px;
|
||||
}
|
||||
|
||||
table,
|
||||
tr,
|
||||
td {
|
||||
@@ -137,6 +174,10 @@
|
||||
font-weight: 400;
|
||||
font-size: 22px;
|
||||
line-height: 1.2;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,6 +187,11 @@
|
||||
padding: 25px 10% 10px;
|
||||
align-content: center;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
border-width: 2px;
|
||||
padding: 16px 12px 10px;
|
||||
}
|
||||
|
||||
.card__info_col2__img {
|
||||
margin-bottom: 40px;
|
||||
|
||||
@@ -184,6 +230,10 @@
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
line-height: 1.05;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
@@ -201,6 +251,11 @@
|
||||
font-size: 20px;
|
||||
line-height: 30px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
@@ -219,3 +274,100 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Popup historii cen ──
|
||||
.price-history-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 99999;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&.is-open {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.price-history-modal {
|
||||
position: relative;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
width: 90%;
|
||||
max-width: 520px;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
padding: 32px 28px 28px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
|
||||
font-family: 'Barlow', sans-serif;
|
||||
color: #192c44;
|
||||
|
||||
&__close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 6px;
|
||||
line-height: 1;
|
||||
|
||||
&:hover svg path {
|
||||
stroke: #f54040;
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
&__current {
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 2px solid #eee;
|
||||
}
|
||||
|
||||
&__row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
padding: 4px 0;
|
||||
font-size: 16px;
|
||||
|
||||
&--bold {
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
&__val {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
&__table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 14px;
|
||||
|
||||
td {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
tr:hover td {
|
||||
background: #f5f7fa;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('.apartament-gallery-swiper').forEach(function (el) {
|
||||
new Swiper(el, {
|
||||
slidesPerView: 1,
|
||||
@@ -21,6 +21,50 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
// Historia cen
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
function formatPrice(value) {
|
||||
if (value === null || value === undefined) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var normalized = String(value)
|
||||
.replace(/\u00a0/g, '')
|
||||
.replace(/\s+/g, '')
|
||||
.replace(/zł|zl/gi, '')
|
||||
.replace(/[^0-9,.-]/g, '');
|
||||
|
||||
if (!normalized) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var lastComma = normalized.lastIndexOf(',');
|
||||
var lastDot = normalized.lastIndexOf('.');
|
||||
|
||||
if (lastComma !== -1 && lastDot !== -1) {
|
||||
if (lastComma > lastDot) {
|
||||
normalized = normalized.replace(/\./g, '').replace(',', '.');
|
||||
} else {
|
||||
normalized = normalized.replace(/,/g, '');
|
||||
}
|
||||
} else if (lastComma !== -1) {
|
||||
normalized = normalized.replace(/\./g, '').replace(',', '.');
|
||||
} else {
|
||||
var dotParts = normalized.split('.');
|
||||
if (dotParts.length > 2) {
|
||||
normalized = dotParts.slice(0, -1).join('') + '.' + dotParts[dotParts.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
var amount = Number(normalized);
|
||||
if (Number.isNaN(amount)) {
|
||||
return String(value).trim();
|
||||
}
|
||||
|
||||
return amount.toLocaleString('pl-PL', {
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
});
|
||||
}
|
||||
|
||||
var overlay = document.getElementById('price-history-overlay');
|
||||
var closeBtn = document.getElementById('price-history-close');
|
||||
var elTitle = document.getElementById('price-history-title');
|
||||
@@ -49,39 +93,32 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
|
||||
// Zamknij przyciskiem X
|
||||
closeBtn.addEventListener('click', closePopup);
|
||||
|
||||
// Zamknij klikając na overlay (poza modalem)
|
||||
overlay.addEventListener('click', function (e) {
|
||||
if (e.target === overlay) closePopup();
|
||||
});
|
||||
|
||||
// Zamknij klawiszem Escape
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape' && overlay.classList.contains('is-open')) closePopup();
|
||||
});
|
||||
|
||||
// Kliknięcie w przycisk Historia cen
|
||||
document.querySelectorAll('.btn-historia-cen').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var postId = this.dataset.postId;
|
||||
if (!postId) return;
|
||||
|
||||
// Reset i pokaż "Ładowanie..."
|
||||
elTitle.textContent = 'Ładowanie...';
|
||||
elPrice.textContent = '';
|
||||
elPriceM2.textContent = '';
|
||||
elTbody.innerHTML = '';
|
||||
openPopup();
|
||||
|
||||
// Sprawdź dostępność danych globalnych (wp_localize_script)
|
||||
if (typeof apartamentsData === 'undefined') {
|
||||
elTitle.textContent = 'Błąd konfiguracji';
|
||||
return;
|
||||
}
|
||||
|
||||
// Buduj FormData
|
||||
var formData = new FormData();
|
||||
formData.append('action', 'apartamenty_get_price_history');
|
||||
formData.append('post_id', postId);
|
||||
@@ -102,8 +139,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
var d = json.data;
|
||||
|
||||
elTitle.textContent = d.title || '';
|
||||
elPrice.textContent = d.price ? d.price + ' zł' : '—';
|
||||
elPriceM2.textContent = d.price_m2 ? d.price_m2 + ' zł' : '—';
|
||||
elPrice.textContent = d.price ? formatPrice(d.price) + ' zł' : '—';
|
||||
elPriceM2.textContent = d.price_m2 ? formatPrice(d.price_m2) + ' zł' : '—';
|
||||
|
||||
if (!d.history || d.history.length === 0) {
|
||||
elTbody.innerHTML = '<tr><td colspan="3">Brak historii cen</td></tr>';
|
||||
@@ -113,8 +150,66 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
elTbody.innerHTML = d.history.map(function (row) {
|
||||
return '<tr>' +
|
||||
'<td>' + (row.recorded_at || '') + '</td>' +
|
||||
'<td>' + (row.price_m2 ? row.price_m2 + ' zł/m²' : '—') + '</td>' +
|
||||
'<td>' + (row.price ? row.price + ' zł' : '—') + '</td>' +
|
||||
'<td>' + (row.price_m2 ? formatPrice(row.price_m2) + ' zł/m²' : '—') + '</td>' +
|
||||
'<td>' + (row.price ? formatPrice(row.price) + ' zł' : '—') + '</td>' +
|
||||
'</tr>';
|
||||
}).join('');
|
||||
})
|
||||
.catch(function () {
|
||||
elTitle.textContent = 'Błąd ładowania';
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('.btn-parking-historia-cen').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var parkingType = this.dataset.parkingType;
|
||||
if (!parkingType) return;
|
||||
|
||||
elTitle.textContent = 'Ładowanie...';
|
||||
elPrice.textContent = '';
|
||||
elPriceM2.textContent = '';
|
||||
elTbody.innerHTML = '';
|
||||
openPopup();
|
||||
|
||||
if (typeof apartamentsData === 'undefined') {
|
||||
elTitle.textContent = 'Błąd konfiguracji';
|
||||
return;
|
||||
}
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('action', 'parking_get_price_history');
|
||||
formData.append('parking_type', parkingType);
|
||||
formData.append('nonce', apartamentsData.nonce);
|
||||
|
||||
fetch(apartamentsData.ajaxUrl, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
credentials: 'same-origin',
|
||||
})
|
||||
.then(function (res) { return res.json(); })
|
||||
.then(function (json) {
|
||||
if (!json.success) {
|
||||
elTitle.textContent = 'Brak danych';
|
||||
return;
|
||||
}
|
||||
|
||||
var d = json.data;
|
||||
|
||||
elTitle.textContent = d.title || '';
|
||||
elPrice.textContent = d.price ? formatPrice(d.price) + ' zł' : '—';
|
||||
elPriceM2.textContent = d.price_m2 ? formatPrice(d.price_m2) + ' zł' : '—';
|
||||
|
||||
if (!d.history || d.history.length === 0) {
|
||||
elTbody.innerHTML = '<tr><td colspan="3">Brak historii cen</td></tr>';
|
||||
return;
|
||||
}
|
||||
|
||||
elTbody.innerHTML = d.history.map(function (row) {
|
||||
return '<tr>' +
|
||||
'<td>' + (row.recorded_at || '') + '</td>' +
|
||||
'<td>' + (row.price_m2 ? formatPrice(row.price_m2) + ' zł/m²' : '—') + '</td>' +
|
||||
'<td>' + (row.price ? formatPrice(row.price) + ' zł' : '—') + '</td>' +
|
||||
'</tr>';
|
||||
}).join('');
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user