My audits

+Number(price).toLocaleString()+' · '+hrs+'h left in window
'+ ''; } return ''; } async function buyFix(auditId){ const c=await (await fetch('/api/pay/fix/paypal/create',{method:'POST',headers:{'Content-Type':'application/json'},credentials:'same-origin',body:JSON.stringify({auditId})})).json(); if(c.error) return alert('PayPal: '+c.error+'\n(Enter PayPal keys in Admin settings.)'); const approve=(c.links||[]).find(l=>l.rel==='approve'); if(approve) window.location=approve.href; } (async()=>{ const me=await (await fetch('/api/account/me',{credentials:'same-origin'})).json(); if(!me.loggedIn){location.href='/login.html?return=/account.html';return;} $('who').textContent='Signed in as '+me.user.email+(me.user.business_name?(' — '+me.user.business_name):''); const audits=await (await fetch('/api/account/audits',{credentials:'same-origin'})).json(); if(!audits.length){$('list').innerHTML='
No audits yet. Start one.
';return;} $('list').innerHTML=audits.map(a=>'

'+a.auditId+'

'+ '
Package: '+(a.packageName||'-')+'
'+ '
Paid: $'+(a.pricePaid||0).toLocaleString()+'
'+ '
Status: '+a.status+'
'+ '
Ordered: '+a.createdAt+'
'+ (a.downloadable?'
Download / Reprint audit
':'
Result pending…
')+ fixBlock(a)+ '
').join(''); })(); $('logout').onclick=async(e)=>{e.preventDefault();await fetch('/api/account/logout',{method:'POST',credentials:'same-origin'});location.href='/';};