This commit is contained in:
2026-04-20 14:39:59 +03:00
parent 1388a5fd6b
commit 3bf1598927
5 changed files with 3235 additions and 1275 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -612,8 +612,8 @@
return;
}
const readyPlayers = {{ players|selectattr('is_ready')|list|length }};
const totalPlayers = {{ players|length }};
const readyPlayers = document.querySelectorAll('.player-ready.ready').length;
const totalPlayers = document.querySelectorAll('.player-item').length;
if (totalPlayers < 2) {
showNotification('❌ Нужно минимум 2 игрока для начала игры', 'error');
@@ -626,6 +626,8 @@
}
}
showNotification('🔄 Запуск игры...', 'info');
fetch('/room/{{ room.code }}/start', {
method: 'POST',
headers: {
@@ -633,7 +635,12 @@
'X-CSRFToken': '{{ csrf_token() if csrf_token else "" }}'
}
})
.then(response => response.json())
.then(response => {
if (!response.ok) {
return response.json().then(err => Promise.reject(err));
}
return response.json();
})
.then(data => {
if (data.success) {
showNotification('✅ Игра начинается!', 'success');
@@ -647,8 +654,8 @@
}
})
.catch(error => {
console.error('Error:', error);
showNotification('❌ Ошибка при запуске игры', 'error');
console.error('Error starting game:', error);
showNotification('❌ Ошибка при запуске игры: ' + (error.error || error.message || 'Неизвестная ошибка'), 'error');
});
}