Files
smartsoltech_site/smartsoltech/static/assets/js/verification_status.js
2025-11-24 07:02:33 +09:00

38 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// verification-status.js
function checkVerificationStatus(serviceRequestId, interval) {
console.log(`Проверка статуса для заявки с ID: ${serviceRequestId}`); // Лог для проверки
fetch(`/service/request_status/${serviceRequestId}/`)
.then(response => {
if (!response.ok) {
throw new Error('Ошибка при проверке статуса заявки');
}
return response.json();
})
.then(data => {
if (data.is_verified) {
// Закрываем форму и показываем окно подтверждения
const serviceModal = document.getElementById('serviceModal');
const confirmationModal = document.getElementById('confirmationModal');
if (serviceModal) {
serviceModal.style.display = 'none';
}
if (confirmationModal) {
confirmationModal.style.display = 'block';
}
// Останавливаем интервал проверки статуса
clearInterval(interval);
}
})
.catch(error => {
console.error('Ошибка при проверке статуса заявки:', error);
});
}
// Делаем функцию доступной глобально
window.checkVerificationStatus = checkVerificationStatus;