Gia Đình Phật Tử Việt Nam
Miền Quảng Đức
Bầu cử Ban Huynh Trưởng 2026
Chờ mở
✦   Nam Mô Bổn Sư Thích Ca Mâu Ni Phật   ✦
🔐 Đăng nhập Admin
Kết quả trực tiếp
`; const w=window.open('','_blank'); if(!w){alert('Vui lòng cho phép pop-up để xuất PDF');return;} w.document.write(doc); w.document.close(); }catch(e){alert('Lỗi PDF: '+e.message);} } /* ══ EXPORT EXCEL ══ */ function xXLS(){ try{ const wb=XLSX.utils.book_new(); const sum=[['KẾT QUẢ BẦU CỬ GĐPT MIỀN QUẢNG ĐỨC 2026'],['Thời điểm: '+new Date().toLocaleString('vi-VN')],[''], ['STT','Chức vụ','English','Trúng cử','Họ tên','Số phiếu','Tỷ lệ %','Trạng thái','Đại biểu','Đã bầu']]; POS.forEach((pos,i)=>{ const r=S.rounds[pos.id],voted=Object.keys(r.votes).length; const cnt={};r.cands.forEach(c=>{cnt[c.id]=0;});Object.values(r.votes).forEach(cid=>{if(cnt[cid]!==undefined)cnt[cid]++;}); const top=r.cands.slice().sort((a,b)=>(cnt[b.id]||0)-(cnt[a.id]||0))[0]; sum.push([i+1,pos.vi,pos.en,top?top.phap:'',top?top.name:'',top?cnt[top.id]||0:0, (voted>0&&top)?Math.round((cnt[top.id]||0)/voted*100):0, r.phase==='closed'?'Đã đóng':r.phase==='open'?'Đang mở':'Chưa mở',S.total,voted]); }); const ws=XLSX.utils.aoa_to_sheet(sum); ws['!cols']=[{wch:5},{wch:36},{wch:30},{wch:20},{wch:26},{wch:10},{wch:10},{wch:12},{wch:12},{wch:10}]; XLSX.utils.book_append_sheet(wb,ws,'Tổng kết'); XLSX.writeFile(wb,`KetQua_GDPT_MQD_${new Date().toISOString().slice(0,10)}.xlsx`); }catch(e){alert('Lỗi Excel: '+e.message);} } /* ══ HELPERS ══ */ function lotus(){return ``;} function x(s){return(s||'').replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');} function showMsg(id,t,ty){const e=document.getElementById(id);if(!e)return;e.textContent=t;e.className='msg '+ty;setTimeout(()=>{e.className='msg';e.textContent='';},4000);} function badge(){ const b=document.getElementById('hpill'); const anyOpen=POS.some(p=>S.rounds[p.id].phase==='open'); const allDone=POS.every(p=>S.rounds[p.id].phase==='closed'); if(anyOpen){b.textContent='🟢 Đang mở';b.className='hp open';} else if(allDone){b.textContent='Hoàn tất';b.className='hp closed';} else{b.textContent='Chờ mở';b.className='hp setup';} } function goTab(t){ ['admin','results','vote'].forEach(n=>{ document.getElementById('sec-'+n).classList.toggle('on',n===t); document.getElementById('t-'+n).classList.toggle('active',n===t); }); if(t==='results')startResults(); else stopResults(); if(t==='vote')startVote(); else stopVote(); } /* ══ BOOT ══ */ const isVote=new URLSearchParams(window.location.search).get('vote')==='1'; if(isVote){ document.getElementById('main-tabs').style.display='none'; document.querySelectorAll('.sec').forEach(s=>s.classList.remove('on')); document.getElementById('sec-vote').classList.add('on'); document.getElementById('vcontent').innerHTML=`
${lotus()}

Đang tải...

Vui lòng chờ 🙏

`; startVote(); } else { pull().then(()=>{badge();}); }