Files
smartsoltech_site/smartsoltech/static/assets/js/modern-scripts.js
Andrey K. Choi 76c326083f Implement QR-code service request system with Telegram bot integration
🎯 Key Features:
- Added QR-code generation for service requests in modal window
- Integrated real-time verification via Telegram bot
- Implemented animated success confirmation
- Added status polling for request verification

�� Technical Changes:
- Fixed JavaScript syntax errors in modern-scripts.js
- Enhanced services_modern.html with QR-code section and success animation
- Added check_request_status API endpoint
- Improved CSS with success checkmark animations

🎨 UX Improvements:
- Centered QR-code display with proper styling
- Real-time status checking every 3 seconds
- Animated success confirmation only after Telegram verification
- Auto-close modal after successful confirmation

📱 Workflow:
1. User fills service request form
2. QR-code generated and displayed
3. User scans QR/clicks Telegram link
4. System polls for verification status
5. Success animation shows after Telegram confirmation
6. Modal auto-closes with notification

This completes the modern service request system with Telegram bot integration.
2025-11-23 22:16:52 +09:00

108 lines
3.8 KiB
JavaScript

// Modern Scripts for SmartSolTech Website
document.addEventListener('DOMContentLoaded', function() {
console.log('SmartSolTech: DOM loaded, initializing...');
// Hide loading screen
const loadingScreen = document.getElementById('loading-screen');
if (loadingScreen) {
console.log('SmartSolTech: Loading screen found, hiding...');
setTimeout(() => {
loadingScreen.style.opacity = '0';
loadingScreen.style.pointerEvents = 'none';
setTimeout(() => {
loadingScreen.style.display = 'none';
loadingScreen.remove(); // Полностью удаляем элемент
console.log('SmartSolTech: Loading screen removed');
}, 300);
}, 500); // Уменьшили время ожидания
} else {
console.log('SmartSolTech: Loading screen not found');
}
// Theme Toggle Functionality
const themeToggle = document.getElementById('theme-toggle');
const html = document.documentElement;
if (themeToggle) {
// Check for saved theme preference
const currentTheme = localStorage.getItem('theme') || 'light';
html.setAttribute('data-theme', currentTheme);
updateThemeIcon(currentTheme);
themeToggle.addEventListener('click', function() {
const currentTheme = html.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
html.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
updateThemeIcon(newTheme);
// Add animation
this.style.transform = 'scale(0.8)';
setTimeout(() => {
this.style.transform = 'scale(1)';
}, 150);
});
}
function updateThemeIcon(theme) {
if (!themeToggle) return;
const icon = themeToggle.querySelector('i');
if (icon) {
if (theme === 'dark') {
icon.className = 'fas fa-sun';
themeToggle.setAttribute('aria-label', 'Переключить на светлую тему');
} else {
icon.className = 'fas fa-moon';
themeToggle.setAttribute('aria-label', 'Переключить на темную тему');
}
}
}
// Navbar scroll behavior
const navbar = document.querySelector('.navbar-modern');
if (navbar) {
window.addEventListener('scroll', function() {
if (window.scrollY > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
});
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
const target = document.querySelector(this.getAttribute('href'));
if (target) {
e.preventDefault();
target.scrollIntoView({
behavior: 'smooth'
});
}
});
});
// Intersection Observer for animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// Observe cards and service items
document.querySelectorAll('.card-modern, .service-card, .step-card').forEach(card => {
observer.observe(card);
});
console.log('SmartSolTech: All scripts loaded successfully');
});