1import{j as e}from"./vendor-markdown-3uENCkuS.js";import{r as c,u as ts,d as ss}from"./vendor-react-router-fbnoKto0.js";import{ak as Ct,M as Vt,k as ue,I as as,l as Ve,D as vt,F as At,S as ls,O as ns,T as os,s as Se}from"./vendor-antd-CYdTsTmT.js";import{j as Mt}from"./vendor-redux-De8h7f6b.js";import{P as s,gv as rs,sy as is,sz as Ft,nX as ds,sA as cs,cb as It,sB as us,sC as ms,sD as xs,sE as ps,sF as hs,sG as gs,sH as bs,sI as fs}from"./index-B9eRcFVf.js";import{O as Ye,d2 as js,U as nt,I as Ge,eb as Ss,Q as Ns,a7 as Yt,aB as ws,fW as ys,aX as Dt,fF as _t,aC as vs,bg as Es,aF as Et,K as Gt,av as Wt,S as Ts,T as Pt,a5 as lt,aa as St,aj as Cs,aY as Ds,L as _s,J as Ut,fX as ks,be as Rs,fY as Ls,an as As}from"./vendor-icons-l8SD0IkB.js";import{u as Ms}from"./useProjectHubDocumentTitle-BT8mFKEB.js";import{C as Fs,a as Is}from"./CabinAvailabilityView-DeEgZFWv.js";import Ps from"./MentorAvailability-By3oNCdE.js";import{a as Us}from"./projectHubAccess-BXH-or02.js";import"./vendor-react-dom-CekZHfxh.js";import"./vendor-reactflow-IXhngCNR.js";import"./vendor-recharts-CJ0LSBh7.js";import"./vendor-syntax-highlighter-1lJlPebH.js";import"./Shimmer-CD_6GKbf.js";const $s={PENDING:{bg:"bg-amber-100 dark:bg-amber-950/60",text:"text-amber-800 dark:text-amber-300",border:"border-amber-300 dark:border-amber-800",label:"Pending"},SUBMITTED:{bg:"bg-blue-100 dark:bg-blue-950/60",text:"text-blue-800 dark:text-blue-300",border:"border-blue-300 dark:border-blue-800",label:"Submitted"},SLOT_ASSIGNED:{bg:"bg-purple-100 dark:bg-purple-950/60",text:"text-purple-800 dark:text-purple-300",border:"border-purple-300 dark:border-purple-800",label:"Slot Assigned"},EVALUATED:{bg:"bg-emerald-100 dark:bg-emerald-950/60",text:"text-emerald-800 dark:text-emerald-300",border:"border-emerald-300 dark:border-emerald-800",label:"Evaluated"}};function kt({status:t}){if(!t||t.toUpperCase()==="PENDING")return null;const a=$s[t];return a?e.jsxs("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold border ${a.bg} ${a.text} ${a.border} transition-colors`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current mr-1.5"}),a.label]}):null}kt.propTypes={status:s.string};kt.defaultProps={status:null};const He="#2333CB",it="#EEF0FB",$t="#1A26A8";function qt({t,idx:a,slots:o,handleOpenSchedulerModal:p,handleEditClick:v,handleRevertSubmissionClick:E,revertingSubmissionId:S,canRevertSubmission:N}){var ce,we,ve,me,se,fe,Ne,_,Z,xe,Q,l,h,le,De,Le,Oe,_e,ke,Ae,Ee;const[r,i]=c.useState(!1),[g,w]=c.useState(75),[B,y]=c.useState(!1),[M,k]=c.useState(!1);c.useEffect(()=>{if(!r||M)return;let u=!0;return y(!0),rs().then(G=>{const ne=Number(G==null?void 0:G.reReviewThreshold);u&&Number.isFinite(ne)&&w(ne)}).catch(()=>{}).finally(()=>{u&&(k(!0),y(!1))}),()=>{u=!1}},[r,M]);const T=o.find(u=>String(u.teamId)===String(t.teamId)&&String(u.moduleId||"")===String(t.moduleId||"")),R=!!T,Y=t.projectTitle||((ce=t.submission)==null?void 0:ce.project_title)||((we=t.submission)==null?void 0:we.projectTitle)||"Untitled Project",H=t.projectDescription||((ve=t.submission)==null?void 0:ve.project_description)||((me=t.submission)==null?void 0:me.projectDescription)||"No description provided.",re=t.githubRepoUrl||((se=t.submission)==null?void 0:se.github_repo_url)||((fe=t.submission)==null?void 0:fe.githubRepoUrl),K=t.liveUrl||((Ne=t.submission)==null?void 0:Ne.live_url)||((_=t.submission)==null?void 0:_.liveUrl),U=((Z=t.submission)==null?void 0:Z.ppt_url)||((xe=t.submission)==null?void 0:xe.pptUrl),C=((Q=t.submission)==null?void 0:Q.video_url)||((l=t.submission)==null?void 0:l.videoUrl),D=t.techStack||((h=t.submission)==null?void 0:h.tech_stack)||((le=t.submission)==null?void 0:le.techStack)||[],m=Array.isArray(D)?D:typeof D=="str
1ing"?D.split(",").map(u=>u.trim()):[],b=t.members||t.teamMembers||[],F=b.find(u=>u.isLeader||u.studentId===t.leaderStudentId)||b[0],z=F?F.studentName||F.codegnanId||F.studentId:"N/A",ae=b.length||1,L=Array.isArray(t.reReviewHistory)?[...t.reReviewHistory].reverse():[];!L.length&&t.reReviewEvaluation&&L.push({recordedAt:t.reReviewEvaluation.updatedAt||t.reReviewEvaluation.updated_at,requestedBy:"LEGACY",statusBeforeReview:"EVALUATED",evaluation:t.reReviewEvaluation});const q=new Set,$=L.filter(u=>{const G=u.evaluation||{},ne=JSON.stringify({projectScore:G.project_score??G.groupMarks??null,students:(G.students||[]).map(ge=>({id:ge.student_id||ge.studentId||"",score:ge.total_score??ge.totalScore??null,marks:ge.individual_marks??ge.individualMarks??null})).sort((ge,oe)=>String(ge.id).localeCompare(String(oe.id)))});return q.has(ne)?!1:(q.add(ne),!0)}),ie=new Map(b.map(u=>[String(u.studentId||u.student_id||u.id||""),u.studentName||u.student_name||u.name||""])),he=u=>u&&!Number.isNaN(Date.parse(u))?new Date(u).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,ye=he(t.projectDeadline)||"Flexible",O=((De=t.submission)==null?void 0:De.submitted_at)||((Le=t.submission)==null?void 0:Le.submittedAt)||null,I=!!O,de=he(O)||"Final Submit Pending",be=(typeof t.programCoordinator=="string"?t.programCoordinator:((Oe=t.programCoordinator)==null?void 0:Oe.fullName)||((_e=t.programCoordinator)==null?void 0:_e.full_name)||((ke=t.programCoordinator)==null?void 0:ke.name))||((Ae=t.program_coordinator)==null?void 0:Ae.name)||t.programCoordinatorName||t.program_coordinator_name||"N/A";return e.jsxs("div",{className:"flex min-w-0 w-full flex-col overflow-hidden rounded-xl border transition-all duration-250 hover:shadow-lg slots-page-card-enter",style:{borderColor:R?"rgba(5,150,105,0.25)":"rgba(35,51,203,0.15)",animationDelay:`${a*40}ms`},onMouseEnter:u=>{u.currentTarget.style.borderColor=R?"rgba(5,150,105,0.5)":He},onMouseLeave:u=>{u.currentTarget.style.borderColor=R?"rgba(5,150,105,0.25)":"rgba(35,51,203,0.15)"},children:[e.jsxs("div",{className:"px-5 py-4",style:{background:R?"linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 100%)":`linear-gradient(135deg, ${it} 0%, #F8F9FF 100%)`},children:[e.jsxs("div",{className:"flex flex-col gap-2.5 sm:flex-row sm:items-start sm:justify-between sm:gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-white text-xs font-bold flex-shrink-0",style:{background:R?"linear-gradient(135deg,#059669,#047857)":`linear-gradient(135deg, ${He}, ${$t})`},children:(t.teamName||Y).charAt(0).toUpperCase()}),e.jsx("h4",{className:"break-words text-sm font-bold leading-snug text-slate-900",children:Y})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 pl-9 text-xs font-medium text-slate-500",children:[e.jsx("span",{className:"flex-shrink-0 whitespace-nowrap",children:t.teamName||`Team ${t.teamId}`}),t.batchId&&e.jsx("span",{className:"flex-shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[9px] font-bold",style:{background:it,color:He},children:t.batchId})]})]}),e.jsxs("div",{className:"flex flex-row sm:flex-col items-center sm:items-end justify-start gap-1.5 flex-shrink-0 pl-9 sm:pl-0",children:[e.jsx(kt,{status:t.status}),R&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full bg-emerald-100 text-emerald-700 text-[9px] font-bold uppercase tracking-wide",children:[e.jsx(Ye,{size:8}),"Slot Assigned"]})]})]}),e.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2",children:[e.jsx("div",{className:"flex min-w-0 flex-wrap gap-1",children:(Ee=t.modules)==null?void 0:Ee.map(u=>e.jsx("span",{className:"px-2 py-0.5 text-[10px] font-bold rounded-md",style:{background:it,color:He},children:u},u))}),be!=="N/A"&&e.jsxs("span",{className:"max-w-[180px] flex-shrink-0 truncate rounded-full border border-indigo-100 bg-white/80 px-2 py-1 text-[9px] font-bold text-indigo-700",title:`Program Coordinator: ${be}`,children:["PC: ",be]})]})]}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-3 bg-white px-5 py-4",children:[e.jsx("p",{className:"break-words text-xs leading-relaxed text-slate-600 line-clamp-3",children:H}),e.jsx("div",{className:"grid min-w-0 grid-cols-2 gap-2",children:[{label:"Team Lead",value:z,icon:e.jsx(js,{size:9})},{label:"Members",value:ae,icon:e.jsx(nt,{size:9})},{label:"Deadline",value:ye,icon:e.jsx(Ge,{size:9})},{label:"Submitted On",value:de,pending:!I,icon:e.jsx(Ye,{size:9})}].map(u=>e.jsxs("div",{className:"min-w-0 rounded-lg p-2",style:{background:"#F8F9FF",border:"1px solid #EEF0FB"},children:[e.jsxs("span",{className:"mb-0.5 flex min-w-0 items-center gap-1 overflow-hidden text-[9px] font-bold uppercase tracking-wider text-slate-400",children:[e.jsx("span",{style:{color:He},children:u.icon}),u.label]}),e.jsx("span",{className:"block min-w-0 truncate text-xs font-bold text-slate-800",style:u.pending?{color:"#C2410C"}:void 0,children:u.value})]},u.label))}),m.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:m.map((u,G)=>e.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold rounded-md bg-slate-100 text-slate-600",children:u},G))}),R&&(T.cabinName||T.cabin_name)&&e.jsxs("div",{className:"rounded-lg border border-emerald-100 bg-emerald-50 px-2.5 py-2",children:[e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider text-emerald-600",children:"Cabin"}),e.jsxs("span",{className:"mt-0.5 block truncate text-xs font-bold text-emerald-800",children:[T.cabinName||T.cabin_name,(T.cabinLocation||T.cabin_location)&&` â ${T.cabinLocation||T.cabin_location}`]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{url:re,label:"GitHub",icon:e.jsx(Ss,{size:11}),color:"#1F2937"},{url:K,label:"Live Demo",icon:e.jsx(Ns,{size:11}),color:"#2563EB"},{url:U,label:"PPT",icon:e.jsx(Yt,{size:11}),color:"#D97706"},{url:C,label:"Video",icon:e.jsx(ws,{size:11}),color:"#DC2626"}].filter(u=>u.url).map(u=>e.jsxs("a",{href:u.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2.5 py-1 text-[10px] font-semibold rounded-lg border bg-white transition-all duration-150 hover:shadow-sm",style:{borderColor:"rgba(0,0,0,0.1)",color:u.color},title:u.url,children:[u.icon,u.label]},u.label))}),b.length>0&&e.jsxs("div",{className:"pt-2 border-t",style:{borderColor:"#F1F5F9"},children:[e.jsxs("span",{className:"text-[9px] uppercase tracking-widest text-slate-400 font-bold block mb-1.5",children:["Team Members (",b.length,")"]}),e.jsxs("div",{className:"space-y-1",children:[b.slice(0,3).map(u=>{const G=u.codegnanId||u.codegnan_id||"",ne=u.phoneNumber||u.phone_number||u.studentPhNumber||"";return e.jsxs("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("span",{className:"font-medium text-slate-700 truncate flex items-center gap-1",children:[u.studentName||u.codegnanId||u.studentId,u.isLeader&&e.jsx("span",{className:"text-amber-500 text-xs",children:"â
"})]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap gap-x-2 text-[9px] text-slate-400",children:[e.jsxs("span",{children:["Student ID: ",G||"â"]}),e.jsxs("span",{children:["Phone: ",ne||"â"]})]})]}),u.roleInProject&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold truncate max-w-[45%]",style:{background:it,color:He},children:u.roleInProject})]},u.studentId||u.codegnanId)}),b.length>3&&e.jsxs("div",{className:"text-[10px] text-slate-400 font-medium",children:["+",b.length-3," more member",b.length-3>1?"s":""]})]})]})]}),e.jsx("div",{className:"slots-page-card-footer px-5 py-3 flex items-center justify-between gap-2",style:{background:"#FAFBFF",borderTop:"1px solid #EEF0FB"},children:e.jsxs("div",{className:"slots-page-card-actions flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-slate-400 flex items-center gap-1",children:[e.jsx(nt,{size:11})," ",ae]}),$.length>0&&e.jsx("button",{type:"button",onClick:()=>i(!0),className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-1.5 text-xs font-bold text-indigo-700 transition-all duration-200 hover:bg-indigo-100",children:"Previous Review"}),N&&I&&e.jsx(Ct,{title:"Revert this final submission?",description:"The student will be able to edit and submit the project again.",okText:"Revert",cancelText:"Cancel",onConfirm:()=>E(t),children:e.jsxs("button",{type:"button",disabled:S===`${t.teamId}-${t.moduleId||"team"}`,className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-lg px-3.5 py-1.5 text-xs font-bold transition-all duration-200 hover:shadow-sm disabled:cursor-not-allowed disabled:opacity-60",style:{background:"#FFF7ED",color:"#C2410C",border:"1px solid #FED7AA"},children:[e.jsx(ys,{size:11}),"Revert"]})}),R?e.jsxs("button",{onClick:()=>{T&&v(T)},className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all duration-200 hover:shadow-sm",style:{background:"#ECFDF5",color:"#059669",border:"1px solid rgba(5,150,105,0.25)"},children:[e.jsx(_t,{size:11}),"View / Edit Slot"]}):e.jsxs("button",{onClick:()=>{I&&p(t,{id:t.moduleId})},disabled:!I,title:I?"Schedule evaluation slot":"Final submission is required before scheduling a slot",className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap px-3.5 py-1.5 rounded-lg text-xs font-bold text-white transition-all duration-200 hover:shadow-md active:scale-95",style:{background:I?`linear-gradient(135deg, ${He} 0%, ${$t} 100%)`:"#FFF7ED",color:I?"#FFFFFF":"#C2410C",border:I?"none":"1px solid #FED7AA",curs
1or:I?"pointer":"not-allowed"},children:[e.jsx(Dt,{size:11}),"Schedule Slot"]})]})}),e.jsxs(Vt,{open:r,onCancel:()=>i(!1),footer:null,title:"Previous Reviews",width:640,destroyOnClose:!0,children:[e.jsx("div",{className:"mb-4 rounded-xl border border-indigo-100 bg-gradient-to-r from-indigo-50 to-slate-50 px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-extrabold uppercase tracking-wider text-indigo-700",children:"Individual threshold check"}),e.jsx("p",{className:"mt-1 text-xs text-slate-600",children:"Only students scoring below the threshold require re-review."})]}),e.jsx("span",{className:"rounded-full border border-indigo-200 bg-white px-3 py-1 text-xs font-extrabold text-indigo-700",children:B?"Loading...":`Below ${g}%`})]})}),e.jsx("div",{className:"max-h-[60vh] space-y-4 overflow-y-auto pr-1",children:$.map((u,G)=>{const ne=u.evaluation||{},ge=Array.isArray(ne.students)?ne.students:[],oe=Number(ne.threshold??u.threshold),Me=Number.isFinite(oe)?oe:g;return e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-slate-50 p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-xs font-bold text-slate-800",children:["Review ",$.length-G]}),e.jsx("span",{className:"text-[10px] font-semibold text-slate-500",children:u.recorded_at||u.recordedAt?new Date(u.recorded_at||u.recordedAt).toLocaleString():"Date unavailable"})]}),e.jsxs("p",{className:"mt-1 text-[11px] text-slate-600",children:["Requested by:"," ",u.requested_by||u.requestedBy||"â"," · ","Previous status: ",u.status_before_review||"â"]}),e.jsxs("p",{className:"mt-2 text-xs font-semibold text-slate-700",children:["Project score: ",ne.project_score??"â"," / 50"]}),e.jsx("div",{className:"mt-2 flex items-center justify-end",children:e.jsxs("span",{className:"rounded-full bg-indigo-50 px-2.5 py-1 text-[10px] font-bold text-indigo-700",children:["Threshold: ",Me,"% · scores below require re-review"]})}),e.jsx("p",{className:"mt-3 text-[10px] font-extrabold uppercase tracking-wider text-slate-400",children:"Student scores"}),ge.length>0&&e.jsx("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:ge.map((ee,Qe)=>{const Ie=Number(ee.total_score??ee.totalScore),Te=Number.isFinite(Ie)&&Ie<Me;return e.jsxs("div",{className:`rounded-xl border px-3 py-2.5 ${Te?"border-amber-200 bg-amber-50":"border-emerald-200 bg-emerald-50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-[11px] font-bold text-slate-800",children:[ie.get(String(ee.student_id||ee.studentId||""))||ee.studentName||ee.student_name||ee.student_id||ee.studentId||"Student",": ",ee.total_score??"â","%"]}),e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-[10px] font-bold text-slate-600",children:[Te?e.jsx(vs,{size:11,className:"text-amber-600"}):e.jsx(Ye,{size:11,className:"text-emerald-600"}),e.jsx("span",{className:Te?"text-amber-700":"text-emerald-700",children:Te?`RE-REVIEW REQUIRED · below ${Me}%`:"Threshold met · no re-review required"})]})]},ee.student_id||ee.studentId||Qe)})})]},`${u.recorded_at||u.recordedAt||G}-${G}`)})})]})]},t.cardId)}qt.propTypes={t:s.object.isRequired,idx:s.number,slots:s.array,handleOpenSchedulerModal:s.func,handleEditClick:s.func,handleRevertSubmissionClick:s.func,revertingSubmissionId:s.string,canRevertSubmission:s.bool};const st="#2333CB",Nt="#EEF0FB",Os="#1A26A8",$e=(t,...a)=>a.map(o=>t==null?void 0:t[o]).find(o=>o!=null&&o!=="")||"";function at({icon:t,label:a,value:o,accent:p=!1}){return e.jsxs("div",{className:"min-w-0 rounded-xl border border-slate-100 bg-slate-50/80 px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-wider text-slate-400",children:[e.jsx("span",{style:{color:st},children:t}),a]}),e.jsx("p",{className:`mt-1 truncate text-xs font-semibold ${p?"text-orange-700":"text-slate-700"}`,title:o,children:o||"Not assigned"})]})}function Jt({record:t,activeView:a,getTeamName:o,getTeamById:p,getProjectTitle:v,mentors:E=[],handleEditClick:S,handleDeleteClick:N}){var D,m;const r=p(t.teamId),i=$e(t,"teamName","team_name")||o(t.teamId),g=$e(t,"batch","batchId","batch_id","batchName","batch_name")||$e(r,"batchId","batch_id","batch"),B=((r==null?void 0:r.moduleDetails)||(r==null?void 0:r.module_details)||[]).find(b=>String(b.id||b.moduleId||b.module_id||"")===String(t.moduleId||t.module_id||"")),y=$e(t,"moduleName","module_name")||((D=B==null?void 0:B.modules)==null?void 0:D.filter(
1Boolean).join(", "))||(((m=r==null?void 0:r.modules)==null?void 0:m.length)===1?r.modules[0]:"")||"Not available",M=$e(t,"projectTitle","project_title","projectName","project_name")||(r?v(r):"Untitled Project"),k=E.find(b=>String(b.id||b.mentor_id||b.empId||b._id||b.name||"")===String(t.mentorId||t.mentor_id||"")),T=$e(t,"mentorName","mentor_name")||(k==null?void 0:k.name)||t.mentorId||"Not assigned",R=$e(t,"cabinName","cabin_name")||"Not assigned",Y=$e(t,"cabinLocation","cabin_location"),H=b=>b?ue(`2026-01-01T${b}`).format("hh:mm A"):"Not set",re=t.slotDate?ue(t.slotDate).format("MMM DD, YYYY"):"Not set",K=`${H(t.startTime)} â ${H(t.endTime)}`,U=String(t.evaluationStatus||t.evaluation_status||"").toUpperCase()==="EVALUATED",C=a==="RESCHEDULED_SLOTS"?"Rescheduled":"Scheduled";return e.jsxs("article",{className:"slots-mobile-card min-w-0 overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:[e.jsxs("div",{className:"border-b border-slate-100 bg-gradient-to-br from-indigo-50 to-white px-4 py-3.5",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl text-sm font-bold text-white shadow-sm",style:{background:`linear-gradient(135deg, ${st}, ${Os})`},children:i.charAt(0).toUpperCase()||"T"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-[10px] font-bold uppercase tracking-wider text-slate-400",children:i}),e.jsx("h3",{className:"mt-0.5 truncate text-sm font-bold text-slate-900",children:M})]}),e.jsx("span",{className:"flex-shrink-0 rounded-full px-2 py-1 text-[9px] font-bold uppercase tracking-wide",style:{background:Nt,color:st},children:C})]}),e.jsxs("div",{className:"mt-3 flex min-w-0 flex-wrap gap-1.5",children:[g&&e.jsx("span",{className:"rounded-md bg-white px-2 py-1 text-[10px] font-semibold text-slate-600 ring-1 ring-slate-200",children:g}),e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-semibold",style:{background:Nt,color:st},children:[e.jsx(Es,{size:10}),e.jsx("span",{className:"truncate",children:y})]})]})]}),e.jsxs("div",{className:"grid min-w-0 grid-cols-2 gap-2 p-4",children:[e.jsx(at,{icon:e.jsx(Ge,{size:10}),label:"Date",value:re}),e.jsx(at,{icon:e.jsx(Et,{size:10}),label:"Time",value:K}),e.jsx(at,{icon:e.jsx(nt,{size:10}),label:"Mentor",value:T}),e.jsx(at,{icon:e.jsx(Gt,{size:10}),label:"Cabin",value:Y?`${R} · ${Y}`:R})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-slate-100 bg-slate-50/60 px-4 py-3",children:[e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full px-2.5 py-1 text-[10px] font-bold uppercase tracking-wide",style:U?{background:"#E8F5E9",color:"#2E7D32"}:{background:"#FFF3E0",color:"#E65100"},children:[U?e.jsx(Ye,{size:10}):e.jsx(Et,{size:10}),U?"Evaluated":"Pending"]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>S(t),className:"inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-semibold transition-colors",style:{background:Nt,color:st,border:"1px solid rgba(35,51,203,0.18)"},children:[e.jsx(_t,{size:12}),"Edit"]}),e.jsx(Ct,{title:"Delete this scheduled slot?",description:"The cabin will be released and the project can be scheduled again.",okText:"Delete",cancelText:"Cancel",okButtonProps:{danger:!0},disabled:U,onConfirm:()=>N(t),children:e.jsx("button",{type:"button",disabled:U,"aria-label":U?"Delete disabled for evaluated schedule":"Delete scheduled slot",className:"inline-flex items-center justify-center rounded-lg p-2 transition-colors disabled:cursor-not-allowed",style:U?{color:"#94A3B8",background:"#F1F5F9",border:"1px solid #E2E8F0"}:{color:"#DC2626",background:"#FEF2F2",border:"1px solid #FECACA"},children:e.jsx(Wt,{size:13})})})]})]})]})}at.propTypes={icon:s.node.isRequired,label:s.string.isRequired,value:s.string,accent:s.bool};Jt.propTypes={record:s.object.isRequired,activeView:s.string.isRequired,getTeamName:s.func.isRequired,getTeamById:s.func.isRequired,getProjectTitle:s.func.isRequired,mentors:s.array,handleEditClick:s.func.isRequired,handleDeleteClick:s.func.isRequired};const wt="#2333CB",yt="#EEF0FB",Bs=t=>[t==null?void 0:t.evaluationStatus,t==null?void 0:t.evaluation_status,t==null?void 0:t.moduleStatus,t==null?void 0:t.module_status,t==null?void 0:t.status].some(a=>String(a||"").toUpperCase()==="EVALUATED"),xt=t=>Array.isArray(t)?t.flatMap(xt):t&&typeof t=="object"?Object.values(t).flatMap(xt):t==null?[]:[String(t)];
1function Kt({activeView:t,reviewType:a="",submittedProjectModules:o=[],evaluatedProjectModules:p=[],evaluatedProjectModuleTotal:v=0,evaluatedPage:E=1,evaluatedPageSize:S=10,loadEvaluatedProjectModules:N=()=>{},locationFilter:r="",locationOptions:i=[],showLocationFilter:g=!1,onLocationChange:w=()=>{},slots:B=[],columns:y=[],catalogSlots:M=[],slotsLoading:k,slotPage:T,slotPageSize:R,catalogTotal:Y,loadSlotsForStatus:H,handleOpenSchedulerModal:re,handleEditClick:K,handleDeleteClick:U,handleRevertSubmissionClick:C,revertingSubmissionId:D,canRevertSubmission:m,handleViewReport:b,getTeamName:F,getTeamById:z,getProjectTitle:ae,mentors:L=[]}){const[q,$]=c.useState(""),[ie,he]=c.useState(null),ye=c.useRef(t);c.useEffect(()=>{$(""),he(null)},[t]);const O=q.trim().toLowerCase(),I=ie?ie.format("YYYY-MM-DD"):"",de=t==="SCHEDULED_SLOTS"||t==="RESCHEDULED_SLOTS";c.useEffect(()=>{const l=ye.current!==t;if(ye.current=t,t==="EVALUATED_PROJECTS"){const De=setTimeout(()=>{N(1,S,O,r,a)},l?0:500);return()=>clearTimeout(De)}if(l||!de||!O&&!I)return;const h=t==="RESCHEDULED_SLOTS"?"RESCHEDULED":"SCHEDULED",le=setTimeout(()=>{H(h,1,R,O,I,r,a)},500);return()=>clearTimeout(le)},[t,de,S,N,r,H,O,I,R,a]);const be=l=>{const h=l.target.value;$(h),!h.trim()&&de&&(I||H(t==="RESCHEDULED_SLOTS"?"RESCHEDULED":"SCHEDULED",1,R,"","",r))},ce=l=>{he(l),!l&&!O&&de&&H(t==="RESCHEDULED_SLOTS"?"RESCHEDULED":"SCHEDULED",1,R,"","",r)},we=l=>{w(l||"",O,I)},ve=l=>[l==null?void 0:l.studentName,l==null?void 0:l.student_name,l==null?void 0:l.name,l==null?void 0:l.email,l==null?void 0:l.studentEmail,l==null?void 0:l.student_email,l==null?void 0:l.studentId,l==null?void 0:l.student_id,l==null?void 0:l.codegnanId,l==null?void 0:l.codegnan_id].filter(Boolean).join(" "),me=c.useCallback(l=>{if(!O)return!0;const h=z(l.teamId||l.team_id),le=[...l.members||[],...l.teamMembers||[],...(h==null?void 0:h.members)||[],...(h==null?void 0:h.teamMembers)||[]];return[l.batch,l.batchId,l.batch_id,l.batchName,l.batch_name,l.batchNo,l.batch_no,h==null?void 0:h.batch,h==null?void 0:h.batchId,h==null?void 0:h.batch_id,h==null?void 0:h.batchName,h==null?void 0:h.batch_name,h==null?void 0:h.batchNo,h==null?void 0:h.batch_no,F(l.teamId||l.team_id),ae(l),l.projectTitle,l.project_title,l.moduleName,l.module_name,l.moduleId,l.module_id,l.mentorName,l.mentor_name,...le.map(ve),...xt(l),...xt(h)].filter(Boolean).join(" ").toLowerCase().includes(O)},[ae,z,F,O]),se=c.useCallback(l=>{if(!r)return!0;const h=z(l.teamId||l.team_id),le=l.location||l.Location||l.batchLocation||l.batch_location||(h==null?void 0:h.location)||(h==null?void 0:h.Location)||(h==null?void 0:h.batchLocation)||(h==null?void 0:h.batch_location)||"";return String(le).trim().toLowerCase()===String(r).trim().toLowerCase()},[z,r]),fe=c.useMemo(()=>o.filter(l=>me(l)&&se(l)),[se,me,o]),Ne=c.useMemo(()=>p.filter(l=>me(l)&&se(l)),[p,se,me]),_=c.useMemo(()=>M.filter(l=>Bs(l)||!me(l)||!se(l)?!1:I?String(l.slotDate||l.slot_date||"").slice(0,10)===I:!0),[M,se,me,I]),xe={current:T,pageSize:R,total:Y,showSizeChanger:!0,pageSizeOptions:["10","20","50"],showQuickJumper:!0,showTotal:l=>`Total ${l} slots`,hideOnSinglePage:!1,onChange:(l,h)=>{H(t==="RESCHEDULED_SLOTS"?"RESCHEDULED":"SCHEDULED",l,h,O,I,r,a)}},Q=e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl mx-auto flex items-center justify-center mb-3",style:{background:yt},children:e.jsx(Ge,{size:24,style:{color:wt}})}),e.jsx("p",{className:"text-slate-500 font-semibold text-sm",children:"No slots scheduled yet"}),e.jsx("p",{className:"mt-1 text-xs text-slate-400",children:"Scheduled evaluation slots will appear here."})]});return e.jsxs("div",{children:[e.jsx("div",{className:"slots-catalog-search flex flex-col gap-2 border-b border-slate-100 bg-white px-4 py-3 sm:flex-row sm:items-center sm:justify-end",children:e.jsxs("div",{className:`grid w-full grid-cols-1 gap-2 ${g?"sm:ml-auto sm:max-w-[720px] sm:flex-1 sm:grid-cols-3":"sm:ml-auto sm:max-w-[480px] sm:flex-1 sm:grid-cols-2"}`,children:[e.jsx(as,{size:"middle",allowClear:!0,prefix:e.jsx(Ts,{size:15,className:"text-slate-400"}),value:q,onChange:be,placeholder:`Search ${t==="SUBMITTED_PROJECTS"||t==="EVALUATED_PROJECTS"?t==="EVALUATED_PROJECTS"?"evaluated projects":"submitted projects":t==="RESCHEDULED_SLOTS"?"rescheduled slots":"scheduled slots"}...`,className:"!h-10 !max-h-10 !min-h-10 w-full rounded-lg",style:{height:40,maxHeight:40,minHeight:40}}),g&&e.jsx(Ve,{allowClear:!0,value:r||void 0,onChange:we,placeholder:"All Locations",options:i.map(l=>({label:l,value:l})),className:"!h-10 w-full",popupMatchSelectWidth:!1}),de&&e.jsx(vt,{size:"middle",allowClear:!0,value:ie,onChange:ce,format:"YYYY-MM-DD",placeholder:"Filter by date",className:"!h-10 !max-h-10 !min-h-10 w-full rounded-lg",style:{height:40,maxHeight:40,minHeight:40},suffixIcon:e.jsx(Ge,{size:15,className:"text-slate-400"})})]})}),t==="EVALUATED_PROJECTS"?e.jsx("div",{className:"slots-catalog-table min-w-0 p-4",children:e.jsx(At,{dataSource:Ne,columns:y,rowKey:l=>l.slotId||l.id||`${l.teamId}-${l.moduleId||"module"}`,scroll:{x:1120},pagination:{current:E,pageSize:S,total:v,showSizeChanger:!0,pageSizeOptions:["10","20","50"],showQuickJumper:!0,showTotal:l=>`Total ${l} evaluated modules`,hideOnSinglePage:!0,style:{marginBottom:0},onChange:(l,h)=>N(l,h,O,r)},className:"custom-table",locale:{emptyText:e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("div",{className:"mx-auto mb-3 flex h-14 w-14 items-center justify-center rounded-2xl",style:{background:yt},children:e.jsx(Pt,{size:24,style:{color:wt}})}),e.jsx("p",{className:"text-sm font-semibold text-slate-500",children:"No evaluated project modules yet"})]})}})}):t==="SUBMITTED_PROJECTS"?e.jsx("div",{className:"slots-catalog-cards p-6",children:fe.length===0?e.jsxs("div",{className:"py-20 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl mx-auto flex items-center justify-center mb-4",style:{background:yt},children:e.jsx(Pt,{size:28,style:{color:wt}})}),e.jsx("p",{className:"text-slate-500 font-semibold text-sm",children:"No project submissions yet"}),e.jsx("p",{className:"text-slate-400 text-xs mt-1 max-w-xs mx-auto",children:"Once student teams submit their project details, they will appear here."})]}):e.jsx("div",{className:"grid min-w-0 grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:fe.map((l,h)=>e.jsx(qt,{t:l,idx:h,slots:B,handleOpenSchedulerModal:re,handleEditClick:K,handleRevertSubmissionClick:C,revertingSubmissionId:D,canRevertSubmission:m,handleViewReport:b},l.cardId))})}):e.jsx("div",{className:"slots-catalog-table p-4 min-w-0",children:e.jsxs(ls,{spinning:k,children:[e.jsxs("div",{className:"slots-mobile-cards min-w-0 grid-cols-1 gap-3",children:[_.length===0?Q:_.map(l=>e.jsx(Jt,{record:l,activeView:t,getTeamName:F,getTeamById:z,getProjectTitle:ae,mentors:L,handleEditClick:K,handleDeleteClick:U},l.slotId||l.id||`${l.teamId}-${l.moduleId}`)),_.length>0&&!O&&e.jsx(ns,{...xe,className:"justify-center"})]}),e.jsx("div",{className:"slots-table-desktop min-w-0 overflow-x-auto",children:e.jsx(At,{dataSource:_,columns:y,rowKey:"slotId",scroll:{x:1120},pagination:{...xe,total:O?_.length:Y,hideOnSinglePage:!!O,style:{marginBottom:0}},className:"custom-table",locale:{emptyText:Q}})})]})})]})}Kt.propTypes={activeView:s.string.isRequired,reviewType:s.string,
1submittedProjectModules:s.array,evaluatedProjectModules:s.array,evaluatedProjectModuleTotal:s.number,evaluatedPage:s.number,evaluatedPageSize:s.number,loadEvaluatedProjectModules:s.func,locationFilter:s.string,locationOptions:s.array,showLocationFilter:s.bool,onLocationChange:s.func,slots:s.array,columns:s.array,catalogSlots:s.array,slotsLoading:s.bool,slotPage:s.number,slotPageSize:s.number,catalogTotal:s.number,loadSlotsForStatus:s.func,handleOpenSchedulerModal:s.func,handleEditClick:s.func,handleDeleteClick:s.func,handleRevertSubmissionClick:s.func,revertingSubmissionId:s.string,canRevertSubmission:s.bool,handleViewReport:s.func,getTeamName:s.func,getTeamById:s.func,getProjectTitle:s.func,mentors:s.array};const{Option:dt}=Ve;function Qt({selectedSlot:t,assignmentLocked:a,teamId:o,setTeamId:p,teams:v,sortedTeams:E,slots:S,getTeamName:N,setModuleId:r,setMentorId:i,setAvailabilityConflict:g,setAvailabilityInfo:w,selectedModuleOptions:B,moduleId:y,selectedTeam:M,mentorsLoading:k,mentorEmptyReason:T,getMentorName:R,eligibleMentors:Y,mentorId:H,batchLocation:re,selectedModuleNames:K,mentorMatchStats:U}){var C,D;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-bold uppercase tracking-widest mb-2 text-slate-500",children:t||a?"Team":"Select Team (Submitted Only)"}),t||a?e.jsxs("div",{className:"flex min-h-10 items-center justify-between rounded-lg border border-slate-200 bg-slate-50 px-3",children:[e.jsx("span",{className:"text-sm font-semibold text-slate-700",children:N(o)}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wide text-slate-400",children:t?"Existing review":"Selected project"})]}):e.jsx(Ve,{value:o,onChange:m=>{p(m);const b=v.find(z=>z.teamId===m),F=((b==null?void 0:b.moduleDetails)||[]).find(z=>["SUBMITTED","SLOT_ASSIGNED","EVALUATED"].includes(String(z.status||"").toUpperCase())&&!z.reviewSlotId);r((F==null?void 0:F.id)||""),i(""),g(null),w(null)},placeholder:"Choose submitted team to evaluate",className:"w-full",showSearch:!0,optionFilterProp:"children",children:E.map(m=>{const b=String(m.status||"").toUpperCase(),F=S.some($=>$.teamId===m.teamId),ae=!(b==="SUBMITTED"||b==="SLOT_ASSIGNED"||b==="EVALUATED"),L=F||ae;let q="";return F?q=" (Slot Assigned)":ae?q=" (Submission Pending)":q=" (Ready for Review Slot)",e.jsxs(dt,{value:m.teamId,disabled:L,children:[m.teamName||`Team ${m.teamId}`," (",m.batchId,")",q]},m.teamId)})})]}),(B.length>0||(t==null?void 0:t.moduleId))&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-bold uppercase tracking-widest mb-2 text-slate-500",children:"Project Module"}),(t||a)&&e.jsx("div",{className:"flex min-h-10 items-center rounded-lg border border-slate-200 bg-slate-50 px-3 text-sm font-semibold text-slate-700",children:((D=(C=B.find(m=>String(m.id)===String(y)))==null?void 0:C.modules)==null?void 0:D.join(" ⢠"))||y||"Selected module"}),e.jsx("div",{className:t||a?"hidden":"",children:e.jsx(Ve,{value:y||void 0,onChange:m=>{r(m),i(""),g(null),w(null)},placeholder:"Choose the submitted module",disabled:!!t||a,className:"w-full",children:t||a?e.jsx(dt,{value:y,children:y||"Selected module"}):B.map(m=>e.jsx(dt,{value:m.id,children:(m.modules||[]).join(" ⢠")||m.id},m.id))})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-bold uppercase tracking-widest mb-2 text-slate-500",children:"Mentor"}),e.jsx(Ve,{value:H,onChange:m=>{i(m),g(null),w(null)},placeholder:M?k?"Loading mentorsâ¦":"Select an eligible mentor":"Select a team first",disabled:!M,loading:k,showSearch:!0,optionFilterProp:"children",className:"w-full",notFoundContent:T||"No mentors are available at this team's batch location",children:[...t&&H&&!Y.some(m=>String(m.id||m.mentor_id||m.mentorId||m.empId||m.employee_id||m.employeeId||m._id||m.email||m.name||"")===String(H))?[{id:H,name:R(H)}]:[],...Y].map(m=>{const b=String(m.id||m.mentor_id||m.mentorId||m.empId||m.employee_id||m.employeeId||m._id||m.email||m.name||""),F=[m.Designation,m.designation,m.designations,m.specialization,m.specializations].flatMap(L=>
1Array.isArray(L)?L:[L]).filter(Boolean).join(", "),z=[m.location,m.branch,m.city].flatMap(L=>Array.isArray(L)?L:[L]).filter(Boolean).join(", "),ae=m.email?` â ${m.email}`:"";return e.jsxs(dt,{value:b,children:[m.name||b,ae,z?` â ${z}`:"",F?` (${F})`:""]},b)})}),M&&!t&&!a&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-xl border border-slate-200/80 bg-slate-50/80 p-3 text-[11px] text-slate-600",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-1 font-semibold text-slate-700",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Gt,{size:12,className:"text-slate-400"}),"Batch Location:"]}),e.jsx("span",{className:"rounded bg-white px-1.5 py-0.5 font-bold text-slate-800 border border-slate-200",children:re})]}),K.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-1 font-semibold text-slate-700",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Dt,{size:12,className:"text-slate-400"}),"Module Tech:"]}),e.jsx("span",{className:"rounded bg-white px-1.5 py-0.5 font-bold text-slate-800 border border-slate-200",children:K.join(", ")})]}),e.jsxs("p",{className:"pt-1 text-[10px] text-slate-500 border-t border-slate-200/60 mt-1",children:["Showing ",U.eligibleCount," of"," ",U.totalCount," mentors at"," ",e.jsx("strong",{className:"text-slate-700 font-bold",children:re}),U.usingModuleMatch?e.jsxs(e.Fragment,{children:[" ","matching"," ",e.jsx("strong",{className:"text-slate-700 font-bold",children:K.join(", ")})]}):" (no designation match; showing all mentors here)"]})]})]})]})}Qt.propTypes={selectedSlot:s.object,assignmentLocked:s.bool,teamId:s.string,setTeamId:s.func,teams:s.array,sortedTeams:s.array,slots:s.array,getTeamName:s.func,setModuleId:s.func,setMentorId:s.func,setAvailabilityConflict:s.func,setAvailabilityInfo:s.func,selectedModuleOptions:s.array,moduleId:s.string,selectedTeam:s.object,mentorsLoading:s.bool,mentorEmptyReason:s.string,getMentorName:s.func,eligibleMentors:s.array,mentorId:s.string,batchLocation:s.string,selectedModuleNames:s.array,mentorMatchStats:s.object};const Je=t=>{if(!t)return"-";const a=String(t).trim(),o=a.match(/(?:T|\s)?(\d{1,2}:\d{2}(?::\d{2})?)/),p=ue(`2000-01-01T${(o==null?void 0:o[1])||a}`);return p.isValid()?p.format("h:mm A"):"-"},zs={WORKING_HOURS:"Working hours",CLASS_SCHEDULE:"Class schedule",CABIN_PROJECT_REVIEW:"Cabin",CABIN_MOCK_INTERVIEW:"Cabin",CABIN:"Cabin"},Hs=t=>{if(!t)return"";const a=new Date(`${t}T00:00:00`);return Number.isNaN(a.getTime())?String(t):a.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},Xt=t=>{const a=String((t==null?void 0:t.source)||"").toUpperCase();return(t==null?void 0:t.className)||(t==null?void 0:t.class_name)||(a==="WORKING_HOURS"?"Working hours restriction":"Schedule conflict")},Vs=t=>{if(String((t==null?void 0:t.source)||"").toUpperCase()==="WORKING_HOURS")return"Reviews can be scheduled only between 9:00 AM and 8:00 PM.";const a=String((t==null?void 0:t.label)||"").trim();return a&&a!==Xt(t)?a:""},Ys=t=>{const a=(t==null?void 0:t.startTime)||(t==null?void 0:t.start_time),o=(t==null?void 0:t.endTime)||(t==null?void 0:t.end_time);return!a&&!o?"":`${Je(a)} - ${Je(o)}`};function Zt({availabilityLoading:t,availabilityInfo:a,availabilityConflict:o,hasAvailabilityConflict:p,availabilityConflicts:v,upcomingSuggestedTimeRanges:E,selectSuggestedTimeRange:S}){if(!t&&!a&&!o)return null;const N=!!(a!=null&&a.error),r=(a==null?void 0:a.message)||(typeof o=="string"?o:"")||"Mentor or cabin is not available during the selected time.";return e.jsxs("div",{className:`rounded-xl border p-4 text-xs ${N?"border-amber-200 bg-amber-50 text-amber-900":p?"border-red-200 bg-red-50 text-red-800":"border-emerald-200 bg-emerald-50 text-emerald-900"}`,children:[t?e.jsxs("p",{className:"font-bold flex items-center gap-1.5",children:[e.jsx(lt,{size:14,className:"animate-spin text-amber-600"}),"Checking mentor and cabin availability..."]}):a!=null&&a.error?e.jsxs("p",{className:"font-bold flex items-center gap-1.5",children:[e.jsx(St,{size:14,className:"text-amber-600"}),a.error]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"font-bold flex items-center gap-1.5",children:[N?e.jsx(St,{size:14,className:"text-amber-600"}):p?e.jsx(St,{size:14,className:"text-red-600"}):e.jsx(Ye,{size:14,className:"text-emerald-600"}),N?"Availability check failed:":p?"Conflict Detected:":"Mentor and cabin are available for the selected time."]}),N&&e.jsx("p",{className:"mt-1 text-[11px] text-amber-800",children:a.error}),p&&v.length===0&&e.jsx("p",{className:"mt-1 text-[11px] font-semibold text-red-700",children:r}),v.length>0&&e.jsx("div",{className:"mt-2 space-y-2",children:v.map((i,g)=>{const w=String((i==null?void 0:i.source)||"").toUpperCase(),B=zs[w]||w.replace(/_/g," ").toLowerCase()||"Schedule conflict",y=Xt(i),M=Vs(i),k=Hs(i==null?void 0:i.date),T=Ys(i);return e.jsxs("div",{className:"grid gap-x-3 gap-y-1 rounded-lg border border-red-200 bg-white/80 px-3 py-2.5 text-red-900 sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] sm:items-center",children:[e.jsx("span",{className:"w-fit roun
1ded-full bg-red-100 px-2 py-0.5 text-[10px] font-extrabold uppercase tracking-wide text-red-700",children:B}),e.jsx("span",{className:"min-w-0 truncate font-bold",title:y,children:y}),k&&e.jsx("span",{className:"text-[11px] font-semibold text-red-700",children:k}),T&&e.jsx("span",{className:"text-[11px] font-semibold text-red-700",children:T}),M&&e.jsx("p",{className:"text-[11px] leading-relaxed text-red-700 sm:col-span-4",children:M})]},`${w}-${(i==null?void 0:i.date)||"date"}-${(i==null?void 0:i.startTime)||(i==null?void 0:i.start_time)||g}`)})}),p&&E.length>0&&e.jsxs("div",{className:"mt-3 border-t border-red-200 pt-3",children:[e.jsx("p",{className:"mb-2 text-[10px] font-extrabold tracking-wide text-red-700 uppercase",children:"SUGGESTED AVAILABLE SLOTS ON THIS DAY (CLICK TO SELECT)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:E.map(i=>e.jsxs("button",{type:"button",onClick:()=>S(i),className:"rounded-lg border border-emerald-300 bg-white px-3 py-1.5 text-[11px] font-bold text-emerald-700 transition-colors hover:bg-emerald-50",children:[Je(i.startTime)," -"," ",Je(i.endTime)]},`${i.slotDate}-${i.startTime}`))})]})]}),!N&&!p&&E.length>0?e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 rounded-lg border border-emerald-200 bg-white px-3 py-2 text-xs",children:[e.jsx("span",{className:"font-bold text-emerald-800",children:"Free Windows:"}),E.map(i=>e.jsxs("span",{className:"rounded bg-emerald-100 px-2 py-0.5 font-semibold text-emerald-800",children:[Je(i.startTime)," -"," ",Je(i.endTime)]},`${i.slotDate}-${i.startTime}`))]}):null]})}Zt.propTypes={availabilityLoading:s.bool,availabilityInfo:s.object,availabilityConflict:s.oneOfType([s.object,s.string]),hasAvailabilityConflict:s.bool,availabilityConflicts:s.array,upcomingSuggestedTimeRanges:s.array,selectSuggestedTimeRange:s.func};const ct="#2333CB",Gs="#EEF0FB",Ot="#1A26A8";function es({schedulerModalOpen:t,setSchedulerModalOpen:a,handleResetForm:o,selectedSlot:p,assignmentLocked:v,handleSubmit:E,teamId:S,setTeamId:N,teams:r=[],sortedTeams:i=[],slots:g=[],getTeamName:w,setModuleId:B,setMentorId:y,setAvailabilityConflict:M,setAvailabilityInfo:k,selectedModuleOptions:T=[],moduleId:R,selectedTeam:Y,mentorsLoading:H,mentorEmptyReason:re,getMentorName:K,eligibleMentors:U=[],mentorId:C,cabinId:D,setCabinId:m,cabins:b=[],cabinsLoading:F,batchLocation:z,selectedModuleNames:ae=[],mentorMatchStats:L={},slotDate:q,setSlotDate:$,startTime:ie,setStartTime:he,endTime:ye,setEndTime:O,availabilityLoading:I,availabilityInfo:de,availabilityConflict:be,hasAvailabilityConflict:ce,availabilityConflicts:we=[],upcomingSuggestedTimeRanges:ve=[],selectSuggestedTimeRange:me,submitLoading:se}){const fe=p?["This existing review can be moved to another mentor or time.","Mentor availability is verified automatically before saving.","The project evaluation status is preserved after rescheduling."]:["Student team must submit project details first.","Manager, Placement Coordinator, or Admin assigns slot.","Mentor availability is verified automatically upon scheduling."],Ne=()=>{o(),a(!1)};return e.jsx(Vt,{open:t,onCancel:Ne,footer:null,title:null,closable:!1,centered:!0,width:"min(900px, calc(100vw - 24px))",wrapClassName:"slots-scheduler-modal",destroyOnClose:!1,styles:{content:{padding:0,overflow:"hidden"},body:{padding:0,overflow:"hidden"}},children:e.jsxs("div",{className:"bg-white rounded-2xl overflow-hidden font-['Inter']",children:[e.jsxs("div",{className:"px-6 py-5 relative overflow-hidden",style:{background:`linear-gradient(135deg, ${ct} 0%, ${Ot} 100%)`},children:[e.jsx("button",{type:"button","aria-label":"Close slot editor",onClick:Ne,className:"absolute right-5 top-5 z-10 rounded-lg p-1 text-white/75 transition-colors hover:bg-white/10 hover:text-white",children:e.jsx(Cs,{size:18})}),e.jsx("div",{className:"absolute -top-6 -right-6 w-24 h-24 rounded-full opacity-10",style:{background:"#fff"}}),e.jsx("div",{className:"absolute -bottom-4 right-8 w-16 h-16 rounded-full opacity-10",style:{background:"#fff"}}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ds,{size:18,className:"text-white opacity-80"}),e.jsx("span",{className:"text-white font-bold text-base",children:p?"Edit Scheduled Slot":"Schedule Evaluation Slot"})]}),e.jsx("p",{className:"text-white/60 text-xs",children:p?"Update the mentor, date, or time for this scheduled slot":"Create a slot assignment for a team"})]})]}),e.jsxs("form",{onSubmit:E,className:"flex max-h-[calc(100vh-112px)] flex-col overflow-hidden",children:[e.jsx("div",{className:"slots-scheduler-form-body min-h-0 flex-1 overflow-y-auto p-6",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-5 gap-y-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 rounded-xl p-4 lg:col-span-2",style:{background:Gs,border:"1px solid rgba(35,51,203,0.15)"},children:[e.jsxs("div",{className:"font-bold flex items-center gap-1.5 text-xs",style:{color:ct},children:[e.jsx(Ye,{size:14}),"Workflow Requirements"]}),e.jsx("ul",{className:"space-y-1.5 text-[11px] text-slate-600",children:fe.map((_,Z)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(_s,{size:10,
1className:"flex-shrink-0 mt-0.5",style:{color:ct}}),_]},Z))})]}),e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-xs font-extrabold uppercase tracking-wider text-slate-800",children:"Assignment details"}),e.jsx("p",{className:"mt-1 text-[11px] text-slate-500",children:"Choose the submitted team, module, and eligible mentor."})]}),e.jsx(Qt,{selectedSlot:p,assignmentLocked:v,teamId:S,setTeamId:N,teams:r,sortedTeams:i,slots:g,getTeamName:w,setModuleId:B,setMentorId:y,setAvailabilityConflict:M,setAvailabilityInfo:k,selectedModuleOptions:T,moduleId:R,selectedTeam:Y,mentorsLoading:H,mentorEmptyReason:re,getMentorName:K,eligibleMentors:U,mentorId:C,batchLocation:z,selectedModuleNames:ae,mentorMatchStats:L}),e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"mb-2 block text-[10px] font-bold uppercase tracking-widest text-slate-500",children:"Cabin"}),e.jsx(Ve,{value:D||void 0,onChange:_=>{m(_),M(null),k(null)},placeholder:F?"Loading cabins...":"Select a cabin",loading:F,disabled:!Y||F,showSearch:!0,optionFilterProp:"children",className:"w-full",notFoundContent:Y?"No active cabins for this batch location":"Select a team first",children:b.map(_=>e.jsxs(Ve.Option,{value:_.id,children:[_.name," â ",_.location,String(_.resolved_status||"").toUpperCase()==="OCCUPIED"?" (Currently occupied)":""]},_.id))}),e.jsx("p",{className:"mt-1 text-[10px] text-slate-400",children:"Cabins are filtered by batch location. Online batches can use cabins from any location."})]})]}),e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-xs font-extrabold uppercase tracking-wider text-slate-800",children:"Slot timing"}),e.jsx("p",{className:"mt-1 text-[11px] text-slate-500",children:"Set the review date and time. Availability is checked automatically."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-[10px] font-bold uppercase tracking-widest text-slate-500",children:"Slot Date"}),e.jsx(vt,{value:q,onChange:_=>{$(_),M(null),k(null)},className:"w-full",format:"YYYY-MM-DD",disabledDate:_=>_&&_.startOf("day").isBefore(ue().startOf("day"))})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[{label:"Start Time",value:ie,setter:he},{label:"End Time",value:ye,setter:O}].map(_=>e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-[10px] font-bold uppercase tracking-widest text-slate-500",children:_.label}),e.jsx(vt,{picker:"time",value:_.value,onChange:Z=>{_.setter(Z),M(null),k(null)},format:"h:mm A",use12Hours:!0,disabledTime:()=>{if(!(q!=null&&q.isSame(ue(),"day")))return{};const Z=ue();return{disabledHours:()=>Array.from({length:Z.hour()},(xe,Q)=>Q),disabledMinutes:xe=>xe===Z.hour()?Array.from({length:Z.minute()+1},(Q,l)=>l):[]}},className:"w-full"})]},_.label))})]}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(Zt,{availabilityLoading:I,availabilityInfo:de,availabilityConflict:be,hasAvailabilityConflict:ce,availabilityConflicts:we,selectedTeam:Y,upcomingSuggestedTimeRanges:ve,selectSuggestedTimeRange:me})})]})}),e.jsxs("div",{className:"flex flex-shrink-0 items-center justify-end gap-2 border-t border-slate-200 bg-white px-6 py-4",children:[(p||S)&&e.jsx("button",{type:"button",onClick:()=>{o(),a(!1)},className:"px-4 py-2 rounded-lg text-sm font-semibold text-slate-500 hover:text-slate-700 hover:bg-slate-100 transition-colors",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:se||I||ce||!D,className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-bold text-white transition-all duration-200 hover:shadow-lg active:scale-95 disabled:opacity-60 disabled:cursor-not-allowed",style:{background:`linear-gradient(135deg, ${ct} 0%, ${Ot} 100%)`},children:[se||I?e.jsx(lt,{size:14,className:"animate-spin"}):e.jsx(Dt,{size:14}),I?"Checking availability...":p?"Edit Slot":"Assign Slot"]})]})]})]})})}es.propTypes={schedulerModalOpen:s.bool,setSchedulerModalOpen:s.func,handleResetForm:s.func,selectedSlot:s.object,assignmentLocked:s.bool,handleSubmit:s.func,teamId:s.string,
1setTeamId:s.func,teams:s.array,sortedTeams:s.array,slots:s.array,getTeamName:s.func,setModuleId:s.func,setMentorId:s.func,setAvailabilityConflict:s.func,setAvailabilityInfo:s.func,selectedModuleOptions:s.array,moduleId:s.string,selectedTeam:s.object,mentorsLoading:s.bool,mentorEmptyReason:s.string,getMentorName:s.func,eligibleMentors:s.array,mentorId:s.string,cabinId:s.string,setCabinId:s.func,cabins:s.array,cabinsLoading:s.bool,batchLocation:s.string,selectedModuleNames:s.array,mentorMatchStats:s.object,slotDate:s.object,setSlotDate:s.func,startTime:s.object,setStartTime:s.func,endTime:s.object,setEndTime:s.func,availabilityLoading:s.bool,availabilityInfo:s.object,availabilityConflict:s.object,hasAvailabilityConflict:s.bool,availabilityConflicts:s.array,upcomingSuggestedTimeRanges:s.array,selectSuggestedTimeRange:s.func,submitLoading:s.bool};const Fe="#2333CB",tt="#EEF0FB",Ws="#1A26A8";function qs({getTeamName:t,getTeamById:a,getProjectTitle:o,mentors:p=[],handleEditClick:v,handleDeleteClick:E,handleViewReport:S}){return[{title:"Team",dataIndex:"teamId",key:"teamId",render:(N,r)=>{const i=r.teamName||r.team_name||t(N);return e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-white text-xs font-bold flex-shrink-0",style:{background:`linear-gradient(135deg, ${Fe}, ${Ws})`},children:i.charAt(0).toUpperCase()}),e.jsx("span",{className:"font-semibold text-slate-800 dark:text-slate-100 text-sm",children:i})]})}},{title:"Batch",key:"batch",render:(N,r)=>{const i=a(r.teamId),g=r.batch||r.batchId||r.batch_id||r.batchName||r.batch_name||(i?i.batchId||i.batch_id||i.batch:null)||"â";return e.jsx("span",{className:"whitespace-nowrap px-2 py-0.5 rounded-md text-xs font-semibold",style:{background:tt,color:Fe},children:g})}},{title:"Module",key:"module",render:(N,r)=>{var y,M;const i=a(r.teamId),w=((i==null?void 0:i.moduleDetails)||(i==null?void 0:i.module_details)||[]).find(k=>String(k.id||k.moduleId||k.module_id||"")===String(r.moduleId||r.module_id||"")),B=r.moduleName||r.module_name||((y=w==null?void 0:w.modules)==null?void 0:y.filter(Boolean).join(", "))||(((M=i==null?void 0:i.modules)==null?void 0:M.length)===1?i.modules[0]:"")||"Not available";return e.jsx("span",{className:"text-xs font-medium text-slate-700 dark:text-slate-300",children:B})}},{title:"Project Title",key:"projectTitle",render:(N,r)=>{const i=a(r.teamId),g=r.projectTitle||r.project_title||r.projectName||r.project_name||(i?o(i):null)||"Untitled Project";return e.jsx("span",{className:"text-xs font-medium text-slate-700 dark:text-slate-300",children:g})}},{title:"Mentor",dataIndex:"mentorId",key:"mentorId",render:(N,r)=>{const i=p.find(w=>String(w.id||w.mentor_id||w.empId||w._id||w.name||"")===String(N||"")),g=r.mentorName||r.mentor_name||(i==null?void 0:i.name)||N||"â";return e.jsx("div",{className:"flex flex-col",children:e.jsx("span",{className:"text-xs font-semibold text-slate-700 dark:text-slate-200",children:g})})}},{title:"Cabin",key:"cabin",render:(N,r)=>e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-700 dark:text-slate-200",children:r.cabinName||r.cabin_name||"Not assigned"}),(r.cabinLocation||r.cabin_location)&&e.jsx("span",{className:"text-[10px] text-slate-400",children:r.cabinLocation||r.cabin_location})]})},{title:"Date",dataIndex:"slotDate",key:"slotDate",render:N=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ge,{size:12,style:{color:Fe}}),e.jsx("span",{className:"text-slate-700 dark:text-slate-300 font-medium text-xs",children:ue(N).format("MMM DD, YYYY")})]})},{title:"Time Window",key:"timeWindow",render:(N,r)=>{const i=g=>g?ue(`2026-01-01T${g}`).format("hh:mm A"):"â";return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ut,{size:12,className:"text-slate-400"}),e.jsxs("span",{className:"text-slate-500 dark:text-slate-400 font-mono text-xs",children:[i(r.startTime)," â ",i(r.endTime)]})]})}},{title:"Evaluation Status",dataIndex:"evaluationStatus",key:"evaluationStatus",render:N=>{const r=String(N||"PENDING").toUpperCase()==="EVALUATED"?"EVALUATED":"PENDING",i=r==="EVALUATED";return e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wide",style:i?{background:"#E8F5E9",color:"#2E7D32"}:{background:"#FFF3E0",color:"#E65100"},children:[i?e.jsx(Ye,{size:9}):e.jsx(Ut,{size:9}),r]})}},{title:"Action",key:"action",render:(N,r)=>{const i=[r.evaluationStatus,r.evaluation_status,r.moduleStatus,r.module_status,r.status].some(g=>String(g||"").toUpperCase()==="EVALUATED");return i?e.jsxs("button",{type:"button",onClick:()=>S==null?void 0:S(r),className:"inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition-all duration-200",style:{background:tt,color:Fe,border:"1px solid rgba(35,51,203,0.2)"},onMouseEnter:g=>{g.currentTarget.style.background=Fe,g.currentTarget.style.color="#fff"},onMouseLeave:g=>{g.currentTarget.style.background=tt,g.currentTarget.style.color=Fe},children:[e.jsx(Yt,{size:12}),"View Report"]}):e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>v(r),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold transition-all duration-200",style:{background:tt,color:Fe,border:"1px solid rgba(35,51,203,0.2)"},onMouseEnter:g=>{g.currentTarget.style.background=Fe,g.currentTarget.style.color="#fff"},onMouseLeave:g=>{g.currentTarget.style.background=tt,g.currentTarget.style.color=Fe},children:[e.jsx(_t,{size:12}),"Edit"]}),e.jsx(os,{title:i?"Evaluated schedules cannot be deleted":"Delete scheduled slot",children:e.jsx("span",{children:e.jsx(Ct,{title:"Delete this scheduled slot?",description:"The cabin will be released and the project can be scheduled again.",okText:"Delete",cancelText:"Cancel",okButtonProps:{danger:!0},disabled:i,onConfirm:()=>E(r),children:e.jsx("button",{type:"button",disabled:i,className:"inline-flex items-center justify-center rounded-lg p-1.5 text-xs font-semibold transition-all duration-200 disabled:cursor-not-allowed",style:i?{color:"#94A3B8",background:"#F1F5F9",border:"1px solid #E2E8F0"}:{color:"#DC2626",background:"#FEF2F2",border:"1px solid #FECACA"},"aria-label":i?"Delete disabled for evaluated schedule":"Delete scheduled slot",children:e.jsx(Wt,{size:13})})})})})]})}}]}const j=({className:t="",style:a={}})=>e.jsx("div",{className:`bg-gradient-to-r from-slate-200 via-slate-100 to-slate-200 bg-[length:200%_100%] animate-shimmer rounded-xl ${t}`,style:a});
1j.propTypes={className:s.string,style:s.object};function Js(){return e.jsx("div",{className:"w-full min-h-screen bg-slate-50/60 font-['Inter']",children:e.jsxs("div",{className:"max-w-[1680px] mx-auto px-6 py-8 space-y-7",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{className:"w-14 h-14 rounded-2xl flex-shrink-0"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{className:"h-7 w-56 rounded-lg"}),e.jsx(j,{className:"h-4 w-80 rounded-md"})]})]}),e.jsx(j,{className:"h-10 w-28 rounded-xl"})]}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[...Array(4)].map((t,a)=>e.jsxs("div",{className:"bg-white rounded-2xl p-5 shadow-sm border border-slate-200/80 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(j,{className:"h-3 w-24 rounded"}),e.jsx(j,{className:"h-8 w-16 rounded-lg"}),e.jsx(j,{className:"h-3 w-20 rounded"})]}),e.jsx(j,{className:"w-12 h-12 rounded-xl flex-shrink-0"})]},a))}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 items-start",children:[e.jsxs("div",{className:"flex-1 min-w-0 bg-white rounded-2xl shadow-sm border border-slate-200/80 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-100 bg-slate-50/50 flex items-center justify-between",children:[e.jsx(j,{className:"h-5 w-48 rounded-lg"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{className:"h-8 w-36 rounded-xl"}),e.jsx(j,{className:"h-8 w-32 rounded-xl"})]})]}),e.jsx("div",{className:"p-6 grid grid-cols-1 xl:grid-cols-2 gap-4",children:[...Array(4)].map((t,a)=>e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 space-y-3 bg-slate-50/70 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx(j,{className:"w-7 h-7 rounded-lg flex-shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(j,{className:"h-4 w-3/4 rounded"}),e.jsx(j,{className:"h-3 w-1/2 rounded"})]})]}),e.jsx(j,{className:"h-5 w-20 rounded-full flex-shrink-0"})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(j,{className:"h-4 w-16 rounded-md"}),e.jsx(j,{className:"h-4 w-20 rounded-md"})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-3 bg-white",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"h-3 w-full rounded"}),e.jsx(j,{className:"h-3 w-5/6 rounded"}),e.jsx(j,{className:"h-3 w-4/5 rounded"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[...Array(4)].map((o,p)=>e.jsxs("div",{className:"rounded-lg p-2.5 space-y-1.5 bg-slate-50 border border-slate-100",children:[e.jsx(j,{className:"h-2.5 w-14 rounded"}),e.jsx(j,{className:"h-4 w-20 rounded"})]},p))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(j,{className:"h-5 w-14 rounded-md"}),e.jsx(j,{className:"h-5 w-18 rounded-md"}),e.jsx(j,{className:"h-5 w-12 rounded-md"})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(j,{className:"h-7 w-20 rounded-lg"}),e.jsx(j,{className:"h-7 w-24 rounded-lg"}),e.jsx(j,{className:"h-7 w-14 rounded-lg"})]})]}),e.jsxs("div",{className:"px-5 py-3 flex items-center justify-between bg-slate-50/40 border-t border-slate-100",children:[e.jsx(j,{className:"h-3 w-32 rounded"}),e.jsx(j,{className:"h-8 w-28 rounded-lg"})]})]},a))})]}),e.jsxs("div",{className:"w-full lg:w-[400px] flex-shrink-0 bg-white rounded-2xl shadow-sm border border-slate-200/80 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-5 bg-slate-50 border-b border-slate-100",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{className:"h-5 w-44 rounded-lg"}),e.jsx(j,{className:"h-3 w-56 rounded"})]})}),e.jsxs("div",{className:"p-6 space-y-5",children:[e.jsxs("div",{className:"rounded-xl p-4 space-y-2 bg-slate-50 border border-slate-200/80",children:[e.jsx(j,{className:"h-4 w-40 rounded"}),e.jsxs("div",{className:"space-y-2 pl-1",children:[e.jsx(j,{className:"h-3 w-full rounded"}),e.jsx(j,{className:"h-3 w-5/6 rounded"}),e.jsx(j,{className:"h-3 w-4/5 rounded"})]})]}),[...Array(3)].map((t,a)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{className:"h-3 w-24 rounded"}),e.jsx(j,{className:"h-10 w-full rounded-xl"})]},a)),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{className:"h-3 w-20 rounded"}),e.jsx(j,{className:"h-10 w-full rounded-xl"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[...Array(2)].map((t,a)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{className:"h-3 w-20 rounded"}),e.jsx(j,{className:"h-10 w-full rounded-xl"})]},a))}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx(j,{className:"h-10 w-32 rounded-xl"})})]})]})]})]})})}const Ks=t=>[...t].sort((o,p)=>`${o.slotDate}T${o.startTime}`.localeCompare(`${p.slotDate}T${p.startTime}`)).reduce((o,p)=>{const v=o[o.length-1];return v&&v.slotDate===p.slotDate&&p.startTime<=v.endTime?p.endTime>v.endTime&&(v.endTime=p.endTime):o.push({...p}),o},[]),Tt=t=>Array.isArray(t)?t.flatMap(Tt):t&&typeof t=="object"?Object.values(t).flatMap(Tt):t==null?[]:[t],Ke=t=>String(t||"").toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,""),Rt=(t,a)=>a.flatMap(o=>Tt(t==null?void 0:t[o])),Qs=t=>String((t==null?void 0:t.id)||(t==null?void 0:t.mentor_id)||(t==null?void 0:t.mentorId)||(t==null?void 0:t.empId)||(t==null?void 0:t.employee_id)||(t==null?void 0:t.employeeId)||
1(t==null?void 0:t._id)||(t==null?void 0:t.email)||(t==null?void 0:t.name)||""),Xs=t=>Rt(t,["location","Location","locations","branch","branches","city","center","centre","locationName","LocationName","batchLocation","batch_location","BatchLocation","branchName"]),Zs=t=>Rt(t,["Designation","designation","designations","specialization","specializations","skills","expertise","modules","techStack","tech_stack","course","courses"]).flatMap(a=>typeof a=="string"?a.split(","):[a]),Bt=(t,a,o)=>{if(!a)return!1;const p=Ke(a);return o||Xs(t).some(v=>{const E=Ke(v);return E?E===p?!0:E.includes(p)&&p.length>=4||p.includes(E)&&E.length>=4:!1})},zt=(t,a)=>Zs(t).some(o=>{const p=Ke(o);return p?a.some(v=>Ke(v)===p)?!0:a.some(v=>{const E=Ke(v);return p.includes(E)&&E.length>=4||E.includes(p)&&p.length>=4}):!1});function ea({teams:t=[],teamId:a,moduleId:o,mentors:p=[],selectedSlot:v,mentorId:E,setMentorId:S,loadMentorsForTeam:N,availabilityInfo:r,availabilityConflict:i}){const g=c.useMemo(()=>t.find(C=>C.teamId===a)||null,[t,a]),w=c.useMemo(()=>((g==null?void 0:g.moduleDetails)||[]).filter(C=>{const D=String(C.status||"").toUpperCase();return["SUBMITTED","SLOT_ASSIGNED","EVALUATED"].includes(D)}),[g]),B=c.useMemo(()=>w.find(C=>String(C.id||"")===String(o||""))||null,[w,o]);c.useEffect(()=>{a&&N()},[a,N]);const y=c.useMemo(()=>g!=null&&g.location?String(g.location).trim():"",[g]),M=Ke(y).includes("online"),k=c.useMemo(()=>Rt(B,["modules","module_name","moduleName","techStack","tech_stack"]).map(C=>String(C||"").trim().toLowerCase()).filter(Boolean),[B]),T=c.useMemo(()=>g?y?o?null:"Select a project module to see eligible mentors":"Batch location not found for this team":"Select a team first to see eligible mentors",[g,y,o]),R=c.useMemo(()=>{if(!g||!y||!o)return[];const C=p.filter(m=>Bt(m,y,M)),D=C.filter(m=>zt(m,k));return D.length>0?D:C},[p,g,y,o,k,M]);c.useEffect(()=>{if(v||!a||!E)return;R.some(D=>Qs(D)===String(E))||S("")},[a,E,R,v,S]);const Y=c.useMemo(()=>{const C=p.filter(m=>Bt(m,y,M)),D=C.filter(m=>zt(m,k));return{total:p.length,locationMatched:C.length,moduleMatched:D.length,totalCount:p.length,eligibleCount:R.length,usingModuleMatch:D.length>0,batchLabel:g?String(g.batchId||""):null,location:y||null,modules:k}},[p,y,M,k,R,g]),H=(r==null?void 0:r.conflicts)||(i==null?void 0:i.conflicts)||[],K=Ks((r==null?void 0:r.availableSlots)||(i==null?void 0:i.availableSlots)||[]).flatMap(C=>{const D=ue(),m=ue(`${C.slotDate}T${C.startTime}`),b=ue(`${C.slotDate}T${C.endTime}`);if(!b.isAfter(D))return[];if(!m.isBefore(D))return[C];const F=D.hour()*60+D.minute(),z=D.startOf("day").add(Math.floor(F/30)*30+30,"minute");return b.isAfter(z)?[{...C,startTime:z.format("HH:mm:ss")}]:[]}),U=!!i||(r==null?void 0:r.available)===!1;return{selectedTeam:g,selectedModuleOptions:w,selectedModule:B,batchLocation:y,selectedModuleNames:k,mentorEmptyReason:T,eligibleMentors:R,mentorMatchStats:Y,availabilityConflicts:H,upcomingSuggestedTimeRanges:K,hasAvailabilityConflict:U}}function ta({teamStatusFilter:t=null,reviewType:a=""}={}){const[o,p]=c.useState(!0),[v,E]=c.useState(!1),[S,N]=c.useState(!1),[r,i]=c.useState([]),[g,w]=c.useState([]),[B,y]=c.useState(0),[M,k]=c.useState(1),[T,R]=c.useState(10),[Y,H]=c.useState([]),[re,K]=c.useState([]),[U,C]=c.useState(0),[D,m]=c.useState({scheduled:0,rescheduled:0}),[b,F]=c.useState([]),[z,ae]=c.useState(!1),[L,q]=c.useState(null),[$,ie]=c.useState(!1),[he,ye]=c.useState("SUBMITTED_PROJECTS"),[O,I]=c.useState(""),[de,be]=c.useState(1),[ce,we]=c.useState(10),[ve,me]=c.useState(null),[se,fe]=c.useState(""),[Ne,_]=c.useState(""),[Z,xe]=c.useState(""),[Q,l]=c.useState(""),[h,le]=c.useState([]),[De,Le]=c.useState(!1),[Oe,_e]=c.useState(!1),[ke,Ae]=c.useState(null),[Ee,u]=c.useState(null),[G,ne]=c.useState(null),[ge,oe]=c.useState(null),[Me,ee]=c.useState(null),[Qe,Ie]=c.useState(!1),Te=c.useRef(0),Xe=c.useCallback(async(d=1,f=10,A="",V="",W=a)=>{try{const X=await is({page:d,pageSize:f,search:A,location:V,reviewType:W});w(X.items||[]),y(Number(X.total||0)),k(Number(X.page||d)),R(Number(X.pageSize||f))}catch{w([]),y(0)}},[a]),pt=c.useCallback(async(d="")=>{try{const f=await Ft(null,d,a);m({scheduled:Number((f==null?void 0:f.scheduled)||0),rescheduled:Number((f==null?void 0:f.rescheduled)||0)})}
1catch{m({scheduled:0,rescheduled:0})}},[a]),Re=c.useCallback(async()=>{p(!0);const d=["REREVIEW","RE_REVIEW"].includes(String(t||"").toUpperCase());try{const[f,A]=await Promise.allSettled([ds(d?{}:t?{status:t}:{}),Ft(null,"",a)]);if(f.status==="rejected")throw f.reason;const V=f.value,W=A.status==="fulfilled"?A.value:{};let X=V.items||[];if(d){const te=(await cs({page:1,pageSize:100})).items||[],J=new Map(te.map(n=>[`${n.teamId||n.team_id}:${n.moduleId||n.module_id}`,n]));X=X.map(n=>({...n,moduleDetails:(n.moduleDetails||n.module_details||[]).map(x=>{const P=J.get(`${n.teamId||n.team_id}:${x.id||x.moduleId||x.module_id}`);return P?{...x,reReviewHistory:P.reviewHistory||P.review_history||[],reReviewEvaluation:P.evaluation||P.evaluation_report||null,reReviewSlotStatus:P.slotStatus||P.slot_status||"PENDING"}:null}).filter(Boolean)})).filter(n=>(n.moduleDetails||[]).length>0)}i(X),m({scheduled:Number((W==null?void 0:W.scheduled)||0),rescheduled:Number((W==null?void 0:W.rescheduled)||0)}),Xe(1,10,""),It().then(pe=>{const te=Array.isArray(pe==null?void 0:pe.mentors)?pe.mentors:Array.isArray(pe)?pe:[];F(te)}).catch(()=>{})}catch(f){Se.error((f==null?void 0:f.message)||"Failed to fetch slots information")}finally{p(!1)}},[Xe,a,t]),Pe=c.useCallback(async(d,f=1,A=10,V="",W="",X="",pe=a)=>{E(!0);try{const te=await us(null,d,{page:f,pageSize:A,search:V,slotDate:W,location:X,reviewType:pe});K(te.items||[]),C(Number(te.total||0)),be(Number(te.page||f)),we(Number(te.pageSize||A)),H(J=>{const n=[...J,...te.items||[]];return Array.from(new Map(n.map(x=>[x.slotId,x])).values())})}catch(te){Se.error((te==null?void 0:te.message)||`Failed to fetch ${d.toLowerCase()} slots`)}finally{E(!1)}},[a]),Ue=d=>{ye(d),be(1),d==="SCHEDULED_SLOTS"?Pe("SCHEDULED",1,ce,"","",O):d==="RESCHEDULED_SLOTS"&&Pe("RESCHEDULED",1,ce,"","",O)};c.useEffect(()=>{Re()},[Re]);const Be=c.useCallback(async()=>{ae(!0);try{const d=await It(),f=Array.isArray(d==null?void 0:d.mentors)?d.mentors:Array.isArray(d)?d:[];F(f)}catch{F([])}finally{ae(!1)}},[]),We=c.useCallback(async d=>{Le(!0);try{const A=String(d||"").trim().toLowerCase().includes("online"),V=await ms({page:1,limit:100,...A||!d?{}:{location:d}}),W=Array.isArray(V==null?void 0:V.data)?V.data:[];le(W.filter(X=>["ACTIVE","OCCUPIED"].includes(String(X.status||"ACTIVE").toUpperCase())))}catch{le([])}finally{Le(!1)}},[]),Ze=d=>{oe(null),ee(null),_e(!0),q(d),fe(d.teamId),_(d.moduleId||""),xe(d.mentorId),l(d.cabinId||""),Ae(d.slotDate?ue(d.slotDate):null),u(d.startTime?ue(`2026-01-01T${d.startTime}`):null),ne(d.endTime?ue(`2026-01-01T${d.endTime}`):null);const f=r.find(A=>String(A.teamId)===String(d.teamId));We((f==null?void 0:f.location)||d.cabinLocation||""),ie(!0)},et=()=>{q(null),fe(""),_(""),xe(""),l(""),le([]),_e(!1),Ae(null),u(null),ne(null),oe(null),ee(null)},ht=(d,f=null)=>{et(),Be(),fe(d.teamId||d.id),f&&_(f.id||f.moduleId||""),_e(!0),We(d.location||d.batchLocation||""),ie(!0)},ze=c.useCallback(async(d,f,A,V,W)=>{const X=++Te.current;if(!d||!f||!A||!V){oe(null),ee(null),Ie(!1);return}const pe=f.format("YYYY-MM-DD"),te=A.format("HH:mm"),J=V.format("HH:mm");Ie(!0);try{const n=await xs({mentorId:d,slotDate:pe,startTime:te,endTime:J,cabinId:W,excludeTeamId:(L==null?void 0:L.teamId)||(L==null?void 0:L.team_id)||null});if(X!==Te.current)return;ee(n),n.available?oe(null):oe(n.conflictReason||n.message||"Mentor is not available during the selected time.")}catch(n){if(X!==Te.current)return;oe(null),ee({error:(n==null?void 0:n.message)||"Unable to check mentor availability."})}finally{X===Te.current&&Ie(!1)}},[L]);c.useEffect(()=>{if(!$)return;const d=setTimeout(()=>{ze(Z,ke,Ee,G,Q)},150);return()=>clearTimeout(d)},[$,Z,ke,Ee,G,Q,ze]);const gt=async d=>{var W,X,pe,te;if(d==null||d.preventDefault(),!se||!Z||!Q||!ke||!Ee||!G){Se.warning("Please fill in all required fields");return}N(!0),oe(null);const f=ke.format("YYYY-MM-DD"),A=Ee.format("HH:mm"),V=G.format("HH:mm");try{L?(await gs(L.teamId||se,{moduleId:Ne||L.moduleId||null,mentorId:Z,cabinId:Q,cabinName:((W=h.find(n=>String(n.id)===String(Q)))==null?void 0:W.name)||null,cabinLocation:((X=h.find(n=>String(n.id)===String(Q)))==null?void 0:X.location)||null,slotDate:f,startTime:A,endTime:V}),Se.success("Slot rescheduled successfully!")):(await bs(se,{moduleId:Ne||null,mentorId:Z,cabinId:Q,cabinName:((pe=h.find(n=>String(n.id)===String(Q)))==null?void 0:pe.name)||null,cabinLocation:((te=h.find(n=>String(n.id)===String(Q)))==null?void 0:te.location)||null,slotDate:f,startTime:A,endTime:V}),Se.success("Slot assigned successfully!"));const J=L?"RESCHEDULED_SLOTS":"SCHEDULED_SLOTS";ie(!1),et(),Re(),Ue(J)}catch(J){(J==null?void 0:J.code)==="SLOT_CONFLICT"||J!=null&&J.conflictReason?oe((J==null?void 0:J.conflictReason)||"Slot conflict detected"):Se.error((J==null?void 0:J.message)||"Failed to assign slot")}finally{N(!1)}},bt=c.useCallback(async d=>{if(String((d==null?void 0:d.evaluationStatus)||(d==null?void 0:d.evaluation_status)||"").toUpperCase()==="EVALUATED"){Se.warning("Evaluated review slots cannot be deleted");return}const f=(d==null?void 0:d.slotId)||(d==null?void 0:d.slot_id);try{await ps(d.teamId||d.team_id,d.moduleId||d.module_id||null),H(A=>A.filter(V=>String(V.slotId)!==String(f))),K(A=>A.filter(V=>String(V.slotId)!==String(f))),C(A=>Math.max(0,A-1)),Se.success("Review slot deleted successfully"),await Re(),he==="SCHEDULED_SLOTS"?await Pe("SCHEDULED",de,ce):he==="RESCHEDULED_SLOTS"&&await Pe("RESCHEDULED",de,ce)}catch(A){Se.error((A==null?void 0:A.message)||"Failed to delete review slot")}},[he,Re,Pe,de,ce]),ft=c.useCallback(async d=>{const f=(d==null?void 0:d.teamId)||(d==null?void 0:d.team_id)||"",A=(d==null?void 0:d.moduleId)||(d==null?void 0:d.module_id)||null;if(!f){Se.error("Unable to identify the submitted project");return}const V=`${f}-${A||"team"}`;me(V);try{await hs(f,A),Se.success("Final submission reverted. The student can edit again."),await Re()}catch(W){Se.error((W==null?void 0:W.message)||"Failed to revert final submission")}finally{me(null)}},[Re]);return{loading:o,slotsLoading:v,submitLoading:S,teams:r,evaluatedProjectModules:g,evaluatedProjectModuleTotal:B,evaluatedPage:M,setEvaluatedPage:k,evaluatedPageSize:T,setEvaluatedPageSize:R,slots:Y,catalogSlots:re,catalogTotal:U,slotCounts:D,mentors:b,mentorsLoading:z,selectedSlot:L,setSelectedSlot:q,schedulerModalOpen:$,setSchedulerModalOpen:ie,activeView:he,setActiveView:ye,locationFilter:O,setLocationFilter:I,slotPage:de,setSlotPage:be,slotPageSize:ce,setSlotPageSize:we,teamId:se,setTeamId:fe,moduleId:Ne,setModuleId:_,mentorId:Z,setMentorId:xe,cabinId:Q,setCabinId:l,cabins:h,cabinsLoading:De,assignmentLocked:Oe,slotDate:ke,setSlotDate:Ae,startTime:Ee,setStartTime:u,endTime:G,setEndTime:ne,availabilityConflict:ge,setAvailabilityConflict:oe,availabilityInfo:Me,setAvailabilityInfo:ee,availabilityLoading:Qe,loadData:Re,loadSlotStats:pt,loadEvaluatedProjectModules:Xe,loadSlotsForStatus:Pe,loadMentorsForTeam:Be,handleTabChange:Ue,handleEditClick:Ze,handleResetForm:et,handleOpenSchedulerModal:ht,checkAvailability:ze,handleAssignSubmit:gt,handleDeleteClick:bt,handleRevertSubmissionClick:ft,revertingSubmissionId:ve}}const je="#2333CB",ut="#EEF0FB",mt="#1A26A8",sa=new Set(["ADMIN","PLACEMENTCOORDINATOR","SUPERMANAGER","SUPERADMIN"]);function Ht(t){return String(t||"").replace(/[\s_-]/g,"").toUpperCase()}function aa(t,a){const o=a.submission||null;return{...t,cardId:`${t.teamId}-${a.id}`,moduleId:a.id,modules:a.modules||[],status:a.status,projectDeadline:a.projectDeadline||t.projectDeadline,leaderStudentId:a.leaderStudentId||null,members:a.members||[],reReviewHistory:a.reReviewHistory||a.re_review_history||[],reReviewEvaluation:a.reReviewEvaluation||a.re_review_evaluation||null,reReviewSlotStatus:a.reReviewSlotStatus||a.re_review_slot_status||"PENDING",teamMembers:a.members||[],submission:o,projectTitle:(o==null?void 0:o.projectTitle)||(o==null?void 0:o.project_title)||"",projectDescription:(o==null?void 0:o.projectDescription)||(o==null?void 0:o.project_description)||"",githubRepoUrl:(o==null?void 0:o.githubRepoUrl)||(o==null?void 0:o.github_repo_url)||"",liveUrl:(o==null?void 0:o.liveUrl)||(o==null?void 0:o.live_url)||""}}function la(t={},a=!1){const o=String(t.status||"").toUpperCase(),p=t.submission||null,v=String((p==null?void 0:p.status)||"").toUpperCase();return["SLOT_ASSIGNED","SCHEDULED","RESCHEDULED","EVALUATED",...a?[]:["REREVIEW","RE_REVIEW"]].includes(o)?!1:!!(o==="SUBMITTED"||p||t.submitted_at||t.submittedAt||["SUBMITTED","LOCKED"].includes(v))}function na(t={}){const a=t.submission||{};return!!(a.submitted_at||a.submittedAt||t.submitted_at||t.submittedAt)}function ya(){const{pathname:t}=ts(),a=ss(),o=t.endsWith("/re-reviews"),[p,v]=c.useState(!1);Ms(o?"Project Re-Review":"Review Slots");
1const E=Mt(n=>{var x;return(x=n.auth)==null?void 0:x.currentRole}),S=Mt(n=>{var x;return(x=n.auth)==null?void 0:x.userInfo}),N=Ht(E||(S==null?void 0:S.role)||(S==null?void 0:S.userType))==="ADMIN",r=Us(E||(S==null?void 0:S.role)||(S==null?void 0:S.userType)),i=sa.has(Ht(E||(S==null?void 0:S.role)||(S==null?void 0:S.userType))),g=t.endsWith("/availability")||t.endsWith("/cabin-overview")?"cabin-overview":t.endsWith("/cabin-availability")?"cabin-availability":t.endsWith("/mentor-availability")?"mentor-availability":null,[w,B]=c.useState(g||"slots");c.useEffect(()=>{B(g||"slots")},[g]);const{loading:y,slotsLoading:M,submitLoading:k,teams:T,evaluatedProjectModules:R,evaluatedProjectModuleTotal:Y,evaluatedPage:H,evaluatedPageSize:re,loadEvaluatedProjectModules:K,slots:U,catalogSlots:C,catalogTotal:D,slotCounts:m,mentors:b,mentorsLoading:F,selectedSlot:z,setSelectedSlot:ae,schedulerModalOpen:L,setSchedulerModalOpen:q,activeView:$,locationFilter:ie,setLocationFilter:he,slotPage:ye,slotPageSize:O,teamId:I,setTeamId:de,moduleId:be,setModuleId:ce,mentorId:we,setMentorId:ve,cabinId:me,setCabinId:se,cabins:fe,cabinsLoading:Ne,assignmentLocked:_,slotDate:Z,setSlotDate:xe,startTime:Q,setStartTime:l,endTime:h,setEndTime:le,availabilityConflict:De,setAvailabilityConflict:Le,availabilityInfo:Oe,setAvailabilityInfo:_e,availabilityLoading:ke,loadData:Ae,loadSlotStats:Ee,loadSlotsForStatus:u,loadMentorsForTeam:G,handleOpenSchedulerModal:ne,handleTabChange:ge,handleEditClick:oe,handleDeleteClick:Me,handleRevertSubmissionClick:ee,revertingSubmissionId:Qe,handleResetForm:Ie,handleAssignSubmit:Te}=ta({teamStatusFilter:o?"REREVIEW":null,reviewType:o?"RE_REVIEW":"STANDARD"}),Xe=async()=>{v(!0);try{const n=await fs();await Ae(),Se.success(`${n.count||0} project re-review(s) synced.`)}catch(n){Se.error((n==null?void 0:n.message)||"Failed to sync re-reviews.")}finally{v(!1)}},pt=c.useMemo(()=>{const n=[...T,...R].map(x=>(x==null?void 0:x.location)||(x==null?void 0:x.Location)||(x==null?void 0:x.batchLocation)||(x==null?void 0:x.batch_location)||"").map(x=>String(x).trim()).filter(Boolean);return Array.from(new Set(n)).sort((x,P)=>x.localeCompare(P))},[R,T]),Re=c.useCallback((n,x="",P="")=>{const Ce=n||"";he(Ce),Ee(Ce),$!=="EVALUATED_PROJECTS"&&K(1,re,"",Ce),($==="SCHEDULED_SLOTS"||$==="RESCHEDULED_SLOTS")&&u($==="RESCHEDULED_SLOTS"?"RESCHEDULED":"SCHEDULED",1,O,x,P,Ce)},[$,re,Ee,K,u,he,O]),Pe=c.useCallback(n=>{n&&(xe(ue(n.slotDate)),l(ue(`2000-01-01T${n.startTime}`)),le(ue(`2000-01-01T${n.endTime}`)),Le(null),_e(null))},[Le,_e,le,xe,l]),Ue=c.useCallback(n=>T.find(x=>String(x.teamId||x.group_id||x.groupId||x._id||"")===String(n))||null,[T]),Be=c.useCallback(n=>{const x=Ue(n);return x?x.teamName||x.team_name||x.groupName||x.group_name||`Team ${n}`:`Team ${n}`},[Ue]),We=c.useCallback(n=>{var P,Ce,ot,rt;const x=(Ce=(P=n==null?void 0:n.moduleDetails)==null?void 0:P.find(qe=>qe==null?void 0:qe.submission))==null?void 0:Ce.submission;return(n==null?void 0:n.projectTitle)||(n==null?void 0:n.project_title)||(n==null?void 0:n.projectName)||(n==null?void 0:n.project_name)||((ot=n==null?void 0:n.submission)==null?void 0:ot.project_title)||((rt=n==null?void 0:n.submission)==null?void 0:rt.projectTitle)||(x==null?void 0:x.project_title)||(x==null?void 0:x.projectTitle)||"Untitled Project"},[]),Ze=c.useCallback(n=>{const x=n.teamId||n.team_id,P=n.moduleId||n.module_id;if(!x||!P)return;const Ce=t.split("/project-hub/")[0]||"";a(`${Ce}/project-hub/reports/detail/${encodeURIComponent(x)}/module/${encodeURIComponent(P)}`)},[a,t]),et=n=>{if(!n)return"â";const x=b.find(P=>String(P.id||P.mentor_id||P.mentorId||P.empId||P.employee_id||P.employeeId||P._id||P.email||P.name||"")===String(n));return(x==null?void 0:x.name)||(x==null?void 0:x.email)||n},ht=c.useMemo(()=>[...T].sort((n,x)=>{const P=String(n.status||"").toUpperCase(),Ce=String(x.status||"").toUpperCase(),ot=P==="SUBMITTED",rt=Ce==="SUBMITTED",qe=U.some(jt=>jt.teamId===n.teamId),Lt=U.some(jt=>jt.teamId===x.teamId);return(ot&&!qe?0:qe?1:2)-(rt&&!Lt?0:Lt?1:2)}),[T,U]),ze=c.useMemo(()=>T.flatMap(n=>(n.moduleDetails||[]).filter(x=>la(x,o)?o?!["SCHEDULED","RESCHEDULED"].includes(String(x.reReviewSlotStatus||x.re_review_slot_status||"").toUpperCase()):!0:!1).map(x=>aa(n,x))),[o,T]),gt=c.useMemo(()=>ze.filter(n=>na(n)?ie?String(n.location||"").trim().toLowerCase()===String(ie).trim().toLowerCase():!0:!1).length,[ie,ze]),{selectedTeam:bt,selectedModuleOptions:ft,batchLocation:d,selectedModuleNames:f,mentorEmptyReason:A,eligibleMentors:V,mentorMatchStats:W,availabilityConflicts:X,upcomingSuggestedTimeRanges:pe,hasAvailabilityConflict:te}=ea({teams:T,teamId:I,moduleId:be,mentors:b,selectedSlot:z,mentorId:we,setMentorId:ve,loadMentorsForTeam:G,availabilityInfo:Oe,availabilityConflict:De}),J=c.useMemo(()=>qs({getTeamName:Be,getTeamById:Ue,getProjectTitle:We,mentors:b,handleEditClick:oe,handleDeleteClick:Me,handleViewReport:Ze}),[Be,Ue,We,b,oe,Me,Ze]);return y?e.jsx(Js,{}):e.jsxs("div",{className:"w-full min-h-screen",style:{background:"#F8F9FF"},children:[e.jsx("style",{children:` 2 .slots-page .ant-select-selector { 3 border-radius: 10px !important; 4 border-color: #E2E8F0 !important; 5 font-size: 13px !important; 6 transition: all 0.2s !important; 7 } 8 .slots-page .ant-select-focused .ant-select-selector, 9 .slots-page .ant-select-selector:hover { 10 border-color: ${je} !important; 11 box-shadow: 0 0 0 3px rgba(35,51,203,0.1) !important; 12 } 13 .slots-page .ant-picker { 14 border-radius: 10px !important; 15 border-color: #E2E8F0 !important; 16 width: 100% !important; 17 font-size: 13px !important; 18 } 19 .slots-page .ant-picker:hover, 20 .slots-page .ant-picker-focused { 21 border-color: ${je} !important; 22 box-shadow: 0 0 0 3px rgba(35,51,203,0.1) !important; 23 } 24 .slots-page .ant-btn-primary { 25 background: ${je} !important; 26 border-color: ${je} !important; 27 border-radius: 10px !important; 28 font-weight: 600 !important; 29 letter-spacing: 0.01em !important; 30 } 31 .slots-page .ant-btn-primary:hover { 32 background: ${mt} !important; 33 border-color: ${mt} !important; 34 } 35 .slots-page .ant-table-thead > tr > th { 36 background: #F8F9FF !important; 37 font-size: 11px !important; 38 font-weight: 700 !important; 39 text-transform: uppercase !important; 40 letter-spacing: 0.06em !important; 41 color: #64748B !important; 42 border-bottom: 2px solid #EEF0FB !important; 43 } 44 .slots-page .ant-table-tbody > tr:hover > td { 45 background: ${ut} !important; 46 } 47 .slots-page .ant-table-tbody > tr > td { 48 border-bottom: 1px solid #F1F5F9 !important; 49 padding: 14px 16px !important; 50 } 51 .slots-page, 52 .slots-page * { 53 box-sizing: border-box; 54 } 55 .slots-page .ant-table-wrapper { 56 min-width: 0; 57 } 58 .slots-page .ant-pagination { 59 flex-wrap: wrap; 60 row-gap: 8px; 61 } 62 .slots-page .ant-pagination-options { 63 margin-inline-start: 0; 64 } 65 .slots-page .slots-mobile-cards { 66 display: none; 67 } 68 .slots-page .slots-table-desktop { 69 display: block; 70 } 71 .slots-scheduler-modal .ant-modal-content { 72 max-width: 100%; 73 } 74 .slots-page-card-enter { 75 animation: cardSlideIn 0.4s ease forwards; 76 } 77 @keyframes cardSlideIn { 78 from { opacity: 0; transform: translateY(12px); } 79 to { opacity: 1; transform: translateY(0); } 80 } 81 @media (max-width: 1023px) { 82 .slots-page .slots-mobile-cards { 83 display: grid; 84 } 85 .slots-page .slots-table-desktop { 86 display: none; 87 } 88 .slots-page .slots-page-header { 89 align-items: stretch; 90 } 91 .slots-page .slots-page-header-content { 92 min-width: 0; 93 } 94 .slots-page .slots-page-subtitle { 95 flex-wrap: wrap; 96 } 97 .slots-page .slots-panel-header { 98 align-items: stretch; 99 } 100 .slots-page .slots-panel-tabs { 101 max-width: 100%; 102 overflow-x: auto; 103 scrollbar-width: thin; 104 } 105 .slots-page .slots-panel-tabs button { 106 flex: 0 0 auto; 107 white-space: nowrap; 108 } 109 } 110 @media (max-width: 639px) { 111 .slots-page { 112 padding: 16px 12px; 113 } 114 .slots-page .slots-page-header { 115 flex-direction: column; 116 gap: 14px; 117 position: relative; 118 } 119 .slots-page .slots-page-header-content { 120 align-items: flex-start; 121 gap: 12px; 122 padding-right: 88px; 123 } 124 .slots-page .slots-page-header-icon { 125 width: 44px; 126 height: 44px; 127 border-radius: 14px; 128 } 129 .slots-page .slots-page-header-icon svg { 130 width: 22px; 131 height: 22px; 132 } 133 .slots-page .slots-page-title { 134 font-size: 1.35rem; 135 line-height: 1.2; 136 } 137 .slots-page .slots-page-subtitle { 138 align-items: flex-start; 139 gap: 6px; 140 line-height: 1.45; 141 } 142 .slots-page .slots-page-refresh { 143 position: absolute; 144 right: 0; 145 top: 0; 146 width: auto; 147 align-self: auto; 148 width: 40px; 149 height: 40px; 150 justify-content: center; 151 padding: 0; 152 font-size: 0; 153 } 154 .slots-page .slots-page-refresh-label { 155 display: none; 156 } 157 .slots-page .operations-toolbar { 158 padding: 12px; 159 } 160 .slots-page .operations-toolbar > span { 161 width: 100%; 162 margin: 0 0 2px; 163 } 164 .slots-page .operations-toolbar button { 165 flex: 1 1 calc(50% - 4px); 166 justify-content: center; 167 min-height: 36px; 168 padding-inline: 8px; 169 text-align: center; 170 } 171 .slots-page .operations-content { 172 padding: 12px; 173 } 174 .slots-page .slots-panel-header { 175 padding: 14px 12px; 176 } 177 .slots-page .slots-panel-title { 178 min-width: 0; 179 } 180 .slots-page .slots-panel-tabs { 181 width: 100%; 182 flex-wrap: wrap; 183 overflow-x: visible; 184 } 185 .slots-page .slots-panel-tabs button { 186 flex: 1 1 calc(50% - 4px); 187 justify-content: center; 188 min-width: 0; 189 padding-inline: 10px; 190 white-space: normal; 191 text-align: center; 192 } 193 .slots-page .slots-catalog-cards { 194 padding: 12px; 195 } 196 .slots-page .slots-catalog-table { 197 padding: 8px; 198 } 199 .slots-page .slots-page-card-footer { 200 align-items: flex-start; 201 } 202 .slots-page .slots-page-card-id { 203 max-width: 100%; 204 } 205 .slots-page .slots-page-card-actions { 206 width: 100%; 207 justify-content: space-between; 208 flex-wrap: wrap; 209 } 210 .slots-page .ant-table-thead > tr > th, 211 .slots-page .ant-table-tbody > tr > td { 212 padding: 12px !important; 213 } 214 .slots-page .ant-pagination { 215 justify-content: center; 216 } 217 .slots-scheduler-modal.ant-modal-wrap { 218 padding: 12px 0; 219 } 220 .slots-scheduler-modal .ant-modal { 221 max-width: calc(100vw - 24px); 222 margin: 0 auto; 223 } 224 .slots-scheduler-modal .ant-modal-body { 225 max-height: calc(100vh - 104px); 226 } 227 } 228 `}),e.jsxs("div",{className:"slots-page max-w-[1680px] mx-auto px-6 py-8 space-y-7",children:[e.jsxs("div",{className:"slots-page-header flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"slots-page-header-content flex items-center gap-4",children:[e.jsx("div",{className:"slots-page-header-icon w-14 h-14 roun
228ded-2xl flex items-center justify-center shadow-lg flex-shrink-0",style:{background:`linear-gradient(135deg, ${je} 0%, ${mt} 100%)`},children:e.jsx(Ge,{size:26,className:"text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"slots-page-title text-2xl font-extrabold tracking-tight text-slate-900",children:o?"Project Re-Review":"Review Slots Scheduler"}),e.jsxs("p",{className:"slots-page-subtitle text-sm text-slate-500 mt-0.5 flex items-center gap-2",children:["Allocate and reschedule project evaluation timeslots for",e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-bold",style:{background:ut,color:je},children:[e.jsx(nt,{size:10}),"submitted student teams"]})]})]})]}),e.jsxs("button",{onClick:Ae,type:"button","aria-label":"Refresh slots",title:"Refresh slots",className:"slots-page-refresh flex items-center gap-2 px-4 py-2.5 rounded-xl text-sm font-semibold border transition-all duration-200 shadow-sm bg-white hover:shadow-md",style:{borderColor:"rgba(35,51,203,0.2)",color:je},onMouseEnter:n=>{n.currentTarget.style.background=ut},onMouseLeave:n=>{n.currentTarget.style.background="#fff"},children:[e.jsx(lt,{size:15,className:y?"animate-spin":""}),e.jsx("span",{className:"slots-page-refresh-label",children:"Refresh"})]}),o&&N&&e.jsxs("button",{onClick:Xe,type:"button",disabled:p,className:"slots-page-refresh flex items-center gap-2 rounded-xl border bg-white px-4 py-2.5 text-sm font-semibold shadow-sm transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60",style:{borderColor:"rgba(35,51,203,0.2)",color:je},children:[e.jsx(lt,{size:15,className:p?"animate-spin":""}),e.jsx("span",{children:"Sync Re-Reviews"})]})]}),!o&&e.jsxs("div",{className:"rounded-2xl border bg-white shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"operations-toolbar flex flex-wrap items-center gap-2 border-b border-slate-100 px-4 py-3",children:[e.jsx("span",{className:"mr-2 text-xs font-bold uppercase tracking-wider text-slate-500",children:"Availability Operations"}),[{key:"slots",label:"Slots",icon:e.jsx(Ge,{size:14})},{key:"cabin-overview",label:"Cabin Overview Map",icon:e.jsx(ks,{size:14})},{key:"cabin-availability",label:"Cabin Availability",icon:e.jsx(Et,{size:14})},{key:"mentor-availability",label:"Mentor Availability",icon:e.jsx(nt,{size:14})}].map(n=>e.jsxs("button",{type:"button",onClick:()=>B(x=>x===n.key?null:n.key),className:"inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs font-semibold transition-colors",style:w===n.key?{background:je,color:"#fff",borderColor:je}:{background:"#fff",color:"#475569",borderColor:"#E2E8F0"},children:[n.icon,n.label]},n.key))]}),w&&w!=="slots"&&e.jsxs("div",{className:"operations-content p-4 md:p-6",children:[w==="cabin-overview"&&e.jsx(Fs,{}),w==="cabin-availability"&&e.jsx(Is,{}),w==="mentor-availability"&&e.jsx(Ps,{hideBackButton:!0})]})]}),(!w||w==="slots")&&e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 items-start",children:[e.jsxs("div",{className:"flex-1 min-w-0 bg-white rounded-2xl shadow-sm border overflow-hidden",style:{borderColor:"rgba(0,0,0,0.07)"},children:[e.jsxs("div",{className:"slots-panel-header px-6 py-4 border-b flex items-center justify-between flex-wrap gap-3",style:{borderColor:"#F1F5F9"},children:[e.jsxs("div",{className:"slots-panel-title flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-5 rounded-full",style:{background:`linear-gradient(to bottom, ${je}, ${mt})`}}),e.jsx("h2",{className:"text-sm font-bold text-slate-900",children:$==="SUBMITTED_PROJECTS"?o?"Projects Requiring Re-Review":"Submitted Projects for Review":$==="EVALUATED_PROJECTS"?"Evaluated Project Modules":$==="RESCHEDULED_SLOTS"?"Rescheduled Slots Catalog":"Scheduled Slots Catalog"})]}),e.jsx("div",{className:"slots-panel-tabs flex items-center p-1 rounded-xl gap-1",style:{background:"#F1F5F9"},children:[{key:"SUBMITTED_PROJECTS",label:"Submitted Project Modules",count:gt,icon:e.jsx(Rs,{size:13})},{key:"SCHEDULED_SLOTS",label:"Scheduled Slots",count:m.scheduled,icon:e.jsx(Ls,{size:13})},{key:"RESCHEDULED_SLOTS",label:"Rescheduled Slots",count:m.rescheduled,icon:e.jsx(lt,{size:13})},{key:"EVALUATED_PROJECTS",label:"Evaluated Project Modules",count:Y,icon:e.jsx(As,{size:13})}].map(n=>e.jsxs("button",{type:"button",onClick:()=>ge(n.key),className:"px-3.5 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all duration-200",style:$===n.key?{background:"#fff",color:je,boxShadow:"0 1px 4px rgba(0,0,0,0.1)"}:{color:"#64748B"},children:[e.jsx("span",{style:$===n.key?{color:je}:{color:"#94A3B8"},children:n.icon}),n.label,e.jsx("span",{className:"px-1.5 py-0.5 rounded-full text-[10px] font-bold",style:$===n.key?{background:ut,color:je}:{background:"#E2E8F0",color:"#64748B"},children:n.count})]},n.key))})]}
228),e.jsx(Kt,{activeView:$,reviewType:o?"RE_REVIEW":"STANDARD",submittedProjectModules:ze,evaluatedProjectModules:R,evaluatedProjectModuleTotal:Y,evaluatedPage:H,evaluatedPageSize:re,loadEvaluatedProjectModules:K,locationFilter:ie,locationOptions:pt,showLocationFilter:i,onLocationChange:Re,slots:U,columns:J,catalogSlots:C,slotsLoading:M,slotPage:ye,slotPageSize:O,catalogTotal:D,loadSlotsForStatus:u,setTeamId:de,setModuleId:ce,setSelectedSlot:ae,setSchedulerModalOpen:q,handleOpenSchedulerModal:ne,handleEditClick:oe,handleDeleteClick:Me,handleRevertSubmissionClick:ee,revertingSubmissionId:Qe,canRevertSubmission:r,handleViewReport:Ze,getTeamName:Be,getTeamById:Ue,getProjectTitle:We,mentors:b})]}),e.jsx(es,{schedulerModalOpen:L,setSchedulerModalOpen:q,handleResetForm:Ie,selectedSlot:z,handleSubmit:Te,teamId:I,setTeamId:de,teams:T,sortedTeams:ht,slots:U,getTeamName:Be,setModuleId:ce,setMentorId:ve,setAvailabilityConflict:Le,setAvailabilityInfo:_e,selectedModuleOptions:ft,moduleId:be,selectedTeam:bt,mentorsLoading:F,mentorEmptyReason:A,getMentorName:et,eligibleMentors:V,mentorId:we,cabinId:me,setCabinId:se,cabins:fe,cabinsLoading:Ne,assignmentLocked:_,batchLocation:d,selectedModuleNames:f,mentorMatchStats:W,slotDate:Z,setSlotDate:xe,startTime:Q,setStartTime:l,endTime:h,setEndTime:le,availabilityLoading:ke,availabilityInfo:Oe,availabilityConflict:De,hasAvailabilityConflict:te,availabilityConflicts:X,upcomingSuggestedTimeRanges:pe,selectSuggestedTimeRange:Pe,submitLoading:k})]})]})]})}export{ya 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.