Загрузка данных KPI...
@@ -1334,8 +1346,36 @@ document.getElementById('btn-ai-copy').addEventListener('click',()=>{
});
});
+// ═══════════════════ LOGIN ═══════════════════
+const LOGIN_PASSWORD = 'KTdash1';
+
+function handleLogin() {
+ const input = document.getElementById('login-password');
+ const err = document.getElementById('login-error');
+ if (input.value === LOGIN_PASSWORD) {
+ document.getElementById('login-screen').style.display = 'none';
+ document.getElementById('loading-screen').style.display = 'flex';
+ if (sessionStorage) sessionStorage.setItem('kpi_auth', '1');
+ tryAutoLoad();
+ } else {
+ err.textContent = 'Неверный пароль';
+ input.value = '';
+ }
+}
+
+document.getElementById('btn-login').addEventListener('click', handleLogin);
+document.getElementById('login-password').addEventListener('keydown', function(e) {
+ if (e.key === 'Enter') handleLogin();
+});
+
// ═══════════════════ BOOT ═══════════════════
-document.addEventListener('DOMContentLoaded', tryAutoLoad);
+document.addEventListener('DOMContentLoaded', function() {
+ if (sessionStorage && sessionStorage.getItem('kpi_auth') === '1') {
+ document.getElementById('login-screen').style.display = 'none';
+ document.getElementById('loading-screen').style.display = 'flex';
+ tryAutoLoad();
+ }
+});