1"use strict";(self.webpackChunktest_platform_frontend=self.webpackChunktest_platform_frontend||[]).push([[473],{39581:(e,t,s)=>{s.d(t,{A:()=>x});s(9950);var r=s(95077),l=s(76253),a=s(87831),n=s(47465),d=s(44414);const i=e=>{let{section:t}=e;const{isDarkMode:s}=(0,n.D)(),{pathname:l}=(0,r.zy)();return t&&Array.isArray(t.children)&&0!==t.children.length?(0,d.jsx)("nav",{"aria-label":`${t.name} pages`,className:"mb-6 flex flex-wrap gap-2",children:t.children.map((e=>{const t=(0,a.Nf)(e,l),n=e.icon;return(0,d.jsxs)(r.N_,{to:e.path,"aria-current":t?"page":void 0,className:"inline-flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold transition-all border "+(t?s?"bg-white/10 border-cyan-400/40 text-white":"bg-white border-cyan-300 text-gray-900 shadow-sm":s?"bg-white/5 border-white/10 text-gray-200 hover:bg-white/10":"bg-white/70 border-gray-200 text-gray-700 hover:bg-white"),children:[n?(0,d.jsx)(n,{className:"h-4 w-4"}):null,e.label]},e.path)}))}):null};var c=s(71706),o=s(87414);const x=e=>{let{children:t}=e;const{logout:s}=(0,l.As)(),n=(0,r.zy)(),x=(0,o.Ay)("recruiter");return(0,d.jsxs)("div",{className:"brand-page min-h-screen bg-cosmic",children:[(0,d.jsx)(c.A,{items:a.Mx,isItemActive:a.Ym,isChildActive:a.Nf,autoOpenActive:!0,sidebar:x,onLogout:()=>{s()}}),(0,d.jsx)("div",{className:`flex-1 transition-[margin] ${o.WR} ${x.collapsed?"lg:ml-20":"lg:ml-80"}`,children:(0,d.jsxs)("div",{className:"px-4 sm:px-6 pt-16 md:pt-20 lg:pt-6 pb-6",children:[(0,d.jsx)(i,{section:(0,a.w2)(n.pathname)}),t]})})]})}},10473:(e,t,s)=>{s.r(t),s.d(t,{default:()=>y});var r=s(9950),l=s(35887),a=s(77737),n=s(16195),d=s(45833),i=s(59469),c=s(52828),o=s(19201),x=s(7838),u=s(84814),g=s(3404),m=s(39581),h=s(47465),b=s(23251),p=s(7083),f=s(29565),j=s(44414);const y=()=>{const e=(0,r.useRef)(!1),{isDarkMode:t}=(0,h.D)(),s=(0,b.Yx)(t),[y,w]=(0,r.useState)([]),[N,v]=(0,r.useState)(!0),[$,A]=(0,r.useState)("all"),[M,k]=(0,r.useState)(0),D=(0,r.useRef)(!1),C=(0,r.useCallback)((async function(){let{silent:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=e.current;try{t||s||v(!0);const e=await g.Kp.getScheduledTests();D.current&&null!==e&&void 0!==e&&e.success&&w(Array.isArray(e.data)?e.data:[])}catch(r){console.error("Error fetching scheduled tests:",r),s||l.oR.error("Failed to load scheduled tests")}finally{t||v(!1)}}),[]);(0,r.useEffect)((()=>(D.current=!0,C(),()=>{D.current=!1})),[C,M]),(0,p.A)("/api/scheduled-tests",null,(()=>{e.current=!0,k((e=>e+1))}));const S=(0,r.useMemo)((()=>y.some((e=>"pending"===e.status||"generating"===e.status))),[y]);(0,r.useEffect)((()=>{if(!S)return;const e=setInterval((()=>C({silent:!0})),5e3);return()=>clearInterval(e)}),[C,S]);const T=e=>{const s={pending:t?"text-yellow-300":"text-yellow-600",generating:t?"text-sky-300":"text-blue-600",generated:t?"text-emerald-300":"text-green-600",failed:t?"text-red-300":"text-red-600"}[e]||(t?"text-gray-300":"text-gray-600");switch(e){case"pending":return(0,j.jsx)(a.A,{className:`h-4 w-4 ${s}`});case"generating":return(0,j.jsx)(n.A,{className:`h-4 w-4 ${s} animate-pulse`});case"generated":return(0,j.jsx)(d.A,{className:`h-4 w-4 ${s}`});case"failed":return(0,j.jsx)(i.A,{className:`h-4 w-4 ${s}`});default:return(0,j.jsx)(c.A,{className:`h-4 w-4 ${s}`})}},I=(0,r.useMemo)((()=>y.filter((e=>"all"===$||e.status===$))),[$,y]);(0,r.useEffect)((()=>{e.current=!1}));const _=e=>{const t=new Date,s=new Date(e)-t;if(s<0)return"Overdue";const r=Math.floor(s/864e5),l=Math.floor(s%864e5/36e5),a=Math.floor(s%36e5/6e4);return r>0?`${r}d ${l}h`:l>0?`${l}h ${a}m`:`${a}m`};return N?(0,j.jsx)(m.A,{children:(0,j.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,j.jsx)(f.A,{size:32})})}):(0,j.jsx)(m.A,{children:(0,j.jsxs)("div",{className:`p-6 max-w-7xl mx-auto ${s.textPrimary}`,children:[(0,j.jsxs)("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-6",children:[(0,j.jsxs)("div",{children:[(0,j.jsxs)("h1",{className:`text-2xl font-bold flex items-center gap-2 ${s.textPrimary}`,children:[(0,j.jsx)(o.A,{className:"h-6 w-6 "+(t?"text-teal-300":"text-purple-600")}),"Scheduled Tests"]}),(0,j.jsx)("p",{className:`mt-1 ${s.textMuted}`,children:"Monitor your scheduled AI test generations (auto-generates when you schedule)"})]}),(0,j.jsx)("div",{className:`flex rounded-lg p-1 ${t?"bg-gray-800":"bg-gray-100"} border ${s.borderSecondary}`,children:[{key:"all",label:"All",count:y.length},{key:"pending",label:"Pending",count:y.filter((e=>"pending"===e.status)).length},{key:"generating",label:"Generating",count:y.filter((e=>"generating"===e.status)).length},{key:"generated",label:"Generated",count:y.filter((e=>"generated"===e.status)).length},{key:"failed",label:"Failed",count:y.filter((e=>"failed"===e.status)).length}].map((e=>(0,j.jsxs)("button",{onClick:()=>A(e.key),className:"px-3 py-2 rounded-md text-sm font-medium transition-colors "+($===e.key?t?"bg-gray-900 text-teal-200 shadow-sm":"bg-white text-purple-600 shadow-sm":`${s.textMuted} hover:${s.textPrimary}`),children:[e.label," (",e.count,")"]},e.key)))})]}),(0,j.jsxs)("div",{className:"space-y-4",children:[I.map((e=>{return(0,j.jsxs)("div",{className:`${s.bgCard} rounded-2xl ${s.shadowSm} border ${s.borderSecondary} p-6`,children:[(0,j.jsxs)("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4",children:[(0,j.jsxs)("div",{className:"flex-1",children:[(0,j.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-2",children:[(0,j.jsx)("h3",{className:`text-lg font-semibold ${s.textPrimary}`,children:e.title}),(0,j.jsx)("span",{className:`px-3 py-1 rounded-full text-xs font-medium border ${r=e.status,{pending:t?"bg-yellow-900/30 text-yellow-200 border-yellow-700/40":"bg-yellow-100 text-yellow-800 border-yellow-200",generating:t?"bg-blue-900/30 text-blue-200 border-blue-700/40":"bg-blue-100 text-blue-800 border-blue-200",generated:t?"bg-green-900/30 text-green-200 border-green-700/40":"bg-green-100 text-green-800 border-green-200",failed:t?"bg-red-900/30 text-red-200 border-red-700/40":"bg-red-100 text-red-800 border-red-200"}[r]||(t?"bg-gray-800/50 text-gray-200 border-gray-700/40":"bg-gray-100 text-gray-800 border-gray-200")}`,children:(0,j.jsxs)("span",{className:"flex items-center gap-1",children:[T(e.status),e.status.charAt(0).toUpperCase()+e.status.slice(1)]})})]}),(0,j.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-4",children:[(0,j.jsxs)("div",{className:`flex items-center gap-2 text-sm ${s.textMuted}`,children:[(0,j.jsx)(n.A,{className:"h-4 w-4"}),(0,j.jsx)("span",{className:"font-medium",children:"Topic:"})," ",e.topic]}),(0,j.jsxs)("div",{className:`flex items-center gap-2 text-sm ${s.textMuted}`,children:[(0,j.jsx)(o.A,{className:"h-4 w-4"}),(0,j.jsx)("span",{className:"font-medium",children:"Date:"})," ",new Date(e.scheduledDateTime).toLocaleDateString()]}),(0,j.jsxs)("div",{className:`flex items-center gap-2 text-sm ${s.textMuted}`,children:[(0,j.jsx)(a.A,{className:"h-4 w-4"}),(0,j.jsx)("span",{className:"font-medium",children:"Time:"})," ",new Date(e.scheduledDateTime).toLocaleTimeString()]}),(0,j.jsxs)("div",{className:`flex items-center gap-2 text-sm ${s.textMuted}`,children:[(0,j.jsx)(c.A,{className:"h-4 w-4"}),(0,j.jsx)("span",{className:"font-medium",children:"In:"})," ",_(e.scheduledDateTime)]})]}),(0,j.jsxs)("div",{className:`flex flex-wrap items-center gap-6 text-sm ${s.textMuted} mb-4`,children:[(0,j.jsxs)("span",{children:[(0,j.jsx)("strong",{children:"Questions:"})," ",`${e.mcqCount} MCQ, ${e.codingCount} Coding`]}),(0,j.jsxs)("span",{children:[(0,j.jsx)("strong",{children:"Difficulty:"})," ",e.difficulty]}),(0,j.jsxs)("span",{children:[(0,j.jsx)("strong",{children:"Duration:"})," ",e.timeLimit," minutes"]}),e.languages&&e.languages.length>0&&(0,j.jsxs)("span",{children:[(0,j.jsx)("strong",{children:"Languages:"}
1)," ",e.languages.join(", ")]})]}),e.description&&(0,j.jsx)("p",{className:`text-sm ${s.textMuted} mb-4`,children:e.description}),e.recurring&&(0,j.jsxs)("div",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs border "+(t?"bg-blue-900/30 text-blue-200 border-blue-700/40":"bg-blue-50 text-blue-700 border-blue-200"),children:["\ud83d\udd04 Recurring ",e.recurringType]})]}),(0,j.jsxs)("div",{className:"flex flex-row lg:flex-col gap-2",children:["generated"===e.status&&e.generatedTestId&&(0,j.jsxs)("button",{onClick:()=>window.open(`/vendor/tests/${e.generatedTestId}`,"_blank"),className:"px-4 py-2 rounded-lg text-sm flex items-center gap-2 transition-colors "+(t?"bg-emerald-600 hover:bg-emerald-500 text-white":"bg-green-600 hover:bg-green-700 text-white"),children:[(0,j.jsx)(x.A,{className:"h-4 w-4"}),"View Test"]}),(0,j.jsxs)("button",{onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this scheduled test?"))try{const t=await g.Kp.deleteScheduledTest(e);null!==t&&void 0!==t&&t.success&&(l.oR.success("Scheduled test deleted successfully!"),C({silent:!0}))}catch(t){console.error("Error deleting scheduled test:",t),l.oR.error("Failed to delete scheduled test")}})(e._id),className:`px-4 py-2 rounded-lg text-sm flex items-center gap-2 transition-colors ${s.btnDanger}`,children:[(0,j.jsx)(u.A,{className:"h-4 w-4"}),"Delete"]})]})]}),"failed"===e.status&&e.errorMessage&&(0,j.jsxs)("div",{className:"mt-4 p-3 rounded-lg border "+(t?"bg-red-900/30 border-red-700/40":"bg-red-50 border-red-200"),children:[(0,j.jsxs)("div",{className:"flex items-center gap-2 "+(t?"text-red-200":"text-red-700"),children:[(0,j.jsx)(i.A,{className:"h-4 w-4"}),(0,j.jsx)("span",{className:"font-medium",children:"Generation Failed"})]}),(0,j.jsx)("p",{className:"text-sm mt-1 "+(t?"text-red-200/80":"text-red-600"),children:e.errorMessage})]}),("pending"===e.status||"generating"===e.status)&&(0,j.jsxs)("div",{className:"mt-4 p-3 rounded-lg border "+(t?"bg-blue-900/30 border-blue-700/40":"bg-blue-50 border-blue-200"),children:[(0,j.jsxs)("div",{className:"flex items-center gap-2 "+(t?"text-blue-200":"text-blue-700"),children:[(0,j.jsx)(n.A,{className:"h-4 w-4 animate-pulse"}),(0,j.jsx)("span",{className:"font-medium",children:"AI is generating your test\u2026"})]}),(0,j.jsx)("p",{className:"text-sm mt-1 "+(t?"text-blue-200/80":"text-blue-600"),children:"Auto-refresh is enabled while generation is in progress."})]})]},e._id);var r})),0===I.length&&(0,j.jsx)("div",{className:`${s.bgCard} border ${s.borderSecondary} rounded-2xl p-10 text-center`,children:(0,j.jsx)("div",{className:`text-sm ${s.textMuted}`,children:"No scheduled tests match this filter."})})]})]})})}}}]);
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.