1import{j as t}from"./vendor-pdf-CAs81Xpx.js";import{a as l}from"./vendor-react-WakpR0wD.js";import{b as U}from"./vendor-charts-Dhh0UBmn.js";import{M as me}from"./MainLayout-Svkkv2is.js";import{B as ee}from"./BackButton-voeEGv1I.js";import{A as ge}from"./AcademicYearSemesterFilter-BFMoMFpz.js";import{i as g,o as te,P as ue,cl as pe}from"./index-BQksJ-U7.js";import{b as be,c as se,f as K,d as p,z as ae,g as L,h as D,u as he,m as fe,x as ye}from"./vendor-firestore-C84qCbTf.js";import{S as h}from"./vendor-swal-BgUaMQbp.js";import{u as H,w as ke}from"./vendor-spreadsheet-k67i0qLr.js";import{u as je}from"./Navbar-BYlHuWeG.js";import{k as ve,h as Ne,e as Ce}from"./remediationUtils-v4xztunY.js";import{s as we}from"./swalChoiceDialog-Qf-W7d38.js";import{u as $e}from"./useResponsivePwaMode-BKHC5iAY.js";import{L as re}from"./layout-dashboard-DhQeZdIE.js";import{R as Z}from"./refresh-cw-g24bzswf.js";import{F as Se}from"./file-spreadsheet-A7EXX5j8.js";import{C as Ie}from"./chevron-left-DhGEpv32.js";import{C as Te}from"./chevron-right-DlsYTjJo.js";import{C as Be}from"./circle-alert-PQlQFZ8S.js";import{C as ne}from"./circle-check-6jn1nmmv.js";import{T as Re}from"./trash-2-COReKX0N.js";import"./vendor-firebase-auth-DWo6Js8N.js";import"./vendor-firebase-core-DfI3m37w.js";import"./AIAssistantWidget-DjAJzlhp.js";import"./arrow-left-Bz7UVE-D.js";import"./calendar-range-BtbhMTlm.js";import"./ProfileAvatar-C57cy0cU.js";import"./users-FNKwIhe4.js";import"./profile-DDlO39M8.js";import"./index-CTJayJtD.js";import"./SkeletonLoader-ODolvGj-.js";import"./learnerActivityUtils-DGtKX1gk.js";const ze=[10,25,50,100],Ae=async(n,I,_)=>{const[o,j]=await Promise.all([L(p(g,"school-settings",n,"courses",I)),L(p(g,"school-settings",n,"courses",I,"grades",_))]),T=o.exists()?o.data():{},m=j.exists()?j.data():{};if(typeof m.total=="number"&&!isNaN(m.total)&&m.total>0)return m.total;const M=m.formativeDetails||{},b=(T.formativeAssessments||[]).reduce((Y,d)=>{const f=d.id||d.name;if(!f)return Y;const y=M[f];return Y+(y===void 0||y===""?0:Number(y)||0)},0),F=Number(m.midterm)||0,N=Number(m.final)||0;return b+F+N},gt=()=>{const{user:n,isSuperAdmin:I}=je(),_=U(e=>{var s;return((s=e.userMap)==null?void 0:s.teachers)||{}}),o=n==null?void 0:n.schoolId,j=$e(),T=U(e=>e.calendar.academicYear),[m,M]=l.useState(!0),[b,F]=l.useState([]),[N,Y]=l.useState({}),[d,f]=l.useState(""),[y,ie]=l.useState(""),[E,J]=l.useState(null),[C,w]=l.useState(1),[$,oe]=l.useState(10),[B,Q]=l.useState(()=>sessionStorage.getItem("rmo_termYear")??""),[R,de]=l.useState(()=>sessionStorage.getItem("rmo_termSemester")||"");l.useEffect(()=>{sessionStorage.setItem("rmo_termYear",B),sessionStorage.setItem("rmo_termSemester",R)},[B,R]),l.useEffect(()=>{sessionStorage.getItem("rmo_termYear")===null&&T&&Q(T)},[T]);const z=l.useCallback(async()=>{if(o){M(!0);try{const[e,s]=await Promise.all([ve(o,_,{academicYear:B||void 0,semester:R||void 0}),be(se(g,"school-settings",o,"remediation_requests"))]),c={};s.forEach(x=>{const a=x.data();if(a.status==="cancelled")return;const r=a.flagType==="course"?a.courseId:a.activityId,i=`${a.studentId}|${r}|${a.academicYear}|${a.semester}`;(!c[i]||a.status==="resolved")&&(c[i]={id:x.id,status:a.status,newResult:a.newResult,resolvedByName:a.resolvedByName,resolvedAt:a.resolvedAt,requestedAt:a.requestedAt,originalGrade:a.originalGrade})}),F(e),Y(c),w(1)}catch(e){console.error("Error loading remediation overview:",e),h.fire("à¸à¸´à¸à¸à¸¥à¸²à¸",`à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¹à¸«à¸¥à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸ าà¸à¸£à¸§à¸¡à¹à¸à¹: ${(e==null?void 0:e.code)||(e==null?void 0:e.message)||"unknown error"}`,"error")}finally{M(!1)}}},[o,_,B,R]);l.useEffect(()=>{z()},[z]);const v=l.useMemo(()=>{const e=y.trim().toLowerCase();return b.filter(s=>d==="normal"&&s.status!=="normal"||d==="none"&&s.status!=="none"||d&&d!=="normal"&&d!=="none"&&s.grade!==d?!1:e?`${s.name} ${s.studentCode} ${s.courseTitle} ${s.courseCode}`.toLowerCase().includes(e):!0)},[b,d,y]);l.useEffect(()=>{w(1)},[d,y,$]);const O=Math.max(1,Math.ceil(v.length/$)),le=l.useMemo(()=>v.slice((C-1)*$,C*$),[v,C,$]),G=l.useMemo(()=>({total:b.length,flagged:b.filter(e=>e.status==="flag").length,normal:b.filter(e=>e.status==="normal").length,none:b.filter(e=>e.status==="none").length}),[b]),W=async(e,s)=>{var a;if(e.status!=="flag")return;if(((a=N[e.key])==null?void 0:a.status)!=="pending"){h.fire({icon:"warning",title:"ยัà¸à¹à¸¡à¹à¸¡à¸µà¸à¸³à¸£à¹à¸à¸à¸à¸à¹à¸à¹à¸à¸±à¸§",html:`${e.name} (${e.studentCode}) ยัà¸à¹à¸¡à¹à¹à¸à¹à¸¢à¸·à¹à¸à¸à¸³à¸£à¹à¸à¸à¸à¸à¹à¸à¹à¸à¸±à¸§à¸§à¸´à¸à¸² <b>${e.courseTitle||e.courseCode}</b><br/><br/>à¸à¹à¸à¸à¹à¸«à¹à¸à¸±à¸à¹à¸£à¸µà¸¢à¸à¸¢à¸·à¹à¸à¸à¸³à¸£à¹à¸à¸à¸à¸µà¹à¸«à¸à¹à¸²à¹
1à¸à¸£à¹à¸à¸¥à¹à¸à¹à¸à¸ (หรืà¸à¸à¸£à¸¹à¸¢à¸·à¹à¸à¹à¸à¸à¹à¸à¹) à¹à¸¥à¹à¸§à¸à¸¶à¸à¸à¸à¸¸à¸¡à¸±à¸à¸´à¸à¸µà¹à¸«à¸à¹à¸² "à¸à¸³à¸£à¹à¸à¸à¸à¸à¹à¸à¹à¸à¸±à¸§"`});return}let c,x;if(s==="repeat"){if(!(await h.fire({icon:"warning",title:"ยืà¸à¸¢à¸±à¸à¹à¸«à¹à¹à¸£à¸µà¸¢à¸à¸à¹à¸³",html:`<div style="text-align:left;font-size:13px">${e.name} (${e.studentCode})<br/>วิà¸à¸²: <b>${e.courseTitle||e.courseCode}</b><br/><br/>à¸à¸°à¸à¸±à¸à¸à¸¶à¸à¸ªà¸à¸²à¸à¸°à¹à¸à¹à¸ "à¹à¸£à¸µà¸¢à¸à¸à¹à¸³" à¹à¸à¸£à¸°à¸à¸à¸à¸³à¸£à¹à¸à¸ à¹à¸à¸¢<b>à¹à¸¡à¹à¹à¸à¸¥à¸µà¹à¸¢à¸à¹à¸à¸¥à¸à¹à¸à¸£à¸à¹à¸à¸´à¸¡</b>à¹à¸à¸à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥</div>`,showCancelButton:!0,confirmButtonText:"ยืà¸à¸¢à¸±à¸",cancelButtonText:"ยà¸à¹à¸¥à¸´à¸",confirmButtonColor:"#f59e0b"})).isConfirmed)return;x="à¹à¸£à¸µà¸¢à¸à¸à¹à¸³"}else if(e.flagKind==="course"&&e.grade==="ร"){const r=await Ae(o,e.courseId,e.studentId),i=Ne(e.grade,r);if(!(await h.fire({icon:"question",title:`à¹à¸à¹à¹à¸ ร à¸à¸à¸${e.name}`,html:`<div style="text-align:left;font-size:14px;line-height:1.6;margin-top:8px"> 2 à¸à¸±à¸à¹à¸£à¸µà¸¢à¸: <b>${e.name}</b> (${e.studentCode})<br/> 3 วิà¸à¸²: <b>${e.courseTitle||e.courseCode}</b><br/> 4 à¸à¸°à¹à¸à¸à¸£à¸§à¸¡à¹à¸à¸ªà¸¡à¸¸à¸à¸à¸°à¹à¸à¸ (TOTAL): <b style="color:#4f46e5">${r} à¸à¸°à¹à¸à¸</b><br/> 5 à¹à¸à¸£à¸à¸ªà¸¸à¸à¸à¸´à¸à¸µà¹à¸à¸°à¹à¸à¹à¸£à¸±à¸à¸à¸²à¸ GradeBook: <b style="color:#16a34a;font-size:17px">${i}</b> 6 </div>`,showCancelButton:!0,confirmButtonText:`à¸à¸±à¸à¸à¸¶à¸à¹à¸à¸£à¸ (${i})`,cancelButtonText:"ยà¸à¹à¸¥à¸´à¸",confirmButtonColor:"#4f46e5"})).isConfirmed)return;c=i,x=i}else if(e.flagKind==="course"){const r=Ce(e.grade),{value:i}=await we({title:"à¸à¸±à¸à¸à¸¶à¸à¸à¸¥à¹à¸à¹à¸à¸±à¸§",html:`<div style="text-align:left;font-size:13px;margin-bottom:8px">${e.name} (${e.studentCode})<br/>วิà¸à¸²: <b>${e.courseTitle||e.courseCode}</b> â à¸à¸¥à¹à¸à¸´à¸¡: <b>${e.grade}</b></div>`,options:r,placeholder:"à¹à¸¥à¸·à¸à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¹à¸«à¸¡à¹",confirmButtonText:"à¸à¸±à¸à¸à¸¶à¸",cancelButtonText:"ยà¸à¹à¸¥à¸´à¸",confirmButtonColor:"#4f46e5"});if(!i)return;c=i,x=i}else c="passed",x="à¸à¹à¸²à¸";J(e.key);try{if(s==="pass")if(e.flagKind==="course")await K(p(g,"school-settings",o,"courses",e.courseId,"grades",e.studentId),{grade:c,remark:ae(),status:ae()},{merge:!0});else{const i=e.activityCollectionName==="guidance-evaluations"?p(g,"school-settings",o,"guidance-evaluations",e.evalDocId):p(g,"school-settings",o,e.activityCollectionName,e.activityDocId,"evaluations",e.evalDocId),u=await L(i),k={...(u.exists()?u.data():{}).results||{}};k[e.studentId]={...k[e.studentId]||{},status:c};const A=Object.values(k).reduce((S,V)=>{const q=(V==null?void 0:V.status)||"pending";return S[q]=(S[q]||0)+1,S},{pending:0,passed:0,failed:0});await K(i,{results:k,summary:A,updatedAt:D(),updatedBy:(n==null?void 0:n.uid)||""},{merge:!0})}const r=N[e.key];if(r)await he(p(g,"school-settings",o,"remediation_requests",r.id),{status:"resolved",resolvedAt:D(),resolvedBy:(n==null?void 0:n.uid)||"",resolvedByName:(n==null?void 0:n.fullName)||"",newResult:x});else{const i={studentId:e.studentId,studentCode:e.studentCode,studentName:e.name,classLevel:e.classLevel,room:e.room,flagType:e.flagKind,originalGrade:e.grade,academicYear:e.academicYear,semester:e.semester,responsibleTeacherIds:e.responsibleTeacherIds||[],responsibleTeacherNames:e.teacherName?[e.teacherName]:[],status:"resolved",requestedAt:D(),requestedBy:(n==null?void 0:n.uid)||"",requestNote:s==="repeat"?"à¸à¸±à¸à¸à¸¶à¸à¹à¸à¹à¸à¹à¸£à¸µà¸¢à¸à¸à¹à¸³ (à¹à¸¡à¹à¹à¸à¸¥à¸µà¹à¸¢à¸à¹à¸à¸£à¸) à¹à¸à¸¢à¸à¹à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸²à¸£":"à¸à¸±à¸à¸à¸¶à¸à¹à¸à¸¢à¸à¹à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸²à¸£ (à¹à¸¡à¹à¸à¹à¸²à¸à¸à¸±à¹à¸à¸à¸à¸à¸à¸³à¸£à¹à¸à¸)",resolvedAt:D(),resolvedBy:(n==null?void 0:n.uid)||"",resolvedByName:(n==null?void 0:n.fullName)||"",newResult:x};e.flagKind==="course"?(i.courseId=e.courseId,i.courseCode=e.courseCode,i.courseTitle=e.courseTitle):(i.activityId=e.activityDocId,i.activityName=e.courseTitle||e.courseCode,i.evalDocId=e.evalDocId,e.teacherScopeKey&&(i.teacherScopeKey=e.teacherScopeKey)),await fe(se(g,"school-settings",o,"remediation_requests"),i)}h.fire({icon:"success",title:"à¸à¸±à¸à¸à¸¶à¸à¸à¸¥à¸ªà¸³à¹à¸£à¹à¸",t
6imer:1500,showConfirmButton:!1}),await z()}catch(r){console.error("Error correcting grade:",r),h.fire("à¸à¸´à¸à¸à¸¥à¸²à¸","à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸à¸±à¸à¸à¸¶à¸à¸à¸¥à¹à¸à¹","error")}finally{J(null)}},ce=async(e,s)=>{if(!o||!I)return;const c=s.newResult==="à¹à¸£à¸µà¸¢à¸à¸à¹à¸³";if((await h.fire({title:"ลà¸à¸à¸³à¸£à¹à¸à¸/à¸à¸¥à¸à¸²à¸£à¹à¸à¹à¸à¸±à¸§?",html:`<div style="text-align:left;font-size:13px;line-height:1.6"> 7 <p><b>${e.name}</b> (${e.studentCode})</p> 8 <p>วิà¸à¸²/à¸à¸´à¸à¸à¸£à¸£à¸¡: <b>${e.courseTitle||e.courseCode}</b></p> 9 <p style="margin-top:8px;color:#ef4444;font-weight:600"> 10 ${c?'à¸à¸°à¸¥à¸à¸à¸£à¸°à¸§à¸±à¸à¸´à¸à¸³à¸£à¹à¸à¸à¸à¸µà¹à¸à¸´à¹à¸ (à¹à¸¡à¹à¸à¸£à¸°à¸à¸à¹à¸à¸£à¸ à¹à¸à¸£à¸²à¸° "à¹à¸£à¸µà¸¢à¸à¸à¹à¸³" à¹à¸¡à¹à¹à¸à¹à¹à¸à¹à¹à¸à¹à¸à¸£à¸à¹à¸à¸´à¸¡)':`à¸à¸°à¸¥à¸à¸à¸£à¸°à¸§à¸±à¸à¸´à¸à¸³à¸£à¹à¸à¸à¸à¸µà¹à¸à¸´à¹à¸ à¹à¸¥à¸°à¸à¸·à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸à¸¥à¸±à¸à¹à¸à¹à¸ "${s.originalGrade||e.grade}" à¸à¸±à¸à¸à¸µ`} 11 </p> 12 <p style="margin-top:4px;font-size:12px;color:#9ca3af">à¹à¸à¹à¹à¸à¸à¸²à¸°à¸à¸£à¸à¸µà¸à¸±à¸à¸à¸¶à¸à¸à¸´à¸à¸à¸¥à¸²à¸à¸«à¸£à¸·à¸à¸à¸à¸ªà¸à¸à¹à¸à¹à¸²à¸à¸±à¹à¸ â à¸à¸²à¸£à¸¥à¸à¸à¸µà¹à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸¢à¹à¸à¸à¸à¸¥à¸±à¸à¹à¸à¹</p> 13 </div>`,icon:"warning",showCancelButton:!0,confirmButtonText:"ลà¸à¹à¸¥à¸°à¸à¸·à¸à¸à¹à¸²à¹à¸à¸´à¸¡",cancelButtonText:"ยà¸à¹à¸¥à¸´à¸",confirmButtonColor:"#ef4444"})).isConfirmed)try{if(!c)if(e.flagKind==="course"){const a=s.originalGrade||e.grade;await K(p(g,"school-settings",o,"courses",e.courseId,"grades",e.studentId),{grade:a},{merge:!0})}else{const a=e.activityCollectionName==="guidance-evaluations"?p(g,"school-settings",o,"guidance-evaluations",e.evalDocId):p(g,"school-settings",o,e.activityCollectionName,e.activityDocId,"evaluations",e.evalDocId),r=await L(a),u={...(r.exists()?r.data():{}).results||{}};u[e.studentId]={...u[e.studentId]||{},status:"failed"};const X=Object.values(u).reduce((k,A)=>{const S=(A==null?void 0:A.status)||"pending";return k[S]=(k[S]||0)+1,k},{pending:0,passed:0,failed:0});await K(a,{results:u,summary:X,updatedAt:D(),updatedBy:(n==null?void 0:n.uid)||""},{merge:!0})}await ye(p(g,"school-settings",o,"remediation_requests",s.id)),h.fire({icon:"success",title:"ลà¸à¹à¸¥à¸°à¸à¸·à¸à¸à¹à¸²à¹à¸à¸´à¸¡à¹à¸¥à¹à¸§",timer:1500,showConfirmButton:!1}),await z()}catch(a){console.error("Error deleting remediation request:",a),h.fire("à¸à¸´à¸à¸à¸¥à¸²à¸","à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸¥à¸à¸à¸³à¸£à¹à¸à¸à¹à¸à¹","error")}},P=e=>{if(!(e!=null&&e.seconds))return"-";const s=new Date(e.seconds*1e3);return`${s.getDate()} ${["ม.à¸.","à¸.à¸.","มี.à¸.","à¹à¸¡.ย.","à¸.à¸.","มิ.ย.","à¸.à¸.","ส.à¸.","à¸.ย.","à¸.à¸.","à¸.ย.","à¸.à¸."][s.getMonth()]} ${s.getFullYear()+543} ${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`},xe=()=>{const e=["à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²","ภาà¸à¹à¸£à¸µà¸¢à¸","ระà¸à¸±à¸à¸à¸±à¹à¸","à¸à¸¥à¸¸à¹à¸¡à¸ªà¸²à¸£à¸°","วิà¸à¸²","à¸à¸¥à¸¸à¹à¸¡","หà¹à¸à¸","à¸à¸¹à¹à¸ªà¸à¸","à¹à¸¥à¸à¸à¸µà¹","à¹à¸¥à¸à¸à¸£à¸°à¸à¸³à¸à¸±à¸§","à¸à¸·à¹à¸-à¸à¸²à¸¡à¸ªà¸à¸¸à¸¥","%","à¸à¸à¸à¸´","Grade","à¹à¸à¹à¸à¸±à¸§","à¹à¸£à¸µà¸¢à¸à¸à¹à¸³","วัà¸à¸à¸µà¹à¸¢à¸·à¹à¸à¸à¸³à¸£à¹à¸à¸","à¸à¸¹à¹à¸à¸±à¸à¸à¸¶à¸","วัà¸à¸à¸±à¸à¸à¸¶à¸à¸à¸¥"],s=v.map(a=>{const r=N[a.key],i=(r==null?void 0:r.status)==="resolved"&&r.newResult==="à¹à¸£à¸µà¸¢à¸à¸à¹à¸³",u=(r==null?void 0:r.status)==="resolved"&&!i;return[a.academicYear,a.semester,a.classLevel,a.subjectGroup||"",`${a.courseCode} ${a.courseTitle}`,a.groupName,a.room,a.teacherName,a.number,a.studentCode,a.name,a.percent??"",a.status==="normal"?"à¸à¸à¸à¸´":"",a.grade,u&&(r==null?void 0:r.newResult)||"",i?"à¹à¸£à¸µà¸¢à¸à¸à¹à¸³":"",P(r==null?void 0:r.requestedAt),(r==null?void 0:r.resolvedByName)||"",P(r==null?void 0:r.resolvedAt)]}),c=H.aoa_to_sheet([e,...s]),x=H.book_new();H.book_append_sheet(x,c,"ภาà¸à¸£à¸§à¸¡"),ke(x,"à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸_0_ร_มส_มà¸_à¹à¸¥à¸°à¹à¸¡à¹à¸¡à¸µà¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸.xlsx")};return t.jsx(me,{children:t.jsx("div",{className:`text-gray-900 dark:text-white transition-colors duration-300 min-h-screen overflow-x-hidden ${j?"px-2.5 py-3 pb-6":"p-4 sm:p-6 space-y-6"}`,children:t.jsxs("div",{className:`${j?"max-w-full":"max-w-[1800px]"} mx-auto min-w-0 ${j?"space-y-4":"space-y-6"}`,children:[j?t.jsx("div",{className:"mb-3 space-y-1.5",children:t.jsxs("div",{className:"flex items-center gap-2 bg-white dark:bg-[#2a2b2f]/60 backdrop-blur-sm px-3 py-2 rounded-xl border border-gray-200/50 dark:border-white/5",children:[t.jsx(ee,{to:"/academic/hub/zero-r-ms"}),t.jsx("div",{className:"p-1 bg-indigo-50 dark:bg-indigo-500/10 rounded-lg shrink-0",children:t.jsx(re,{className:"text-indigo-600 dark:text-indigo-400",size:14})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx("p",{className:"text-[11px] font-black text-gray-900 dark:text-white leading-none truncate",children:"à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ 0 ร มส มภà¹à¸¥à¸°à¹à¸¡à¹à¸¡à¸µà¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"})})]})}):t.jsx("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center mb-2 gap-4 bg-white dark:bg-[#2a2b2f]/60 backdrop-blur-sm p-5 rounded-[1.5rem] border border-gray-200/50 dark:border-white/5 transition-all duration-300",children:t.jsx("div",{className:"space-y-1 text-left",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ee,{to:"/academic/hub/zero-r-ms"}),t.jsx("div",{className:"p-2.5 bg-indigo-50 dark:bg-indigo-500/10 rounded-2xl shadow-sm border border-indigo-100 dark:border-indigo-500/20",children:t.jsx(re,{className:"text-indigo-600 dark:text-indigo-400",size:24})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-black text-gray-900 dark:text-white leading-tight tracking-tight",children:"à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ 0 ร มส มภà¹à¸¥à¸°à¹à¸¡à¹à¸¡à¸µà¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-xs font-bold pt-0.5",children:"à¸à¸£à¸§à¸à¸ªà¸à¸à¸à¸¥ / สรุà¸à¸à¸¥ à¸à¸¸à¸à¸§à¸´à¸à¸²à¸à¸±à¹à¸à¹à¸£à¸à¹à¸£à¸µà¸¢à¸"})]})]})})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[t.jsxs("button",{onClick:()=>f(""),className:`p-3 rounded-2xl border transition-all text-center ${d===""?"bg-indigo-50 border-indigo-200 dark:bg-indigo-900/20 dark:border-indigo-800/40 text-indigo-700 dark:text-indigo-300":"bg-white dark:bg-[#1e1f23] border-gray-100 dark:border-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[t.jsx("span",{className:"block text-[10px] font-black uppercase tracking-wider",children:"à¸à¸±à¹à¸à¸«à¸¡à¸"}),t.jsx("span",{className:"block text-2xl font-black mt-1",children:G.total})]}),t.jsxs("button",{onClick:()=>f("normal"),className:`p-3 rounded-2xl border transition-all text-center ${d==="normal"?"bg-emerald-50 border-emerald-200 dark:bg-emerald-900/20 dark:border-emerald-800/40 text-emerald-700 dark:text-emerald-300":"bg-white dark:bg-[#1e1f23] border-gray-100 dark:border-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[t.jsx("span",{className:"block text-[10px] font-black uppercase tracking-wider",children:"à¸à¸¥à¸à¸à¸à¸´"}),t.jsx("span",{className:"block text-2xl font-black mt-1",children:G.normal})]}),t.jsxs("button",{onClick:()=>f("มส"),className:`p-3 rounded-2xl border transition-all text-center ${d&&d!=="normal"&&d!=="none"?"bg-rose-50 border-rose-200 dark:bg-rose-900/20 dark:border-rose-800/40 text-rose-700 dark:text-rose-300":"bg-white dark:bg-[#1e1f23] border-gray-100 dark:border-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[t.jsx("span",{className:"block text-[10px] font-black uppercase tracking-wider",children:"à¸à¸´à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"}),t.jsx("span",{className:"block text-2xl font-black mt-1",children:G.flagged})]}),t.jsxs("button",{onClick:()=>f("none"),className:`p-3 rounded-2xl border transition-all text-center ${d==="none"?"bg-gray-100 border-gray-300 dark:bg-gray-800 dark:border-gray-700 text-gray-700 dark:text-gray-300":"bg-white dark:bg-[#1e1f23] border-gray-100 dark:border-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[t.jsx("span",{className:"block text-[10px] font-black uppercase tracking-wider",children:"à¹à¸¡à¹à¸¡à¸µà¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"}),t.jsx("span",{className:"block text-2xl font-black mt-1",children:G.none})]})]}),t.jsxs("div",{className:"bg-white dark:bg-[#1e1f23] rounded-3xl shadow-md border border-gray-100 dark:border-gray-800 overflow-hidden",children:[t.jsxs("div",{className:"border-b border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-white/[0.02] p-4 space-y-3",children:[t.jsx(ge,{schoolId:o,academicYear:B,onAcademicYearChange:Q,semester:R,onSemesterChange:de}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx("span",{className:"absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-gray-400",children:t.jsx(te,{size:16})}),t.jsx("input",{type:"text",value:y,onChange:e=>ie(e.target.value),onKeyDown:e=>{e.key==="Enter"&&w(1)},placeholder:"à¸à¹à¸à¸«à¸²à¸à¸²à¸ à¹à¸¥à¸à¸à¸£à¸°à¸à¸³à¸à¸±à¸§ à¸à¸·à¹à¸ à¸à¸²à¸¡à¸ªà¸à¸¸à¸¥",className:"w-full h-10 pl-9 pr-4 rounded-xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-[#151619] text-gray-800 dark:text-gray-200 placeholder-gray-400 focus:ring-2 focus:ring-indigo-500 outline-none text-xs font-bold transition"})]}),t.jsxs("button",{onClick:()=>
13w(1),title:"à¸à¹à¸à¸«à¸²",className:"h-10 px-4 rounded-xl bg-teal-500 hover:bg-teal-600 text-white flex items-center justify-center gap-1.5 font-black text-xs shadow-sm transition",children:[t.jsx(te,{size:13})," à¹à¸"]}),t.jsxs("select",{value:d,onChange:e=>f(e.target.value),className:"h-10 px-3 rounded-xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-[#151619] text-xs font-bold outline-none focus:ring-2 focus:ring-indigo-500",children:[t.jsx("option",{value:"",children:"à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸: à¸à¸±à¹à¸à¸«à¸¡à¸"}),t.jsx("option",{value:"0",children:"à¸à¸´à¸ 0"}),t.jsx("option",{value:"ร",children:"à¸à¸´à¸ ร"}),t.jsx("option",{value:"มส",children:"à¸à¸´à¸ มส"}),t.jsx("option",{value:"มà¸",children:"à¸à¸´à¸ มà¸"}),t.jsx("option",{value:"normal",children:"à¸à¸à¸à¸´"}),t.jsx("option",{value:"none",children:"à¹à¸¡à¹à¸¡à¸µà¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"})]})]})]}),!m&&v.length>0&&t.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 px-4 py-3 border-b border-gray-100 dark:border-gray-800",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:z,disabled:m,title:"รีà¹à¸à¸£à¸à¸à¹à¸à¸¡à¸¹à¸¥",className:"flex items-center justify-center w-9 h-9 rounded-xl bg-rose-50 dark:bg-rose-950/40 text-rose-500 dark:text-rose-400 border border-rose-100 dark:border-rose-900/50 hover:bg-rose-100 dark:hover:bg-rose-950/80 shadow-sm transition disabled:opacity-60",children:t.jsx(Z,{size:15,className:m?"animate-spin":""})}),t.jsx("button",{onClick:xe,title:"สà¹à¸à¸à¸à¸ Excel",className:"flex items-center justify-center w-9 h-9 rounded-xl bg-emerald-600 hover:bg-emerald-700 text-white shadow-sm transition",children:t.jsx(Se,{size:15})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>w(e=>Math.max(1,e-1)),disabled:C<=1,className:"w-8 h-8 flex items-center justify-center rounded-lg border border-gray-200 dark:border-gray-700 text-gray-500 disabled:opacity-30",children:t.jsx(Ie,{size:14})}),t.jsxs("span",{className:"text-xs font-bold text-gray-600 dark:text-gray-300 whitespace-nowrap",children:["หà¸à¹à¸² ",C," à¸à¸à¸ ",O," (",v.length," รายà¸à¸²à¸£)"]}),t.jsx("button",{onClick:()=>w(e=>Math.min(O,e+1)),disabled:C>=O,className:"w-8 h-8 flex items-center justify-center rounded-lg border border-gray-200 dark:border-gray-700 text-gray-500 disabled:opacity-30",children:t.jsx(Te,{size:14})}),t.jsx("select",{value:$,onChange:e=>oe(Number(e.target.value)),className:"h-8 px-2 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-[#151619] text-xs font-bold outline-none",children:ze.map(e=>t.jsxs("option",{value:e,children:[e," / หà¸à¹à¸²"]},e))})]})]}),m?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 space-y-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-indigo-500"}),t.jsx("p",{className:"text-gray-400 dark:text-gray-500 text-sm font-bold",children:"à¸à¸³à¸¥à¸±à¸à¹à¸«à¸¥à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸ าà¸à¸£à¸§à¸¡..."})]}):v.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center px-4",children:[t.jsx(Be,{className:"h-14 w-14 text-gray-300 dark:text-gray-700 mb-3"}),t.jsx("h3",{className:"font-extrabold text-gray-700 dark:text-gray-300 text-lg",children:"à¹à¸¡à¹à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸¡à¹à¸à¸·à¹à¸à¸à¹à¸"})]}):t.jsx(t.Fragment,{children:t.jsx("div",{children:t.jsxs("table",{className:"w-full table-fixed text-left border-collapse",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-gray-50/50 dark:bg-white/[0.02] border-b border-gray-100 dark:border-gray-800",children:[t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider text-center w-[7%]",children:"à¸à¸µ/à¹à¸à¸à¸¡"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider text-center w-[9%]",children:"à¸à¸±à¹à¸/หà¹à¸à¸/
13à¸à¸¥à¸¸à¹à¸¡"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider w-[20%]",children:"à¸à¸¥à¸¸à¹à¸¡à¸ªà¸²à¸£à¸° / วิà¸à¸² / à¸à¸¹à¹à¸ªà¸à¸"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider text-center w-[7%]",children:"à¹à¸¥à¸à¸à¸µà¹ / รหัส"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider w-[14%]",children:"à¸à¸·à¹à¸-à¸à¸²à¸¡à¸ªà¸à¸¸à¸¥"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider text-center w-[6%]",children:"%"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider text-center w-[6%]",children:"à¸à¸à¸à¸´"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider text-center w-[6%]",children:"Grade"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider text-center w-[13%]",children:"à¹à¸à¹à¸à¸±à¸§ / à¹à¸£à¸µà¸¢à¸à¸à¹à¸³"}),t.jsx("th",{className:"px-2 py-4 text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-wider w-[12%]",children:"ยืà¹à¸à¸à¸³à¸£à¹à¸à¸ / à¸à¸±à¸à¸à¸¶à¸à¸à¸¥"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-50 dark:divide-gray-800/50",children:le.map(e=>{const s=N[e.key],c=(s==null?void 0:s.status)==="resolved",x=c&&(s==null?void 0:s.newResult)==="à¹à¸£à¸µà¸¢à¸à¸à¹à¸³",a=c&&!x;return t.jsxs("tr",{className:`hover:bg-gray-50/50 dark:hover:bg-white/[0.02] transition-colors ${e.status==="flag"?"bg-rose-50/30 dark:bg-rose-500/[0.03]":""}`,children:[t.jsx("td",{className:"px-2 py-3.5 text-center",children:t.jsxs("span",{className:"text-sm font-bold text-gray-600 dark:text-gray-300",children:[e.academicYear,"/",e.semester]})}),t.jsxs("td",{className:"px-2 py-3.5 text-center",children:[t.jsxs("span",{className:"text-sm font-bold text-gray-600 dark:text-gray-300",children:[e.classLevel,"/",e.room||"-"]}),t.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:["à¸à¸¥à¸¸à¹à¸¡ ",e.groupName]})]}),t.jsxs("td",{className:"px-2 py-3.5",children:[e.subjectGroup&&t.jsx("p",{className:"text-[10px] font-bold text-indigo-500 dark:text-indigo-400 truncate uppercase tracking-wide",children:e.subjectGroup}),t.jsxs("p",{className:"text-sm font-bold truncate text-gray-900 dark:text-white",children:[e.courseCode," ",e.courseTitle]}),t.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:e.teacherName})]}),t.jsxs("td",{className:"px-2 py-3.5 text-center",children:[t.jsx("span",{className:"text-sm font-bold text-gray-600 dark:text-gray-300",children:e.number||"-"}),t.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:e.studentCode})]}),t.jsx("td",{className:"px-2 py-3.5",children:t.jsx("p",{className:"text-sm font-bold truncate text-gray-900 dark:text-white",children:e.name})}),t.jsx("td",{className:"px-2 py-3.5 text-center",children:t.jsx("span",{className:"text-sm font-bold tabular-nums text-gray-700 dark:text-gray-300",children:e.percent??"-"})}),t.jsx("td",{className:"px-2 py-3.5 text-center",children:t.jsx("span",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400",children:e.status==="normal"?"à¸à¸à¸à¸´":"-"})}),t.jsx("td",{className:"px-2 py-3.5 text-center",children:t.jsx("span",{className:`inline-flex px-2.5 py-1 rounded-md text-sm font-black border ${e.status==="flag"?"bg-rose-50 text-rose-600 border-rose-200 dark:bg-rose-500/10 dark:text-rose-400 dark:border-rose-500/20":"bg-slate-50 text-slate-500 border-slate-200 dark:bg-slate-500/10 dark:text-slate-400 dark:border-slate-500/20"}`,children:e.grade})}),t.jsx("td",{className:"px-2 py-3.5 text-center",children:e.status!=="flag"?t.jsx("span",{className:"text-sm text-gray-300 dark:text-gray-700",children:"-"}):a?t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-black px-2.5 py-1.5 rounded-lg bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300",children:[t.jsx(ne,{size:13})," ",s==null?void 0:s.newResult]}):x?t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-black px-2.5 py-1.5 rounded-lg bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",children:[t.jsx(ne,{size:13})," à¹à¸£à¸µà¸¢à¸à¸à¹à¸³"]}):t.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[t.jsx("button",{onClick:()=>
13W(e,"pass"),disabled:E===e.key,title:"à¹à¸à¹à¸à¸±à¸§",className:"inline-flex items-center justify-center w-8 h-8 rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 transition-all disabled:opacity-50",children:E===e.key?t.jsx(Z,{size:14,className:"animate-spin"}):t.jsx(ue,{size:14})}),t.jsx("button",{onClick:()=>W(e,"repeat"),disabled:E===e.key,title:"à¹à¸£à¸µà¸¢à¸à¸à¹à¸³",className:"inline-flex items-center justify-center w-8 h-8 rounded-lg bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300 hover:bg-amber-200 dark:hover:bg-amber-900/50 transition-all disabled:opacity-50",children:E===e.key?t.jsx(Z,{size:14,className:"animate-spin"}):t.jsx(pe,{size:14})})]})}),t.jsx("td",{className:"px-2 py-3.5",children:t.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[t.jsxs("div",{className:"min-w-0",children:[(s==null?void 0:s.requestedAt)&&t.jsxs("p",{className:"text-[11px] text-sky-500 dark:text-sky-400 whitespace-nowrap",children:["ยืà¹à¸: ",P(s.requestedAt)]}),t.jsx("p",{className:"text-xs font-bold text-gray-500 dark:text-gray-400 truncate",children:(s==null?void 0:s.resolvedByName)||"-"}),t.jsx("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 whitespace-nowrap",children:s!=null&&s.resolvedAt?`à¸à¸±à¸à¸à¸¶à¸: ${P(s.resolvedAt)}`:""})]}),I&&(s==null?void 0:s.status)==="resolved"&&t.jsx("button",{onClick:()=>ce(e,s),title:"ลà¸à¸à¸³à¸£à¹à¸à¸/à¸à¸·à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¹à¸à¸´à¸¡ (Super Admin)",className:"shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md text-gray-300 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-500/10 transition-colors",children:t.jsx(Re,{size:12})})]})})]},e.key)})})]})})})]})]})})})};export{gt 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.