PageSourceSearch

https://app.pickiddo.com/assets/AdminMissingAttendanceView-CKqOy5ei.js

js pickiddo.com collected 2026-10-02 00:54:56 UTC 10,492 bytes, 1 lines download raw bytes

1import{az as Q,aA as W,o as Y,c as o,b as e,k as D,s as X,F as C,i as T,n as g,t as l,e as f,u as U,w as Z,l as p,bQ as ee,G as te,r,bR as se,ao as ae,a as n,L as le,K as ne,bS as oe,bT as ie,M as V}from"./index-BaA6VAlU.js";const re={class:"page-root"},de={class:"canvas"},ue={class:"outer"},ce={class:"main"},xe={class:"w-full px-4 pb-10 pt-6 lg:max-w-6xl"},me={class:"mb-6 flex items-center gap-3"},ve={class:"mb-5 flex gap-1 rounded-2xl bg-white p-1 shadow-[0_4px_14px_rgba(15,23,42,0.07)]"},fe=["onClick"],pe={key:2,class:"rounded-2xl bg-rose-50 p-5 text-sm text-rose-600"},be={key:3,class:"flex flex-col items-center justify-center py-20 text-slate-400"},ge={key:4,class:"flex flex-col gap-3"},he={class:"flex items-start justify-between gap-3"},ye={class:"min-w-0 flex-1"},ke={class:"flex flex-wrap items-center gap-2"},_e={class:"text-sm font-bold text-slate-900"},we={key:0,class:"rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold text-slate-500"},je={class:"mt-0.5 text-xs text-slate-400"},Ce={class:"font-medium text-slate-600"},Ae={class:"flex shrink-0 flex-col items-end gap-1.5"},Me={class:"text-[11px] text-slate-400"},Ne={class:"mt-3 rounded-xl bg-amber-50 px-3 py-2 text-xs text-amber-700"},Ie={key:0,class:"mt-3.5 flex flex-wrap items-center gap-2"},Se=["onClick","disabled"],De=["onClick","disabled"],Te={key:1,class:"mt-2.5 text-[11px] text-slate-400"},Le={class:"max-h-[92vh] w-full overflow-y-auto rounded-t-3xl bg-white p-5 shadow-2xl sm:max-w-2xl sm:rounded-3xl"},Be={class:"flex items-start justify-between gap-3"},Pe={class:"text-base font-bold text-slate-900"},ze={class:"text-xs text-slate-400"},Ge={class:"mt-3 rounded-xl bg-amber-50 px-3 py-2 text-xs text-amber-700"},Ee={class:"mt-2 space-y-2"},$e={key:0,class:"rounded-xl bg-slate-50 px-3 py-4 text-center text-xs text-slate-400"},Re={class:"min-w-0"},Ue={class:"truncate text-sm font-semibold text-slate-800"},Ve={class:"truncate text-[11px] text-slate-400"},Fe={class:"flex shrink-0 items-center gap-1.5"},Ke=["onClick"],He=["onClick"],Oe={key:0,class:"mt-3 rounded-xl bg-rose-50 px-3 py-2 text-xs font-semibold text-rose-600"},qe={class:"mt-4 flex gap-2"},Je=["disabled"],Ye={__name:"AdminMissingAttendanceView",setup(Qe){const L=[{label:"Home",to:"/",icon:"home"},{label:"Class",to:"/class",icon:"class"},{label:"Tutor",to:"/tutor",icon:"tutor"},{label:"Profile",to:"/profile",icon:"profile"},{label:"Pickuiz",to:"/quiz/utama",icon:"pickuiz"},{label:"Games",to:"/games",icon:"games"}],B=Q(),{user:P}=W(B),F=[{key:"Pending",label:"Menunggu"},{key:"Approved",label:"Disahkan"}],A=r("Pending"),h=r([]),M=r(!1),y=r(""),x=r(null),k=r(""),z=r("success"),N=r(!1),I=r(!1),u=r(null),m=r([]),v=ae({}),b=r(!1),c=r(""),G=()=>{const t=P.value;return t?.userId??t?.UserId??t?.id??t?.Id??t?.data?.userId??t?.data?.id??null},E=t=>Array.isArray(t)?t:Array.isArray(t?.data)?t.data:Array.isArray(t?.Data)?t.Data:Array.isArray(t?.items)?t.items:(t&&typeof t=="object"&&!Array.isArray(t),t),_=(t,s="success")=>{k.value=t,z.value=s,setTimeout(()=>{k.value=""},4e3)};async function w(){M.value=!0,y.value="",h.value=[];try{const t=await ee(A.value),s=E(t);h.value=Array.isArray(s)?s:[]}catch(t){y.value=t?.message||"Gagal memuatkan missing attendance."}finally{M.value=!1}}async function K(t){x.value=t.id,c.value="",N.value=!0,I.value=!0,u.value=null,m.value=[];try{const s=await oe(t.id),d=E(s);u.value=d;const a=Array.isArray(d?.roster)?d.roster:[];m.value=a,a.forEach(i=>{v[i.studentId]=i.existingAttend!==!1})}catch{u.value=null,c.value="Gagal memuatkan butiran."}finally{I.value=!1,x.value=null}}const $=(t,s)=>{v[t]=s};function S(){N.value=!1,u.value=null,m.value=[],Object.keys(v).forEach(t=>delete v[t])}async function H(){if(b.value)return;const t=G();if(!t){c.value="Sila log masuk semula.";return}b.value=!0,c.value="";try{const s=m.value.map(R=>({studentId:R.studentId,isAttend:v[R.studentId]!==!1})),d=await se({adminUserId:t,id:u.value.id,students:JSON.stringify(s)}),a=d?.data??d,i=Number(a);Number.isFinite(i)&&i===1?(_("Missing attendance disahkan. Caj & gaji telah diproses."),S(),w()):c.value="Gagal memproses. Sila cuba lagi."}catch(s){c.value=s?.message||"Gagal memproses."}finally{b.value=!1}}async function O(t){if(x.value!==t.id){x.value=t.id;try{const s=G(),d=await ie({adminUserId:s,id:t.id}),a=d?.data??d,i=Number(a);Number.isFinite(i)&&i===1?(_("Permintaan ditolak.","success"),w()):_("Gagal menolak permintaan.","error")}catch{_("Gagal menolak permintaan.","error")}finally{x.value=null}}}function q(t){return t==="Approved"?"Disahkan":t==="Rejected"?"Ditolak":"Menunggu"}function J(t){return t==="Approved"?"bg-green-50 text-green-700":t==="Rejected"?"bg-rose-50 text-rose-600":"bg-amber-50 text-amber-700"}function j(t){if(!t)return"";const s=new Date(t);
1return Number.isNaN(s.getTime())?String(t):s.toLocaleString("ms-MY",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}return Y(async()=>{P.value||await B.fetchSessionUser(),w()}),(t,s)=>{const d=te("router-link");return n(),o("div",re,[e("div",de,[e("div",ue,[D(le,{links:L}),e("div",ce,[e("div",xe,[e("header",me,[D(d,{to:"/admin",class:"flex h-9 w-9 items-center justify-center rounded-full bg-white text-slate-500 shadow-[0_4px_12px_rgba(15,23,42,0.08)]"},{default:X(()=>[...s[0]||(s[0]=[e("svg",{class:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M15 6l-6 6 6 6"})],-1)])]),_:1}),s[1]||(s[1]=e("div",null,[e("h1",{class:"text-xl font-bold text-slate-900"},"Missing Attendance"),e("p",{class:"text-xs text-slate-400"},"Kelas yang attendance-nya terlewat diambil tutor — sahkan untuk caj & gaji")],-1))]),e("div",ve,[(n(),o(C,null,T(F,a=>e("button",{key:a.key,onClick:i=>{A.value=a.key,w()},class:g(["flex-1 rounded-xl py-2.5 text-sm font-semibold transition",A.value===a.key?"bg-violet-600 text-white shadow-[0_4px_10px_rgba(124,58,237,0.25)]":"text-slate-500 hover:text-slate-700"])},l(a.label),11,fe)),64))]),k.value?(n(),o("div",{key:0,class:g(["mb-4 rounded-xl px-4 py-3 text-sm font-semibold",z.value==="success"?"bg-emerald-50 text-emerald-700":"bg-rose-50 text-rose-600"])},l(k.value),3)):f("",!0),M.value?(n(),U(V,{key:1,label:"Memuatkan...",color:"purple",size:"lg"})):y.value?(n(),o("div",pe,l(y.value),1)):h.value.length===0?(n(),o("div",be,[...s[2]||(s[2]=[e("svg",{class:"mb-3 h-12 w-12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.4"},[e("circle",{cx:"12",cy:"12",r:"9"}),e("path",{d:"M12 8v4l3 2"})],-1),e("p",{class:"text-sm font-medium"},"Tiada missing attendance ditemui",-1)])])):(n(),o("div",ge,[(n(!0),o(C,null,T(h.value,a=>(n(),o("div",{key:a.id,class:"rounded-2xl bg-white p-4 shadow-[0_4px_14px_rgba(15,23,42,0.07)]"},[e("div",he,[e("div",ye,[e("div",ke,[e("p",_e,l(a.subjectName||"Kelas"),1),a.className?(n(),o("span",we,l(a.className),1)):f("",!0)]),e("p",je,[s[3]||(s[3]=p(" Cikgu: ",-1)),e("span",Ce,l(a.teacherName||"—"),1),p(" · "+l(j(a.classDate)),1)])]),e("div",Ae,[e("span",{class:g(["rounded-full px-2.5 py-1 text-xs font-semibold",J(a.status)])}
1,l(q(a.status)),3),e("span",Me,"Dihantar "+l(j(a.createdTime)),1)])]),e("div",Ne,[s[4]||(s[4]=e("span",{class:"font-semibold"},"Sebab tutor:",-1)),p(" "+l(a.reason),1)]),a.status==="Pending"?(n(),o("div",Ie,[e("button",{onClick:i=>K(a),disabled:x.value===a.id,class:"flex items-center gap-1.5 rounded-xl bg-violet-600 px-4 py-2 text-xs font-semibold text-white transition hover:bg-violet-700 disabled:opacity-50"},[...s[5]||(s[5]=[e("svg",{class:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 5v14M5 12h14"})],-1),p(" Semak & Proses ",-1)])],8,Se),e("button",{onClick:i=>O(a),disabled:x.value===a.id,class:"flex items-center gap-1.5 rounded-xl bg-rose-50 px-4 py-2 text-xs font-semibold text-rose-600 transition hover:bg-rose-100 disabled:opacity-50"},[...s[6]||(s[6]=[e("svg",{class:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2"},[e("path",{d:"M6 6l12 12M18 6L6 18"})],-1),p(" Tolak ",-1)])],8,De)])):a.reviewedTime?(n(),o("div",Te," Disemak pada "+l(j(a.reviewedTime)),1)):f("",!0)]))),128))]))]),D(ne,{links:L})])])]),N.value?(n(),o("div",{key:0,class:"fixed inset-0 z-50 flex items-end justify-center bg-black/50 p-0 sm:items-center sm:p-4",onClick:Z(S,["self"])},[e("div",Le,[e("div",Be,[e("div",null,[e("h2",Pe,l(u.value?.subjectName||"Kelas"),1),e("p",ze,l(u.value?.className)+" · "+l(j(u.value?.classDate))+" · Cikgu "+l(u.value?.teacherName),1)]),e("button",{class:"flex h-8 w-8 items-center justify-center rounded-full bg-slate-100 text-slate-500",type:"button",onClick:S},[...s[7]||(s[7]=[e("svg",{class:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])])]),e("div",Ge,[s[8]||(s[8]=e("span",{class:"font-semibold"},"Sebab tutor:",-1)),p(" "+l(u.value?.reason),1)]),s[10]||(s[10]=e("p",{class:"mt-4 text-xs font-bold uppercase tracking-wide text-slate-400"},"Senarai pelajar — tanda hadir / tidak",-1)),I.value?(n(),U(V,{key:0,label:"Memuatkan pelajar...",color:"purple",size:"sm"})):(n(),o(C,{key:1},[e("div",Ee,[m.value.length?f("",!0):(n(),o("div",$e," Tiada pelajar berdaftar untuk kelas ini. ")),(n(!0),o(C,null,T(m.value,a=>(n(),o("div",{key:a.studentId,class:"flex items-center justify-between rounded-xl border border-slate-200 px-3 py-2.5"},[e("div",Re,[e("p",Ue,l(a.studentName),1),e("p",Ve,l(a.parentEmail),1)]),e("div",Fe,[e("button",{type:"button",onClick:i=>$(a.studentId,!0),class:g(["rounded-full px-3 py-1.5 text-xs font-semibold transition",v[a.studentId]===!0?"bg-emerald-500 text-white":"bg-slate-100 text-slate-500"])}," Hadir ",10,Ke),e("button",{type:"button",onClick:i=>$(a.studentId,!1),class:g(["rounded-full px-3 py-1.5 text-xs font-semibold transition",v[a.studentId]===!1?"bg-rose-500 text-white":"bg-slate-100 text-slate-500"])}," Tidak ",10,He)])]))),128))]),c.value?(n(),o("p",Oe,l(c.value),1)):f("",!0),e("div",qe,[e("button",{type:"button",onClick:H,disabled:b.value||!m.value.length,class:"flex-1 rounded-xl bg-violet-600 py-3 text-sm font-semibold text-white transition hover:bg-violet-700 disabled:opacity-50"},l(b.value?"Memproses...":"Sahkan & Proses (Caj + Gaji)"),9,Je)]),s[9]||(s[9]=e("p",{class:"mt-2 text-center text-[11px] text-slate-400"},' Pelajar bertanda "Hadir" akan dicaj ke e-Wallet ibu bapa dan gaji tutor dijana seperti biasa. ',-1))],64))])])):f("",!0)])}}};export{Ye as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.