Eczane

0 işletme
0 kampanya
0 gönderi
Şehir
İlçe

İşletme Bulunamadı

Bu kategoriye ait işletme bulunmamaktadır.

Kampanya Bulunamadı

Bu kategoriye ait aktif kampanya bulunmamaktadır.

Gönderi Bulunamadı

Bu kategoriye ait gönderi bulunmamaktadır.

// Tab Switching function switchTab(tabName) { document.querySelectorAll('.tab-content').forEach(tab => { tab.classList.remove('active'); }); document.querySelectorAll('.tab-btn').forEach(btn => { btn.classList.remove('active'); }); document.getElementById(tabName).classList.add('active'); event.target.closest('.tab-btn').classList.add('active'); window.history.replaceState(null, null, '?id=91&tab=' + tabName + getFilterParams()); } let isInitialLoad = true; // Districts Loading function updateDistricts(selectedDistrictId = null, autoApply = false) { const cityId = document.getElementById('citySelect').value; const districtSelect = document.getElementById('districtSelect'); const currentDistrictId = selectedDistrictId || ''; districtSelect.innerHTML = ''; if (!cityId) { // İl seçimi kaldırıldığında filtreleri uygula (sadece kullanıcı değişikliği yaptıysa) if (autoApply && !isInitialLoad) { applyFilters(); } return; } fetch(`php/user-actions.php?action=get_districts&city_id=${cityId}`) .then(r => r.json()) .then(data => { if (Array.isArray(data) && data.length > 0) { data.forEach(district => { const option = document.createElement('option'); option.value = district.id; option.textContent = district.name || district.NAME; // Seçili ilçeyi geri ekle if (currentDistrictId && district.id == currentDistrictId) { option.selected = true; } districtSelect.appendChild(option); }); } // İl seçildiğinde otomatik olarak filtreleri uygula (ilçe seçimi zorunlu değil) // Sadece kullanıcı değişikliği yaptıysa (sayfa ilk yüklenirken değil) if (autoApply && !isInitialLoad) { applyFilters(); } }) .catch(err => console.error('Error loading districts:', err)); } // Apply Filters function applyFilters() { const cityId = document.getElementById('citySelect').value; const districtId = document.getElementById('districtSelect').value; let url = '?id=91'; if (cityId) url += '&city=' + cityId; if (districtId) url += '&district=' + districtId; // Sayfayı yenile window.location.href = url; } // District değişirse apply et document.getElementById('districtSelect').addEventListener('change', function () { applyFilters(); }); // Clear Filters function clearFilters() { document.getElementById('citySelect').value = ''; document.getElementById('districtSelect').innerHTML = ''; window.location.href = '?id=91'; } // Get Filter Params function getFilterParams() { const cityId = document.getElementById('citySelect').value; const districtId = document.getElementById('districtSelect').value; let params = ''; if (cityId) params += '&city=' + cityId; if (districtId) params += '&district=' + districtId; return params; } // Toggle Category Follow function toggleCategoryFollow(categoryId) { const isLoggedIn = false; if (!isLoggedIn) { window.location.href = 'login.php'; return; } const formData = new FormData(); formData.append('action', 'toggle_category_follow'); formData.append('category_id', categoryId); fetch('php/user-actions.php', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { const btn = document.querySelector('.follow-btn'); const text = document.getElementById('follow-text'); const count = document.getElementById('followers-count'); btn.classList.toggle('following'); text.textContent = data.following ? 'Takip Ediliyor' : 'Takip Et'; count.textContent = data.followers_count; showToast(data.message, 'success'); } else { showToast(data.message || 'Bir hata oluştu', 'error'); } }) .catch(error => { console.error('Error:', error); showToast('Bir hata oluştu. Lütfen tekrar deneyiniz.', 'error'); }); } // Show Toast function showToast(message, type = 'success') { const toast = document.createElement('div'); toast.className = `toast ${type}`; toast.innerHTML = ` ${message} `; document.getElementById('toastContainer').appendChild(toast); setTimeout(() => { toast.style.animation = 'slideOut 0.3s ease forwards'; setTimeout(() => toast.remove(), 300); }, 3000); } // Initialize document.addEventListener('DOMContentLoaded', function () { const cityId = ''; const districtId = ''; // İlçeleri yükle if (cityId) { updateDistricts(districtId, false); // İlk yüklemede otomatik arama yapma } // İlk yükleme tamamlandı setTimeout(() => { isInitialLoad = false; }, 100); // Subcategories carousel smooth scroll const carousel = document.getElementById('subcategoriesCarousel'); if (carousel) { let isDown = false; let startX; let scrollLeft; carousel.addEventListener('mousedown', (e) => { isDown = true; startX = e.pageX - carousel.offsetLeft; scrollLeft = carousel.scrollLeft; }); carousel.addEventListener('mouseleave', () => { isDown = false; }); carousel.addEventListener('mouseup', () => { isDown = false; }); carousel.addEventListener('mousemove', (e) => { if (!isDown) return; e.preventDefault(); const x = e.pageX - carousel.offsetLeft; const walk = (x - startX) * 1; carousel.scrollLeft = scrollLeft - walk; }); } });