Товар "Мокасини жіночі бежеві Меланія Бавовна" додано в корзину!

Ваше замовлення

← Повернутись до покупок
Мокасини жіночі бежеві Меланія Бавовна
Мокасини жіночі бежеві Меланія Бавовна
Розмір: 36
558 грн
Артикул: 85001
558 грн
💡 Замовте 2 пари різного або однакового взуття і отримайте знижку 20%!
Сума без знижки: 558 грн
Загальна сума: 558 грн

Оформлення замовлення

Вартість товарів: 558 грн
Доставка: Безкоштовно
Комісія: 0 грн
До сплати: 558 грн
← Повернутись до покупок

Зв'язатися з нами

Оберіть зручний для вас спосіб спілкування

} // Слухаємо введення в поле відділення const postalInput = document.getElementById('postal'); if (postalInput) { postalInput.removeEventListener('input', this.postalInputHandler); postalInput.removeEventListener('focus', this.postalFocusHandler); this.postalInputHandler = (e) => { if (this.isNovaPoshtaSelected() && this.selectedCityRef) { this.searchWarehouses(e.target.value); } }; this.postalFocusHandler = () => { if (this.isNovaPoshtaSelected() && this.selectedCityRef) { postalInput.placeholder = 'Введіть номер відділення (наприклад 5)...'; } }; postalInput.addEventListener('input', this.postalInputHandler); postalInput.addEventListener('focus', this.postalFocusHandler); } // Закриваємо дропдауни при кліку поза ними if (!this.documentClickHandler) { this.documentClickHandler = (e) => { if (!e.target.closest('.autocomplete-container')) { this.hideAllDropdowns(); } }; document.addEventListener('click', this.documentClickHandler); } } createDropdowns() { // Створюємо контейнер для міст const cityInput = document.getElementById('city'); if (cityInput && !cityInput.parentNode.querySelector('.autocomplete-dropdown')) { cityInput.parentNode.style.position = 'relative'; cityInput.parentNode.classList.add('autocomplete-container'); const cityDropdown = document.createElement('div'); cityDropdown.className = 'autocomplete-dropdown city-dropdown'; cityDropdown.style.display = 'none'; cityInput.parentNode.appendChild(cityDropdown); } // Створюємо контейнер для відділень const postalInput = document.getElementById('postal'); if (postalInput && !postalInput.parentNode.querySelector('.autocomplete-dropdown')) { postalInput.parentNode.style.position = 'relative'; postalInput.parentNode.classList.add('autocomplete-container'); const warehouseDropdown = document.createElement('div'); warehouseDropdown.className = 'autocomplete-dropdown warehouse-dropdown'; warehouseDropdown.style.display = 'none'; postalInput.parentNode.appendChild(warehouseDropdown); } } onDeliveryServiceChange() { const cityInput = document.getElementById('city'); const postalInput = document.getElementById('postal'); console.log('Delivery service changed to:', this.isNovaPoshtaSelected() ? 'Nova Poshta' : 'Other'); if (this.isNovaPoshtaSelected()) { // Активуємо автокомпліт для Нової Пошти cityInput.placeholder = 'Почніть вводити назву міста...'; // Перевіряємо збережені refs після зміни служби const savedCityRef = document.getElementById('city_ref').value; const savedWarehouseRef = document.getElementById('warehouse_ref').value; if (savedCityRef && savedCityRef !== '') { // Якщо є збережений city_ref - встановлюємо його this.selectedCityRef = savedCityRef; postalInput.placeholder = 'Введіть номер відділення...'; postalInput.readOnly = false; console.log('Restored city ref after delivery change:', savedCityRef); if (savedWarehouseRef && savedWarehouseRef !== '') { // Якщо є збережений warehouse_ref - встановлюємо його this.selectedWarehouseRef = savedWarehouseRef; console.log('Restored warehouse ref after delivery change:', savedWarehouseRef); } } else { // Якщо немає збережених refs postalInput.placeholder = 'Спочатку оберіть місто'; postalInput.readOnly = true; this.selectedCityRef = null; this.selectedWarehouseRef = null; document.getElementById('city_ref').value = ''; document.getElementById('warehouse_ref').value = ''; } } else { // Для інших служб - звичайні поля cityInput.placeholder = 'Введіть назву міста'; postalInput.placeholder = '№ відділення або поштовий індекс'; postalInput.readOnly = false; this.hideAllDropdowns(); // Очищуємо дані Нової Пошти this.selectedCityRef = null; this.selectedWarehouseRef = null; document.getElementById('city_ref').value = ''; document.getElementById('warehouse_ref').value = ''; } } onCityInput(query) { clearTimeout(this.searchTimeout); if (query.length < 2 || !this.isNovaPoshtaSelected()) { this.hideCityDropdown(); return; } console.log('Searching cities for:', query); this.searchTimeout = setTimeout(() => { this.searchCities(query); }, 500); } async searchCities(query) { try { this.showCityLoading(); const response = await fetch('/admin/api/nova_poshta/cities_db.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ query: query }) }); const data = await response.json(); console.log('Cities API response:', data.success ? `${data.cities.length} cities found` : data.error); if (data.success) { this.displayCities(data.cities); } else { this.showCityError(data.error || 'Помилка пошуку'); } } catch (error) { console.error('Помилка пошуку міст:', error); this.showCityError('Помилка з\'єднання'); } } displayCities(cities) { const dropdown = document.querySelector('.city-dropdown'); if (!dropdown) return; if (cities.length === 0) { this.hideCityDropdown(); return; } dropdown.innerHTML = cities.map(city => `
${city.description}
${city.area_description || ''}
`).join(''); dropdown.querySelectorAll('.autocomplete-item[data-ref]').forEach(item => { item.addEventListener('click', () => { this.selectCity(item.dataset.ref, item.dataset.name); }); }); this.showCityDropdown(); } selectCity(cityRef, cityName) { console.log('City selected:', cityName, 'ref:', cityRef); this.selectedCityRef = cityRef; const cityInput = document.getElementById('city'); cityInput.value = cityName; document.getElementById('city_ref').value = cityRef; const postalInput = document.getElementById('postal'); postalInput.value = ''; postalInput.placeholder = 'Введіть номер відділення...'; postalInput.readOnly = false; this.selectedWarehouseRef = null; document.getElementById('warehouse_ref').value = ''; this.hideCityDropdown(); this.hideWarehouseDropdown(); console.log('Hidden field city_ref updated:', cityRef); } async searchWarehouses(query) { clearTimeout(this.searchTimeout); if (!query || query.length < 1) { this.hideWarehouseDropdown(); return; } console.log('Searching warehouses for:', query); this.searchTimeout = setTimeout(async () => { try { this.showWarehouseLoading(); const response = await fetch('/admin/api/nova_poshta/warehouses_db.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ city_ref: this.selectedCityRef, search_number: query }) }); const data = await response.json(); console.log('Warehouses API response:', data.success ? `${data.warehouses.length} warehouses found` : data.error); if (data.success) { this.displayWarehouses(data.warehouses); } else { this.showWarehouseError(data.error || 'Помилка пошуку'); } } catch (error) { console.error('Помилка пошуку відділень:', error); this.showWarehouseError('Помилка з\'єднання'); } }, 500); } displayWarehouses(warehouses) { const dropdown = document.querySelector('.warehouse-dropdown'); if (!dropdown) return; if (warehouses.length === 0) { this.hideWarehouseDropdown(); return; } dropdown.innerHTML = warehouses.map(warehouse => `
№${warehouse.number}
${warehouse.short_address || warehouse.address}
`).join(''); dropdown.querySelectorAll('.autocomplete-item[data-ref]').forEach(item => { item.addEventListener('click', () => { this.selectWarehouse(item.dataset.ref, item.dataset.number); }); }); this.showWarehouseDropdown(); } selectWarehouse(warehouseRef, warehouseNumber) { console.log('Warehouse selected:', warehouseNumber, 'ref:', warehouseRef); this.selectedWarehouseRef = warehouseRef; const postalInput = document.getElementById('postal'); postalInput.value = warehouseNumber; document.getElementById('warehouse_ref').value = warehouseRef; this.hideWarehouseDropdown(); console.log('Hidden field warehouse_ref updated:', warehouseRef); } // Методи для показу/приховування дропдаунів showCityDropdown() { const dropdown = document.querySelector('.city-dropdown'); if (dropdown) dropdown.style.display = 'block'; } hideCityDropdown() { const dropdown = document.querySelector('.city-dropdown'); if (dropdown) dropdown.style.display = 'none'; } showWarehouseDropdown() { const dropdown = document.querySelector('.warehouse-dropdown'); if (dropdown) dropdown.style.display = 'block'; } hideWarehouseDropdown() { const dropdown = document.querySelector('.warehouse-dropdown'); if (dropdown) dropdown.style.display = 'none'; } hideAllDropdowns() { this.hideCityDropdown(); this.hideWarehouseDropdown(); } // Методи для показу завантаження showCityLoading() { const dropdown = document.querySelector('.city-dropdown'); if (dropdown) { dropdown.innerHTML = '
Пошук міст...
'; dropdown.style.display = 'block'; } } showWarehouseLoading() { const dropdown = document.querySelector('.warehouse-dropdown'); if (dropdown) { dropdown.innerHTML = '
Пошук відділень...
'; dropdown.style.display = 'block'; } } // Методи для показу помилок showCityError(message) { const dropdown = document.querySelector('.city-dropdown'); if (dropdown) { dropdown.innerHTML = `
${message}
`; dropdown.style.display = 'block'; } } showWarehouseError(message) { const dropdown = document.querySelector('.warehouse-dropdown'); if (dropdown) { dropdown.innerHTML = `
${message}
`; dropdown.style.display = 'block'; } } } // Rozetka Autocomplete Script class RozetkaAutocomplete { constructor() { this.selectedCityRef = null; this.selectedWarehouseRef = null; this.searchTimeout = null; this.initialized = false; this.init(); } init() { if (this.initialized) { console.log('Rozetka autocomplete already initialized'); return; } this.initialized = true; this.setupEventListeners(); this.createDropdowns(); // Синхронізуємо з уже заповненими refs при завантаженні this.syncWithExistingRefs(); console.log('Rozetka autocomplete initialized successfully'); } // Синхронізація з існуючими refs syncWithExistingRefs() { const savedCityRef = document.getElementById('rozetka_city_ref').value; const savedWarehouseRef = document.getElementById('rozetka_warehouse_ref').value; const isRozetkaSelected = this.isRozetkaSelected(); console.log('Syncing Rozetka with existing refs:'); console.log('- Rozetka selected:', isRozetkaSelected); console.log('- Saved rozetka_city_ref:', savedCityRef); console.log('- Saved rozetka_warehouse_ref:', savedWarehouseRef); if (isRozetkaSelected) { // Якщо Rozetka вибрана і є збережені refs if (savedCityRef && savedCityRef !== '') { this.selectedCityRef = savedCityRef; console.log('✓ Rozetka City ref synchronized:', savedCityRef); // Активуємо поле відділення const postalInput = document.getElementById('postal'); postalInput.placeholder = 'Введіть вулицю для пошуку відділення...'; postalInput.readOnly = false; if (savedWarehouseRef && savedWarehouseRef !== '') { this.selectedWarehouseRef = savedWarehouseRef; console.log('✓ Rozetka Warehouse ref synchronized:', savedWarehouseRef); } } // Встановлюємо правильні placeholder'и для Rozetka const cityInput = document.getElementById('city'); cityInput.placeholder = 'Почніть вводити назву міста...'; if (!this.selectedCityRef) { const postalInput = document.getElementById('postal'); postalInput.placeholder = 'Спочатку оберіть місто'; postalInput.readOnly = true; } } } isRozetkaSelected() { const selectedService = document.querySelector('input[name="delivery"]:checked')?.value; return selectedService === 'rozetka'; } setupEventListeners() { // Слухаємо зміну служби доставки document.querySelectorAll('input[name="delivery"]').forEach(radio => { radio.removeEventListener('change', this.deliveryChangeHandler); this.deliveryChangeHandler = () => this.onDeliveryServiceChange(); radio.addEventListener('change', this.deliveryChangeHandler); }); // Слухаємо введення в поле міста const cityInput = document.getElementById('city'); if (cityInput) { cityInput.removeEventListener('input', this.cityInputHandler); cityInput.removeEventListener('focus', this.cityFocusHandler); this.cityInputHandler = (e) => this.onCityInput(e.target.value); this.cityFocusHandler = () => { if (cityInput.value.length >= 2 && this.isRozetkaSelected()) { this.onCityInput(cityInput.value); } };