Крупное подтверждение отправки с анимацией

This commit is contained in:
Dauren777 2026-06-04 09:44:43 +00:00
parent 7dd7928852
commit 1c6c7e8d17

View File

@ -52,7 +52,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s
.vg.hr{font-size:11px;font-weight:700;color:var(--g5);text-transform:uppercase;margin-bottom:4px}
.vg input,.vg select{padding:7px 8px;border:1px solid var(--g2);border-radius:var(--r);font-size:12px;font-family:inherit;outline:none;width:100%}.vg input:focus,.vg select:focus{border-color:var(--cyan)}
.vrn{font-size:12px;font-weight:700;color:var(--g5);text-align:center;padding-top:8px}.rvb{background:0;border:none;color:var(--red);cursor:pointer;font-size:18px;padding:4px}
.fa2{display:flex;gap:10px;margin-top:20px}.fs{background:#EDF7F0;border:1px solid var(--green);border-radius:var(--r);padding:16px 20px;color:var(--green);font-weight:600;margin-top:14px;display:none}
.fa2{display:flex;gap:10px;margin-top:20px}.fs{background:#EDF7F0;border:2px solid var(--green);border-radius:var(--r);padding:24px 28px;color:var(--green);font-weight:600;margin-top:14px;display:none;animation:fadeIn .3s ease;text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}
.sg{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}.sc{background:var(--white);border-radius:var(--rl);padding:20px;box-shadow:var(--sh)}
.sc .sl{font-size:12px;font-weight:700;color:var(--g5);text-transform:uppercase;margin-bottom:4px}.sc .sv{font-size:32px;font-weight:800;line-height:1}
.gr .sv{color:var(--green)}.rd .sv{color:var(--red)}.bl .sv{color:var(--cyan)}.or .sv{color:var(--orange)}
@ -89,7 +89,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s
<div class="vb"><h3>📄 Несоответствия и меры</h3><div class="vg hr" style="display:grid"><span></span><span>Несоответствие</span><span>Исполнитель</span><span>Вид</span><span>Меры</span><span>Ответственный</span><span>Дата</span><span>Завершение</span><span></span></div><div id="vr"></div><button class="btn bo bs" onclick="addVio()" style="margin-top:8px">+ Добавить</button></div>
<div class="vb"><h3>💬 Итог диалога</h3><p style="font-size:12px;color:var(--g5);margin-bottom:14px">Результаты беседы</p><div class="cl2 c1"><div class="ci"><input type="checkbox" id="d0"><div><label for="d0">Работник привёл примеры безопасных действий</label></div></div><div class="ci"><input type="checkbox" id="d1"><div><label for="d1">Были обсуждены риски / проблемы</label></div></div><div class="ci"><input type="checkbox" id="d2"><div><label for="d2">Определены корректирующие меры</label></div></div><div class="ci"><input type="checkbox" id="d3"><div><label for="d3">Предложения работника зафиксированы</label></div></div><div class="ci"><input type="checkbox" id="d4"><div><label for="d4">Другое</label><input class="oi" id="do" placeholder="Укажите..."></div></div></div><div style="margin-top:14px;padding:12px;background:var(--g1);border-radius:var(--r);font-size:12px;color:var(--g5)">📎 Фото и документы — приложите к бумажному бланку.</div></div>
<div class="fa2"><button class="btn bp" onclick="submitAudit()">💾 Сохранить</button><button class="btn bo" onclick="resetF()">🗑️ Очистить</button></div>
<div class="fs" id="fs"><div style="font-size:18px;margin-bottom:8px">✅ Аудит сохранён!</div><div id="sd" style="font-size:13px;color:var(--ink);margin-bottom:14px"></div><div style="display:flex;gap:10px;flex-wrap:wrap"><button class="btn bp bs" onclick="sendEmailConfirm()">✉️ На email</button><button class="btn bo bs" onclick="printConfirm()">🖨️ Печать</button></div></div>
<div class="fs" id="fs"><div style="font-size:28px;margin-bottom:6px"></div><div style="font-size:18px;font-weight:800;margin-bottom:8px">Аудит успешно отправлен!</div><div id="sd" style="font-size:14px;color:var(--ink);margin-bottom:14px"></div><div style="display:flex;gap:10px;flex-wrap:wrap;justify-content:center"><button class="btn bo bs" onclick="printConfirm()">🖨️ Распечатать</button></div></div>
</div>
<div id="pMS" class="pn"><div style="margin-bottom:24px"><h2 style="font-size:26px;font-weight:800">📅 Мой график</h2><p style="color:var(--g5)">Выполнение норматива</p></div><div id="msc"></div></div>
<div id="pDB" class="pn"><div style="margin-bottom:24px"><h2 style="font-size:26px;font-weight:800">📊 Дашборд</h2><p style="color:var(--g5)">Аналитика</p></div><div id="dbc"></div></div>
@ -143,7 +143,7 @@ function getVR(){var rs=[];document.querySelectorAll("#vr .vg").forEach(function
function getDL(){var r=[];["Работник привёл примеры безопасных действий","Были обсуждены риски / проблемы","Определены корректирующие меры","Предложения работника зафиксированы","Другое"].forEach(function(l,i){var cb=document.getElementById("d"+i);if(cb&&cb.checked)r.push({item:l,other:l==="Другое"?document.getElementById("do").value.trim()||"":null})});return r}
function setDL(items){for(var i=0;i<5;i++){var cb=document.getElementById("d"+i);if(cb)cb.checked=false}var o=document.getElementById("do");if(o){o.value="";o.style.display="none";o.classList.remove("vs")}items.forEach(function(di){var idx=["Работник привёл примеры безопасных действий","Были обсуждены риски / проблемы","Определены корректирующие меры","Предложения работника зафиксированы","Другое"].indexOf(di.item);if(idx>=0){var cb=document.getElementById("d"+idx);if(cb){cb.checked=true;if(di.item==="Другое"&&di.other){var oo=document.getElementById("do");oo.value=di.other;oo.style.display="block";oo.classList.add("vs")}}}})}
function submitAudit(){if(editId&&!isA()){alert("Только администратор");return}var loc=document.getElementById("pl").value.trim();if(!loc){alert("Укажите место");return}var cats={},tv=0;CATS.forEach(function(cat){var ch=[];cat.items.forEach(function(item,i){var cb=document.getElementById("cb-"+cat.id+"-"+i);if(cb&&cb.checked){var ov=item==="Другое"?(document.getElementById("other-"+cat.id).value.trim()||""):null;ch.push({item:item,other:ov})}});cats[cat.id]={items:ch,allSafe:ch.length===0};tv+=ch.length});var e={id:editId||Date.now(),number:document.getElementById("pn").value.trim(),date:document.getElementById("pd").value,timeStart:document.getElementById("ps").value,timeEnd:document.getElementById("pe").value,location:loc,region:document.getElementById("pr").value,workType:document.getElementById("pw").value.trim(),workerCount:parseInt(document.getElementById("pc").value)||1,observer:document.getElementById("po").value.trim()||U.name,observerRole:document.getElementById("por").value.trim(),supervisor:document.getElementById("psv").value.trim(),supervisorRole:document.getElementById("psr").value.trim(),email:document.getElementById("pem").value.trim()||U.email||"",overallSafe:document.getElementById("os").classList.contains("sel"),categories:cats,totalViolations:tv,violations:getVR(),dialogue:getDL(),createdBy:U.login,createdAt:new Date().toISOString()};var audits=getA();if(editId){audits=audits.map(function(a){return a.id===editId?e:a});editId=null}else{audits.unshift(e)}saveA(audits);lastSubmitted=e;resetF();document.getElementById("sd").innerHTML="<b>Бланк №"+(e.number||"—")+"</b> | "+e.date+" | <b>"+(e.overallSafe?"БЕЗОПАСНО":"НАРУШЕНИЙ: "+e.totalViolations)+"</b>";document.getElementById("fs").style.display="block";document.getElementById("sd").innerHTML+="<br><span style=\"font-size:12px;color:var(--g5)\">👆 Нажмите <b>«На email»</b> чтобы отправить подтверждение себе на почту.</span>";setTimeout(function(){document.getElementById("fs").style.display="none"},30000);if(!isA())checkSA()}
function submitAudit(){if(editId&&!isA()){alert("Только администратор");return}var loc=document.getElementById("pl").value.trim();if(!loc){alert("Укажите место");return}var cats={},tv=0;CATS.forEach(function(cat){var ch=[];cat.items.forEach(function(item,i){var cb=document.getElementById("cb-"+cat.id+"-"+i);if(cb&&cb.checked){var ov=item==="Другое"?(document.getElementById("other-"+cat.id).value.trim()||""):null;ch.push({item:item,other:ov})}});cats[cat.id]={items:ch,allSafe:ch.length===0};tv+=ch.length});var e={id:editId||Date.now(),number:document.getElementById("pn").value.trim(),date:document.getElementById("pd").value,timeStart:document.getElementById("ps").value,timeEnd:document.getElementById("pe").value,location:loc,region:document.getElementById("pr").value,workType:document.getElementById("pw").value.trim(),workerCount:parseInt(document.getElementById("pc").value)||1,observer:document.getElementById("po").value.trim()||U.name,observerRole:document.getElementById("por").value.trim(),supervisor:document.getElementById("psv").value.trim(),supervisorRole:document.getElementById("psr").value.trim(),email:document.getElementById("pem").value.trim()||U.email||"",overallSafe:document.getElementById("os").classList.contains("sel"),categories:cats,totalViolations:tv,violations:getVR(),dialogue:getDL(),createdBy:U.login,createdAt:new Date().toISOString()};var audits=getA();if(editId){audits=audits.map(function(a){return a.id===editId?e:a});editId=null}else{audits.unshift(e)}saveA(audits);lastSubmitted=e;resetF();document.getElementById("sd").innerHTML="<b>Бланк №"+(e.number||"—")+"</b> | "+e.date+" | <b>"+(e.overallSafe?"БЕЗОПАСНО":"НАРУШЕНИЙ: "+e.totalViolations)+"</b>";document.getElementById("fs").style.display="block";setTimeout(function(){document.getElementById("fs").style.display="none"},30000);if(!isA())checkSA()}
function resetF(){document.getElementById("pn").value="";document.getElementById("pd").value=new Date().toISOString().split("T")[0];document.getElementById("ps").value="";document.getElementById("pe").value="";document.getElementById("pl").value="";document.getElementById("pr").value=U.region||"";document.getElementById("pw").value="";document.getElementById("pc").value="1";document.getElementById("po").value=U.name;document.getElementById("por").value="";document.getElementById("psv").value="";document.getElementById("psr").value="";document.getElementById("pem").value=U.email||"";setO("safe");editId=null;CATS.forEach(function(cat){document.getElementById("ascb-"+cat.id).checked=true;document.getElementById("as-"+cat.id).classList.add("ac2");cat.items.forEach(function(_,i){var cb=document.getElementById("cb-"+cat.id+"-"+i);if(cb){cb.checked=false;cb.parentElement.classList.remove("ck")}var o=document.getElementById("other-"+cat.id);if(o){o.value="";o.style.display="none";o.classList.remove("vs")}});updateCatTotal(cat.id)});document.getElementById("vr").innerHTML="";vrc=6;for(var i=0;i<vrc;i++)document.getElementById("vr").innerHTML+=mkV(i+1);setDL([]);return true}
function sendEmailConfirm(){if(!lastSubmitted)return;var e=lastSubmitted,to=e.email||U.email||"";if(!to||to.indexOf("@")<0){alert("Нет email");return}location.href="mailto:"+encodeURIComponent(to)+"?subject="+encodeURIComponent("ПАБ "+(e.number||""))+"&body="+encodeURIComponent("Подтверждение ПАБ\nБланк: "+(e.number||"")+"\ата: "+e.date+"\nМесто: "+e.location+"\nСтатус: "+(e.overallSafe?"БЕЗОПАСНО":"НАРУШЕНИЙ: "+e.totalViolations))}
function printConfirm(){if(!lastSubmitted)return;var e=lastSubmitted;var w=window.open("","_blank","width=700,height=800");w.document.write("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>ПАБ</title><style>body{font:14px/1.5 Arial;max-width:700px;margin:40px auto}@media print{button{display:none}}</style></head><body><button onclick=\"window.print()\">🖨️ Печать</button><h1>БЛАНК ПАБ №"+(e.number||"—")+" от "+e.date+"</h1><p>Место: "+e.location+" | Наблюдатель: "+e.observer+" | Статус: "+(e.overallSafe?"БЕЗОПАСНО":"НАРУШЕНИЙ: "+e.totalViolations)+"</p></body></html>");w.document.close()}