diff --git a/app.html b/app.html index 6cada7a..767b778 100644 --- a/app.html +++ b/app.html @@ -195,14 +195,18 @@ function rVL(){var c=document.getElementById("vlc");if(!c)return;var a=getA(),td function rHS(){var a=getA(),tb=document.getElementById("hbd");if(!tb)return;tb.innerHTML=a.length===0?"Нет записей":a.map(function(x){var ab=isA()?"✏️ ":"чтение";return""+(x.number||"—")+""+x.date+""+x.location+""+x.observer+""+(x.overallSafe?"Безопасно":"Нарушения")+""+(x.totalViolations||0)+""+ab+""}).join("")} -function submitAudit(){ +async function uploadPhoto(file){var fn=Date.now()+"_"+file.name.replace(/[^a-zA-Z0-9._-]/g,"_");try{var r=await fetch(SB_URL+"/storage/v1/object/photos/"+fn,{method:"POST",headers:{"apikey":SB_KEY,"Authorization":"Bearer "+SB_KEY,"Content-Type":file.type},body:file});if(r.ok){return SB_URL+"/storage/v1/object/public/photos/"+fn}}catch(e){}return null} + +async async function submitAudit(){ if(editId&&!isA()){alert("Только администратор может редактировать");return} var loc=document.getElementById("pl").value.trim();if(!loc){alert("Укажите место проведения");return} + // Upload photos + var pf=document.getElementById("pfiles");var photoUrls=[];if(pf&&pf.files.length>0){for(var i=0;i | "+e.date+" | "+(e.overallSafe?"БЕЗОПАСНО":"НАРУШЕНИЙ: "+e.totalViolations);document.getElementById("fs").style.display="block";setTimeout(function(){document.getElementById("fs").style.display="none"},20000); resetF(); rVL();