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('');
|
||||
})
|
||||
|
||||
@@ -16,13 +16,62 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatuje kwotÄ™ do postaci 1 000 000,00.
|
||||
*
|
||||
* @param mixed $price Surowa wartość ceny.
|
||||
* @return string
|
||||
*/
|
||||
function elementor_addon_format_price( $price ) {
|
||||
if ( '' === $price || null === $price ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$value = wp_strip_all_tags( (string) $price );
|
||||
$value = str_replace( [ "\xc2\xa0", ' ', 'zł', 'zl' ], '', $value );
|
||||
$value = preg_replace( '/[^\d,.\-]/u', '', $value );
|
||||
|
||||
if ( '' === $value || null === $value ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$last_comma = strrpos( $value, ',' );
|
||||
$last_dot = strrpos( $value, '.' );
|
||||
|
||||
if ( false !== $last_comma && false !== $last_dot ) {
|
||||
if ( $last_comma > $last_dot ) {
|
||||
$value = str_replace( '.', '', $value );
|
||||
$value = str_replace( ',', '.', $value );
|
||||
} else {
|
||||
$value = str_replace( ',', '', $value );
|
||||
}
|
||||
} elseif ( false !== $last_comma ) {
|
||||
$value = str_replace( '.', '', $value );
|
||||
$value = str_replace( ',', '.', $value );
|
||||
} else {
|
||||
$parts = explode( '.', $value );
|
||||
if ( count( $parts ) > 2 ) {
|
||||
$decimal = array_pop( $parts );
|
||||
$value = implode( '', $parts ) . '.' . $decimal;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! is_numeric( $value ) ) {
|
||||
return trim( (string) $price );
|
||||
}
|
||||
|
||||
return number_format_i18n( (float) $value, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register widget files
|
||||
*/
|
||||
function register_hello_world_widget( $widgets_manager ) {
|
||||
require_once( __DIR__ . '/widgets/apartaments.php' );
|
||||
require_once( __DIR__ . '/widgets/parking-spots.php' );
|
||||
|
||||
$widgets_manager->register( new \Elementor_Apartaments() );
|
||||
$widgets_manager->register( new \Elementor_Parking_Spots() );
|
||||
}
|
||||
add_action( 'elementor/widgets/register', 'register_hello_world_widget' );
|
||||
|
||||
@@ -86,7 +135,7 @@ function elementor_addon_register_assets() {
|
||||
add_action( 'wp_enqueue_scripts', 'elementor_addon_register_assets' );
|
||||
|
||||
/**
|
||||
* Przekaż dane do JS (ajaxUrl + nonce) gdy skrypt jest enqueue'owany przez widget.
|
||||
* PrzekaĹĽ dane do JS (ajaxUrl + nonce) gdy skrypt jest enqueue'owany przez widget.
|
||||
*/
|
||||
function elementor_addon_localize_scripts() {
|
||||
wp_localize_script( 'elementor-addon-main-js', 'apartamentsData', [
|
||||
@@ -96,12 +145,38 @@ function elementor_addon_localize_scripts() {
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'elementor_addon_localize_scripts', 20 );
|
||||
|
||||
/**
|
||||
* Włącza wsparcie "Atrybuty wpisu" (menu_order) dla CPT apartamenty,
|
||||
* aby można było ręcznie ustawiać kolejność.
|
||||
*/
|
||||
function elementor_addon_enable_apartamenty_menu_order( $args, $post_type ) {
|
||||
if ( 'apartamenty' !== $post_type ) {
|
||||
return $args;
|
||||
}
|
||||
|
||||
$supports = $args['supports'] ?? [];
|
||||
if ( true === $supports || false === $supports ) {
|
||||
$supports = [ 'title', 'editor' ];
|
||||
}
|
||||
if ( ! is_array( $supports ) ) {
|
||||
$supports = (array) $supports;
|
||||
}
|
||||
if ( ! in_array( 'page-attributes', $supports, true ) ) {
|
||||
$supports[] = 'page-attributes';
|
||||
}
|
||||
|
||||
$args['supports'] = $supports;
|
||||
|
||||
return $args;
|
||||
}
|
||||
add_filter( 'register_post_type_args', 'elementor_addon_enable_apartamenty_menu_order', 20, 2 );
|
||||
|
||||
// ===========================================================
|
||||
// HISTORIA CEN — TABELA DB
|
||||
// HISTORIA CEN — TABELA DB
|
||||
// ===========================================================
|
||||
|
||||
/**
|
||||
* Tworzy tabelę wp_price_history jeśli nie istnieje lub wersja DB jest stara.
|
||||
* Tworzy tabelę wp_price_history jeśli nie istnieje lub wersja DB jest stara.
|
||||
*/
|
||||
function elementor_addon_create_price_history_table() {
|
||||
global $wpdb;
|
||||
@@ -123,27 +198,58 @@ function elementor_addon_create_price_history_table() {
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
||||
dbDelta( $sql );
|
||||
|
||||
update_option( 'elementor_addon_db_version', '1.0' );
|
||||
}
|
||||
register_activation_hook( __FILE__, 'elementor_addon_create_price_history_table' );
|
||||
|
||||
/**
|
||||
* Sprawdza wersję DB przy każdym init i tworzy tabelę jeśli brakuje.
|
||||
* Tworzy tabelÄ™ wp_parking_price_history dla miejsc postojowych.
|
||||
*/
|
||||
function elementor_addon_create_parking_price_history_table() {
|
||||
global $wpdb;
|
||||
|
||||
$table_name = $wpdb->prefix . 'parking_price_history';
|
||||
$charset_collate = $wpdb->get_charset_collate();
|
||||
|
||||
$sql = "CREATE TABLE {$table_name} (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
parking_type VARCHAR(50) NOT NULL,
|
||||
price VARCHAR(50) NOT NULL DEFAULT '',
|
||||
price_m2 VARCHAR(50) NOT NULL DEFAULT '',
|
||||
recorded_at DATE NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY unique_daily (parking_type, recorded_at),
|
||||
KEY idx_type (parking_type)
|
||||
) ENGINE=InnoDB {$charset_collate};";
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
||||
dbDelta( $sql );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tworzy obie tabele przy aktywacji pluginu.
|
||||
*/
|
||||
function elementor_addon_create_tables() {
|
||||
elementor_addon_create_price_history_table();
|
||||
elementor_addon_create_parking_price_history_table();
|
||||
update_option( 'elementor_addon_db_version', '1.1' );
|
||||
}
|
||||
register_activation_hook( __FILE__, 'elementor_addon_create_tables' );
|
||||
|
||||
/**
|
||||
* Sprawdza wersję DB przy każdym init i tworzy tabele jeśli brakuje.
|
||||
*/
|
||||
function elementor_addon_maybe_update_db() {
|
||||
if ( get_option( 'elementor_addon_db_version' ) !== '1.0' ) {
|
||||
elementor_addon_create_price_history_table();
|
||||
if ( get_option( 'elementor_addon_db_version' ) !== '1.1' ) {
|
||||
elementor_addon_create_tables();
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'elementor_addon_maybe_update_db' );
|
||||
|
||||
// ===========================================================
|
||||
// HISTORIA CEN — CRON DZIENNY
|
||||
// HISTORIA CEN — CRON DZIENNY
|
||||
// ===========================================================
|
||||
|
||||
/**
|
||||
* Rejestruje WP Cron jeśli jeszcze nie zaplanowany.
|
||||
* Rejestruje WP Cron jeśli jeszcze nie zaplanowany.
|
||||
*/
|
||||
function elementor_addon_schedule_cron() {
|
||||
if ( ! wp_next_scheduled( 'apartamenty_record_prices' ) ) {
|
||||
@@ -153,8 +259,8 @@ function elementor_addon_schedule_cron() {
|
||||
add_action( 'wp', 'elementor_addon_schedule_cron' );
|
||||
|
||||
/**
|
||||
* Zapisuje aktualne ceny wszystkich apartamentów do tabeli historii.
|
||||
* Używa INSERT IGNORE — jeden rekord na apartament na dzień.
|
||||
* Zapisuje aktualne ceny wszystkich apartamentĂłw do tabeli historii.
|
||||
* Używa INSERT IGNORE — jeden rekord na apartament na dzień.
|
||||
*/
|
||||
function elementor_addon_record_prices() {
|
||||
global $wpdb;
|
||||
@@ -192,11 +298,37 @@ function elementor_addon_record_prices() {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Miejsca postojowe - zapis cen z ACF options (pola w grupach)
|
||||
$parking_table = $wpdb->prefix . 'parking_price_history';
|
||||
$parking_groups = [
|
||||
'zwykle' => 'miejsce_postojowe_zwykle',
|
||||
'rodzinne' => 'miejsce_postojowe_rodzinne',
|
||||
];
|
||||
|
||||
foreach ( $parking_groups as $type => $group_name ) {
|
||||
$group = get_field( $group_name, 'option' ) ?: [];
|
||||
$price = $group[ $group_name . '_cena' ] ?? '';
|
||||
$price_m2 = $group[ $group_name . '_cena_m2' ] ?? '';
|
||||
|
||||
if ( $price || $price_m2 ) {
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"INSERT IGNORE INTO {$parking_table} (parking_type, price, price_m2, recorded_at)
|
||||
VALUES (%s, %s, %s, %s)",
|
||||
$type,
|
||||
(string) $price,
|
||||
(string) $price_m2,
|
||||
$today
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'apartamenty_record_prices', 'elementor_addon_record_prices' );
|
||||
|
||||
// ===========================================================
|
||||
// HISTORIA CEN — AJAX ENDPOINT
|
||||
// HISTORIA CEN - AJAX ENDPOINT
|
||||
// ===========================================================
|
||||
|
||||
/**
|
||||
@@ -241,12 +373,66 @@ function elementor_addon_get_price_history_ajax() {
|
||||
add_action( 'wp_ajax_apartamenty_get_price_history', 'elementor_addon_get_price_history_ajax' );
|
||||
add_action( 'wp_ajax_nopriv_apartamenty_get_price_history', 'elementor_addon_get_price_history_ajax' );
|
||||
|
||||
/**
|
||||
* Zwraca historię cen dla miejsca postojowego jako JSON.
|
||||
* Parametr: parking_type ('zwykle' lub 'rodzinne')
|
||||
*/
|
||||
function elementor_addon_get_parking_price_history_ajax() {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! check_ajax_referer( 'apartamenty_price_history_nonce', 'nonce', false ) ) {
|
||||
wp_send_json_error( [ 'message' => 'Invalid nonce' ] );
|
||||
die();
|
||||
}
|
||||
|
||||
$parking_type = sanitize_text_field( $_POST['parking_type'] ?? '' );
|
||||
if ( ! in_array( $parking_type, [ 'zwykle', 'rodzinne' ], true ) ) {
|
||||
wp_send_json_error( [ 'message' => 'Invalid parking_type' ] );
|
||||
die();
|
||||
}
|
||||
|
||||
$labels = [
|
||||
'zwykle' => 'Miejsce postojowe zwykłe',
|
||||
'rodzinne' => 'Miejsce postojowe rodzinne',
|
||||
];
|
||||
|
||||
$group_names = [
|
||||
'zwykle' => 'miejsce_postojowe_zwykle',
|
||||
'rodzinne' => 'miejsce_postojowe_rodzinne',
|
||||
];
|
||||
|
||||
$table_name = $wpdb->prefix . 'parking_price_history';
|
||||
|
||||
$history = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT recorded_at, price, price_m2
|
||||
FROM {$table_name}
|
||||
WHERE parking_type = %s
|
||||
ORDER BY recorded_at DESC
|
||||
LIMIT 50",
|
||||
$parking_type
|
||||
)
|
||||
);
|
||||
|
||||
$group_name = $group_names[ $parking_type ];
|
||||
$group = get_field( $group_name, 'option' ) ?: [];
|
||||
|
||||
wp_send_json_success( [
|
||||
'title' => $labels[ $parking_type ],
|
||||
'price' => $group[ $group_name . '_cena' ] ?? '',
|
||||
'price_m2' => $group[ $group_name . '_cena_m2' ] ?? '',
|
||||
'history' => $history,
|
||||
] );
|
||||
}
|
||||
add_action( 'wp_ajax_parking_get_price_history', 'elementor_addon_get_parking_price_history_ajax' );
|
||||
add_action( 'wp_ajax_nopriv_parking_get_price_history', 'elementor_addon_get_parking_price_history_ajax' );
|
||||
|
||||
// ===========================================================
|
||||
// JAWNOŚĆ CEN — XML ENDPOINTS
|
||||
// JAWNOŚĆCEN — XML ENDPOINTS
|
||||
// ===========================================================
|
||||
|
||||
/**
|
||||
* Rejestruje reguły przepisywania dla endpointów XML.
|
||||
* Rejestruje reguły przepisywania dla endpointów XML.
|
||||
*/
|
||||
function apartamenty_xml_rewrite_rules() {
|
||||
add_rewrite_rule( '^ceny-mieszkan\.(xml|md5)$', 'index.php?apartamenty_xml=$matches[1]', 'top' );
|
||||
@@ -255,7 +441,7 @@ function apartamenty_xml_rewrite_rules() {
|
||||
add_action( 'init', 'apartamenty_xml_rewrite_rules', 10 );
|
||||
|
||||
/**
|
||||
* Dodaje query vars dla endpointów XML.
|
||||
* Dodaje query vars dla endpointĂłw XML.
|
||||
*/
|
||||
function apartamenty_xml_query_vars( $vars ) {
|
||||
$vars[] = 'apartamenty_xml';
|
||||
@@ -265,8 +451,8 @@ function apartamenty_xml_query_vars( $vars ) {
|
||||
add_filter( 'query_vars', 'apartamenty_xml_query_vars' );
|
||||
|
||||
/**
|
||||
* Generuje XML z cenami wszystkich apartamentów.
|
||||
* Wynik cachowany w transiencie na 1 godzinę.
|
||||
* Generuje XML z cenami wszystkich apartamentĂłw.
|
||||
* Wynik cachowany w transiencie na 1 godzinÄ™.
|
||||
*
|
||||
* @return string XML jako string
|
||||
*/
|
||||
@@ -283,8 +469,10 @@ function apartamenty_generate_price_xml() {
|
||||
'post_type' => 'apartamenty',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'order' => 'ASC',
|
||||
'orderby' => [
|
||||
'menu_order' => 'ASC',
|
||||
'title' => 'ASC',
|
||||
],
|
||||
] );
|
||||
|
||||
$x = function( $val ) {
|
||||
@@ -340,6 +528,58 @@ function apartamenty_generate_price_xml() {
|
||||
}
|
||||
}
|
||||
|
||||
// Miejsca postojowe
|
||||
$parking_table = $wpdb->prefix . 'parking_price_history';
|
||||
$parking_configs = [
|
||||
'zwykle' => [
|
||||
'label' => 'Miejsce postojowe zwykłe',
|
||||
'group_name' => 'miejsce_postojowe_zwykle',
|
||||
],
|
||||
'rodzinne' => [
|
||||
'label' => 'Miejsce postojowe rodzinne',
|
||||
'group_name' => 'miejsce_postojowe_rodzinne',
|
||||
],
|
||||
];
|
||||
|
||||
$xml .= "\t<miejsca_postojowe>\n";
|
||||
|
||||
foreach ( $parking_configs as $type => $cfg ) {
|
||||
$group = get_field( $cfg['group_name'], 'option' ) ?: [];
|
||||
$price = $group[ $cfg['group_name'] . '_cena' ] ?? '';
|
||||
$price_m2 = $group[ $cfg['group_name'] . '_cena_m2' ] ?? '';
|
||||
|
||||
$p_history = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT recorded_at, price, price_m2
|
||||
FROM {$parking_table}
|
||||
WHERE parking_type = %s
|
||||
ORDER BY recorded_at DESC",
|
||||
$type
|
||||
)
|
||||
);
|
||||
|
||||
$last_update = ! empty( $p_history ) ? $p_history[0]->recorded_at : date( 'Y-m-d' );
|
||||
|
||||
$xml .= "\t\t" . '<miejsce_postojowe typ="' . $x( $type ) . '">' . "\n";
|
||||
$xml .= "\t\t\t<nazwa>" . $x( $cfg['label'] ) . "</nazwa>\n";
|
||||
$xml .= "\t\t\t<cena_brutto>" . $x( $price ) . "</cena_brutto>\n";
|
||||
$xml .= "\t\t\t<cena_za_m2>" . $x( $price_m2 ) . "</cena_za_m2>\n";
|
||||
$xml .= "\t\t\t<data_aktualizacji>" . $x( $last_update ) . "</data_aktualizacji>\n";
|
||||
$xml .= "\t\t\t<historia_cen>\n";
|
||||
|
||||
foreach ( $p_history as $row ) {
|
||||
$xml .= "\t\t\t\t" . '<zmiana data="' . $x( $row->recorded_at ) . '">' . "\n";
|
||||
$xml .= "\t\t\t\t\t<cena_brutto>" . $x( $row->price ) . "</cena_brutto>\n";
|
||||
$xml .= "\t\t\t\t\t<cena_za_m2>" . $x( $row->price_m2 ) . "</cena_za_m2>\n";
|
||||
$xml .= "\t\t\t\t</zmiana>\n";
|
||||
}
|
||||
|
||||
$xml .= "\t\t\t</historia_cen>\n";
|
||||
$xml .= "\t\t</miejsce_postojowe>\n";
|
||||
}
|
||||
|
||||
$xml .= "\t</miejsca_postojowe>\n";
|
||||
|
||||
$xml .= '</lokale>';
|
||||
|
||||
set_transient( 'apartamenty_price_xml_cache', $xml, HOUR_IN_SECONDS );
|
||||
@@ -400,7 +640,7 @@ function apartamenty_generate_datagov_xml() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsługuje żądania do endpointów XML — wysyła odpowiedź i kończy.
|
||||
* Obsługuje żądania do endpointów XML — wysyła odpowiedź i kończy.
|
||||
*/
|
||||
function apartamenty_xml_template_redirect() {
|
||||
$xml_type = get_query_var( 'apartamenty_xml' );
|
||||
@@ -433,16 +673,16 @@ function apartamenty_xml_template_redirect() {
|
||||
add_action( 'template_redirect', 'apartamenty_xml_template_redirect', 1 );
|
||||
|
||||
// ===========================================================
|
||||
// JAWNOŚĆ CEN — STRONA ADMINISTRACYJNA
|
||||
// JAWNOŚĆCEN — STRONA ADMINISTRACYJNA
|
||||
// ===========================================================
|
||||
|
||||
/**
|
||||
* Rejestruje stronę Jawność Cen w menu Narzędzia wp-admin.
|
||||
* Rejestruje stronę Jawność Cen w menu Narzędzia wp-admin.
|
||||
*/
|
||||
function apartamenty_jawnosc_cen_menu() {
|
||||
add_management_page(
|
||||
'Jawność Cen',
|
||||
'Jawność Cen',
|
||||
'Jawność Cen',
|
||||
'Jawność Cen',
|
||||
'manage_options',
|
||||
'jawnosc-cen',
|
||||
'apartamenty_jawnosc_cen_page'
|
||||
@@ -451,17 +691,17 @@ function apartamenty_jawnosc_cen_menu() {
|
||||
add_action( 'admin_menu', 'apartamenty_jawnosc_cen_menu' );
|
||||
|
||||
/**
|
||||
* Renderuje stronę administracyjną z URL-ami do zgłoszenia.
|
||||
* Renderuje stronę administracyjną z URL-ami do zgłoszenia.
|
||||
*/
|
||||
function apartamenty_jawnosc_cen_page() {
|
||||
$url_ceny = esc_url( home_url( '/ceny-mieszkan.xml' ) );
|
||||
$url_datagov = esc_url( home_url( '/dane-gov-pl.xml' ) );
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1>Jawność Cen — Wyszyńskiego 12</h1>
|
||||
<h1>Jawność Cen — Wyszyńskiego 12</h1>
|
||||
|
||||
<div class="notice notice-info">
|
||||
<p>Dane aktualizowane codziennie przez WP Cron. Zgłoś URL katalogu dane.gov.pl do administratora portalu: <strong>kontakt@dane.gov.pl</strong></p>
|
||||
<p>Dane aktualizowane codziennie przez WP Cron. Zgłoś URL katalogu dane.gov.pl do administratora portalu: <strong>kontakt@dane.gov.pl</strong></p>
|
||||
</div>
|
||||
|
||||
<table class="widefat" style="max-width:800px; margin-top:20px;">
|
||||
@@ -478,15 +718,15 @@ function apartamenty_jawnosc_cen_page() {
|
||||
<td><code><?php echo $url_ceny; ?></code></td>
|
||||
<td>
|
||||
<button class="button" onclick="copyUrl('<?php echo esc_js( $url_ceny ); ?>')">Kopiuj URL</button>
|
||||
<a href="<?php echo $url_ceny; ?>" target="_blank" class="button">Otwórz XML</a>
|
||||
<a href="<?php echo $url_ceny; ?>" target="_blank" class="button">OtwĂłrz XML</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Katalog dane.gov.pl</strong><br><em>(zgłoś Ministerstwu)</em></td>
|
||||
<td><strong>Katalog dane.gov.pl</strong><br><em>(zgłoś Ministerstwu)</em></td>
|
||||
<td><code><?php echo $url_datagov; ?></code></td>
|
||||
<td>
|
||||
<button class="button button-primary" onclick="copyUrl('<?php echo esc_js( $url_datagov ); ?>')">Kopiuj URL</button>
|
||||
<a href="<?php echo $url_datagov; ?>" target="_blank" class="button">Otwórz XML</a>
|
||||
<a href="<?php echo $url_datagov; ?>" target="_blank" class="button">OtwĂłrz XML</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -502,4 +742,4 @@ function apartamenty_jawnosc_cen_page() {
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,11 +50,13 @@ class Elementor_Apartaments extends \Elementor\Widget_Base {
|
||||
protected function render() {
|
||||
$apartaments = new \WP_Query([
|
||||
'post_type' => 'apartamenty',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'order' => 'ASC',
|
||||
'orderby' => [
|
||||
'menu_order' => 'ASC',
|
||||
'title' => 'ASC',
|
||||
],
|
||||
]);
|
||||
|
||||
if ( ! $apartaments->have_posts() ) {
|
||||
echo '<p>Brak apartamentów.</p>';
|
||||
return;
|
||||
@@ -67,6 +69,8 @@ class Elementor_Apartaments extends \Elementor\Widget_Base {
|
||||
$gallery = get_field('gallery');
|
||||
$information = get_field('information');
|
||||
$documents = get_field('documents');
|
||||
$formatted_price = elementor_addon_format_price($information['price'] ?? '');
|
||||
$formatted_price_m2 = elementor_addon_format_price($information['price_m2'] ?? '');
|
||||
?>
|
||||
|
||||
<div class="apartament-card">
|
||||
@@ -133,16 +137,34 @@ class Elementor_Apartaments extends \Elementor\Widget_Base {
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html($information['balcony']); ?> m2</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($information['price'])) : ?>
|
||||
<?php if (!empty($information['loggia']) || !empty($information['logia'])) : ?>
|
||||
<tr>
|
||||
<td class="apartament-card__info_table-title">Cena</td>
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html($information['price']); ?> zł</td>
|
||||
<td class="apartament-card__info_table-title">Loggia:</td>
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html(!empty($information['loggia']) ? $information['loggia'] : $information['logia']); ?> m2</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($information['price_m2'])) : ?>
|
||||
<?php if (!empty($information['taras']) || !empty($information['terrace'])) : ?>
|
||||
<tr>
|
||||
<td class="apartament-card__info_table-title">Taras:</td>
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html(!empty($information['taras']) ? $information['taras'] : $information['terrace']); ?> m2</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($information['ogrodek']) || !empty($information['garden'])) : ?>
|
||||
<tr>
|
||||
<td class="apartament-card__info_table-title">Ogródek:</td>
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html(!empty($information['ogrodek']) ? $information['ogrodek'] : $information['garden']); ?> m2</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($formatted_price)) : ?>
|
||||
<tr>
|
||||
<td class="apartament-card__info_table-title">Cena</td>
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html($formatted_price); ?> zł</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($formatted_price_m2)) : ?>
|
||||
<tr>
|
||||
<td class="apartament-card__info_table-title">Cena m2</td>
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html($information['price_m2']); ?> zł</td>
|
||||
<td class="apartament-card__info_table-value"><?php echo esc_html($formatted_price_m2); ?> zł</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -175,7 +197,7 @@ class Elementor_Apartaments extends \Elementor\Widget_Base {
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($documents)) : ?>
|
||||
<?php if (!empty($documents['image_draft']) || !empty($documents['file'])) : ?>
|
||||
<div class="apartament-card__info_col2">
|
||||
<?php if (!empty($documents['image_draft'])) : ?>
|
||||
<div class="card__info_col2__img">
|
||||
@@ -215,7 +237,7 @@ class Elementor_Apartaments extends \Elementor\Widget_Base {
|
||||
<?php wp_reset_postdata(); ?>
|
||||
</div>
|
||||
|
||||
<?php // Popup historia cen — jeden globalny, wypełniany przez JS ?>
|
||||
<?php // Popup historia cen - jeden globalny, wypełniany przez JS ?>
|
||||
<div class="price-history-overlay" id="price-history-overlay" aria-hidden="true">
|
||||
<div class="price-history-modal" role="dialog" aria-modal="true">
|
||||
<button class="price-history-modal__close" id="price-history-close" aria-label="Zamknij">
|
||||
@@ -244,4 +266,5 @@ class Elementor_Apartaments extends \Elementor\Widget_Base {
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
153
wp-content/plugins/elementor-addon/widgets/parking-spots.php
Normal file
153
wp-content/plugins/elementor-addon/widgets/parking-spots.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Elementor_Parking_Spots extends \Elementor\Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'parking_spots';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Miejsca Postojowe', 'elementor-addon' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'eicon-car';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return [ 'basic' ];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'parking', 'miejsca', 'postojowe', 'garaz' ];
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
$this->start_controls_section(
|
||||
'section_setting',
|
||||
[
|
||||
'label' => esc_html__( 'Settings', 'elementor-addon' ),
|
||||
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
public function get_style_depends() {
|
||||
return [ 'elementor-addon-main-css' ];
|
||||
}
|
||||
|
||||
public function get_script_depends() {
|
||||
return [ 'elementor-addon-main-js' ];
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$group_zwykle = get_field( 'miejsce_postojowe_zwykle', 'option' ) ?: [];
|
||||
$group_rodzinne = get_field( 'miejsce_postojowe_rodzinne', 'option' ) ?: [];
|
||||
|
||||
$parking_types = [
|
||||
'zwykle' => [
|
||||
'label' => 'Miejsce postojowe zwykłe',
|
||||
'price' => $group_zwykle['miejsce_postojowe_zwykle_cena'] ?? '',
|
||||
'price_m2' => $group_zwykle['miejsce_postojowe_zwykle_cena_m2'] ?? '',
|
||||
],
|
||||
'rodzinne' => [
|
||||
'label' => 'Miejsce postojowe rodzinne',
|
||||
'price' => $group_rodzinne['miejsce_postojowe_rodzinne_cena'] ?? '',
|
||||
'price_m2' => $group_rodzinne['miejsce_postojowe_rodzinne_cena_m2'] ?? '',
|
||||
],
|
||||
];
|
||||
?>
|
||||
|
||||
<div class="parking-spots">
|
||||
<?php foreach ( $parking_types as $type => $data ) : ?>
|
||||
<?php $formatted_price = elementor_addon_format_price( $data['price'] ); ?>
|
||||
<div class="parking-spot-card">
|
||||
<div class="parking-spot-card__header">
|
||||
<h3 class="parking-spot-card__title"><?php echo esc_html( $data['label'] ); ?></h3>
|
||||
</div>
|
||||
<?php if ( ! empty( $formatted_price ) ) : ?>
|
||||
<div class="parking-spot-card__price">
|
||||
<?php echo esc_html( $formatted_price ); ?> zł
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="parking-spot-card__history-btn btn-parking-historia-cen"
|
||||
data-parking-type="<?php echo esc_attr( $type ); ?>">
|
||||
HISTORIA CEN
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="7" viewBox="0 0 12 7" fill="none">
|
||||
<g clip-path="url(#clip0_parking_<?php echo esc_attr( $type ); ?>)">
|
||||
<path d="M6 7L0.370835 0.25L11.6292 0.250001L6 7Z" fill="#192C44"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_parking_<?php echo esc_attr( $type ); ?>">
|
||||
<rect width="12" height="7" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Popup historia cen - renderuj tylko jeśli nie ma go w DOM (apartamenty mogą go już mieć)
|
||||
?>
|
||||
<div class="price-history-overlay price-history-overlay--parking-fallback" id="price-history-overlay-parking" aria-hidden="true" style="display:none;">
|
||||
<div class="price-history-modal" role="dialog" aria-modal="true">
|
||||
<button class="price-history-modal__close" id="price-history-close-parking" aria-label="Zamknij">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
|
||||
<path d="M13 1L1 13M1 1L13 13" stroke="#192C44" stroke-width="2" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
<h3 class="price-history-modal__title" id="price-history-title-parking"></h3>
|
||||
<div class="price-history-modal__current">
|
||||
<div class="price-history-modal__row price-history-modal__row--bold">
|
||||
<span>Cena brutto:</span>
|
||||
<span class="price-history-modal__val" id="price-history-price-parking"></span>
|
||||
</div>
|
||||
<div class="price-history-modal__row">
|
||||
<span>Cena m²:</span>
|
||||
<span class="price-history-modal__val" id="price-history-sqm-parking"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="price-history-modal__table-wrap">
|
||||
<table class="price-history-modal__table">
|
||||
<tbody id="price-history-tbody-parking"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
// Jeśli popup apartamentowy istnieje, ukryj fallback parkingowy
|
||||
var mainOverlay = document.getElementById('price-history-overlay');
|
||||
var parkingFallback = document.getElementById('price-history-overlay-parking');
|
||||
if (mainOverlay && parkingFallback) {
|
||||
parkingFallback.remove();
|
||||
} else if (parkingFallback) {
|
||||
parkingFallback.style.display = '';
|
||||
parkingFallback.id = 'price-history-overlay';
|
||||
var closeBtn = parkingFallback.querySelector('#price-history-close-parking');
|
||||
if (closeBtn) closeBtn.id = 'price-history-close';
|
||||
var title = parkingFallback.querySelector('#price-history-title-parking');
|
||||
if (title) title.id = 'price-history-title';
|
||||
var price = parkingFallback.querySelector('#price-history-price-parking');
|
||||
if (price) price.id = 'price-history-price';
|
||||
var sqm = parkingFallback.querySelector('#price-history-sqm-parking');
|
||||
if (sqm) sqm.id = 'price-history-sqm';
|
||||
var tbody = parkingFallback.querySelector('#price-history-tbody-parking');
|
||||
if (tbody) tbody.id = 'price-history-tbody';
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user