From f50f53d04b2c1f28be9e0ff336db7a259977ae71 Mon Sep 17 00:00:00 2001 From: Dauren777 Date: Thu, 4 Jun 2026 06:56:54 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=D1=8E=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=20=D0=B1=D0=B5?= =?UTF-8?q?=D0=B7=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA=D0=B0=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D0=9C=D0=BE=D0=B9=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8?= =?UTF-8?q?=D0=BA,=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D1=83=201/=D0=BC=D0=B5?= =?UTF-8?q?=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.html | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app.html b/app.html index a8a38f2..cdb1e90 100644 --- a/app.html +++ b/app.html @@ -150,7 +150,7 @@ function printConfirm(){if(!lastSubmitted)return;var e=lastSubmitted;var w=windo function checkSA(){if(!U||isA()){document.getElementById("sa").classList.remove("sh","dg");return}var q=getUserQuota(U);if(!q.p)return;var p=gp(q.p);var done=getA().filter(function(a){return a.createdBy===U.login&&new Date(a.date)>=p.s}).length;var need=Math.max(0,q.c-done);var sa=document.getElementById("sa"),at=document.getElementById("sat");sa.classList.remove("sh","dg");if(need>0){at.textContent="⚠️ Отставание ("+p.l+"): "+done+" из "+q.c+". Осталось: "+need;sa.classList.add("sh");if(need>=q.c)sa.classList.add("dg")}} function sendScheduleReminder(){if(!U)return;var q=getUserQuota(U);var p=gp(q.p);var done=getA().filter(function(a){return a.createdBy===U.login&&new Date(a.date)>=p.s}).length;var need=Math.max(0,q.c-done);var to=U.email||"";if(!to||to.indexOf("@")<0){alert("Нет email");return}location.href="mailto:"+encodeURIComponent(to)+"?subject="+encodeURIComponent("График ПАБ — "+p.l)+"&body="+encodeURIComponent("График: "+q.l+"\nПериод: "+p.l+"\nВыполнено: "+done+" из "+q.c+(need>0?"\nОтставание: "+need:"\nГрафик выполнен!"))} -function rMS(){var c=document.getElementById("msc");if(!c)return;document.getElementById("sa").classList.remove("sh","dg");var q=getUserQuota(U);if(q.c===0){var allDone=getA().filter(function(a){return a.createdBy===U.login});var totalDone=allDone.length;c.innerHTML="

📅 Без обязательного графика

Должность: "+U.role+" | Проведено ПАБ: "+totalDone+"
Всего проведено аудитов за всё время: "+totalDone+"
"+(totalDone>0?"

📋 Последние:

"+allDone.slice(0,10).map(function(a){return"
"+a.date+" — "+a.location+" — "+(a.overallSafe?"Безопасно":"Нарушений: "+a.totalViolations)+"
"}).join("")+"
":"")+"
👤 "+U.name+" — "+U.role+"
"+(U.branch||"—")+" | "+(U.dept||"—")+" | "+(U.region||"—")+" | "+(U.city||"—")+" | "+U.email+"
";return}var p=gp(q.p);var done=getA().filter(function(a){return a.createdBy===U.login&&new Date(a.date)>=p.s}).length;var pct=Math.round(done/q.c*100);var over=pct>100;var cl=over?"#00B4D8":pct>=100?"#2D6A4F":pct>=50?"#E76F51":"#E63946";var barW=Math.min(pct,200);var need=Math.max(0,q.c-done);var extra=done-q.c;c.innerHTML="

📅 "+p.l+"

Минимум: "+q.l+" | "+U.role+"
Проведено: "+done+" (мин: "+q.c+")"+(over?" — ✅ перевыполнено на +"+extra+"!":done>=q.c?" — ✅ план выполнен!":" — осталось: "+need+"")+"
"+(need>0?"
":"")+"
👤 "+U.name+" — "+U.role+"
"+(U.branch||"—")+" | "+(U.dept||"—")+" | "+(U.region||"—")+" | "+(U.city||"—")+" | "+U.email+"
"+(done>0?"

📋 Проведённые:

"+getA().filter(function(a){return a.createdBy===U.login}).slice(0,10).map(function(a){return"
"+a.date+" — "+a.location+" — "+(a.overallSafe?"Безопасно":"Нарушений: "+a.totalViolations)+"
"}).join("")+"
":"")} +function rMS(){var c=document.getElementById("msc");if(!c)return;document.getElementById("sa").classList.remove("sh","dg");var q=getUserQuota(U);if(q.c===0)q={c:1,p:"month",l:"1 раз в месяц"};var p=gp(q.p);var done=getA().filter(function(a){return a.createdBy===U.login&&new Date(a.date)>=p.s}).length;var pct=Math.round(done/q.c*100);var over=pct>100;var cl=over?"#00B4D8":pct>=100?"#2D6A4F":pct>=50?"#E76F51":"#E63946";var barW=Math.min(pct,200);var need=Math.max(0,q.c-done);var extra=done-q.c;c.innerHTML="

📅 "+p.l+"

Минимум: "+q.l+" | "+U.role+"
Проведено: "+done+" (мин: "+q.c+")"+(over?" — ✅ перевыполнено на +"+extra+"!":done>=q.c?" — ✅ план выполнен!":" — осталось: "+need+"")+"
"+(need>0?"
":"")+"
👤 "+U.name+" — "+U.role+"
"+(U.branch||"—")+" | "+(U.dept||"—")+" | "+(U.region||"—")+" | "+(U.city||"—")+" | "+U.email+"
"+(done>0?"

📋 Проведённые:

"+getA().filter(function(a){return a.createdBy===U.login}).slice(0,10).map(function(a){return"
"+a.date+" — "+a.location+" — "+(a.overallSafe?"Безопасно":"Нарушений: "+a.totalViolations)+"
"}).join("")+"
":"")} function rDB(){var c=document.getElementById("dbc");if(!c)return;var audits=getA();var all=allU();var total=audits.length,allSafe=audits.filter(function(a){return a.overallSafe}).length,wd=audits.filter(function(a){return !a.overallSafe}).length,tv=audits.reduce(function(s,a){return s+(a.totalViolations||0)},0);var ul=[];for(var k in all)if(k!=="admin")ul.push({login:k,role:all[k].role});var ot=0,bh=0,ov=0;ul.forEach(function(u){var q=getUserQuota(u);if(!q.p)return;var p=gp(q.p);var done=getA().filter(function(a){return a.createdBy===u.login&&new Date(a.date)>=p.s}).length;if(done>q.c)ov++;else if(done>=q.c)ot++;else bh++});var sp=total>0?(allSafe/total*100):50,dp=total>0?(wd/total*100):50;c.innerHTML=(isA()?"
|
":"")+"
Всего аудитов
"+total+"
Безопасно
"+allSafe+"
С нарушениями
"+wd+"
Нарушений
"+tv+"
Перевыполняют
"+ov+"
Выполняют
"+ot+"
Отстают
"+bh+"

🟢🔴 Соотношение

Безопасные: "+allSafe+"С нарушениями: "+wd+"

📂 По категориям

📅 По датам

🔝 Топ-10

";setTimeout(function(){for(var ck in charts)try{charts[ck].destroy()}catch(e){}charts={};var ctx1=document.getElementById("ch1");if(ctx1)charts.cat=new Chart(ctx1,{type:"bar",data:{labels:CATS.map(function(c){return c.title.split(". ")[1]}),datasets:[{label:"Нарушений",data:CATS.map(function(cat){return audits.reduce(function(s,a){var c=a.categories&&a.categories[cat.id];return s+(c?c.items.length:0)},0)}),backgroundColor:"#E63946",borderRadius:6}]},options:{responsive:true,plugins:{legend:{display:false}},scales:{y:{beginAtZero:true,ticks:{stepSize:1}}}}});var dates={};audits.forEach(function(a){if(!dates[a.date])dates[a.date]=0;dates[a.date]+=(a.totalViolations||0)});var sd=Object.keys(dates).sort();var ctx2=document.getElementById("ch2");if(ctx2)charts.tl=new Chart(ctx2,{type:"line",data:{labels:sd,datasets:[{label:"Нарушений",data:sd.map(function(d){return dates[d]}),borderColor:"#E63946",backgroundColor:"rgba(230,57,70,0.08)",fill:true,tension:0.3,pointRadius:5}]},options:{responsive:true,plugins:{legend:{display:false}},scales:{y:{beginAtZero:true,ticks:{stepSize:1}}}}});var ic={};audits.forEach(function(a){if(a.categories){Object.values(a.categories).forEach(function(cat){if(cat.items)cat.items.forEach(function(it){ic[it.item]=(ic[it.item]||0)+1})})}});var ti=Object.entries(ic).sort(function(a,b){return b[1]-a[1]}).slice(0,10);var ctx3=document.getElementById("ch3");if(ctx3)charts.top=new Chart(ctx3,{type:"bar",data:{labels:ti.map(function(i){return i[0].length>30?i[0].slice(0,30)+"...":i[0]}),datasets:[{label:"Раз",data:ti.map(function(i){return i[1]}),backgroundColor:["#E63946","#E76F51","#F4A261","#E9C46A","#2A9D8F","#264653","#00B4D8","#0077B6","#023E8A","#6C757D"],borderRadius:4}]},options:{indexAxis:"y",responsive:true,plugins:{legend:{display:false}},scales:{x:{beginAtZero:true,ticks:{stepSize:1}}}}})},300)} diff --git a/index.html b/index.html index 7bd7478..a145772 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ document.getElementById('tR').onclick=function(){document.getElementById('loginF document.getElementById('lb').onclick=function(){ var u=document.getElementById('lu').value.trim().toLowerCase(); var p=document.getElementById('lp').value.trim(); - if(u==='admin'&&p==='admin'){sessionStorage.setItem('pab_user',JSON.stringify({login:'admin',name:'Администратор',role:'Руководитель',freq:'0,month',email:'admin@telecom.kz',branch:'АО «Казахтелеком»',dept:'ЦА',region:'Центральный',oblast:'—',city:'г. Астана'}));location.href='app.html';return} + if(u==='admin'&&p==='admin'){sessionStorage.setItem('pab_user',JSON.stringify({login:'admin',name:'Администратор',role:'Руководитель',freq:'1,month',email:'admin@telecom.kz',branch:'АО «Казахтелеком»',dept:'ЦА',region:'Центральный',oblast:'—',city:'г. Астана'}));location.href='app.html';return} var users={};try{users=JSON.parse(localStorage.getItem('pab_users')||'{}')}catch(e){}if(users[u]&&users[u].pass===p){sessionStorage.setItem('pab_user',JSON.stringify({login:u,name:users[u].name,role:users[u].role,freq:users[u].freq||'',email:users[u].email||'',branch:users[u].branch||'',dept:users[u].dept||'',region:users[u].region||'',oblast:users[u].oblast||'',city:users[u].city||''}));location.href='app.html';return} document.getElementById('lerr').style.display='block' };