1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2246],{31810:function(e,t,s){Promise.resolve().then(s.bind(s,35919))},35919:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return h}});var l=s(57437),n=s(58357),r=s(2265);let a=n.CT;var i=e=>{let{userId:t,trainingId:s,random:n,workshopId:i,onClose:o}=e,[c,d]=(0,r.useState)("instructions"),[u,h]=(0,r.useState)([]),[m,x]=(0,r.useState)({}),[b,f]=(0,r.useState)(0),[g,p]=(0,r.useState)(1800),[j,v]=(0,r.useState)(!1),[y,w]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"round1"===c&&0===u.length&&N()},[c,s]),(0,r.useEffect)(()=>{let e;return"round1"===c&&g>0&&(e=setInterval(()=>{p(e=>e<=1?(S(),0):e-1)},1e3)),()=>{e&&clearInterval(e)}},[c,g]);let N=async()=>{v(!0);try{console.log("Fetching questions for trainingId:",s);let e=await fetch("".concat(a,"/questions/training/").concat(s));if(!e.ok)throw Error("Failed to fetch questions");let t=await e.json();if(console.log("Questions response:",t),t.mcq&&t.mcq.length>0){let e=Array.isArray(t.mcq[0])?t.mcq[0]:t.mcq;console.log("Setting questions directly:",e),h(e)}else throw Error("No MCQ questions found")}catch(e){console.error("Error fetching questions:",e),alert("Failed to load questions: "+e.message)}finally{v(!1)}},k=(e,t)=>{x(s=>({...s,[e]:t}))},S=async()=>{if(!y){w(!0);try{let e=localStorage.getItem("user"),l=e?JSON.parse(e):null,n=null==l?void 0:l.email;if(!n)throw Error("User email not found");let r=u.map(e=>({id:e.id,answer:m[e.id]||""})),i={trainingId:s,userId:t,email:n,round1Responses:r,round2Responses:[]};console.log("Submitting payload:",i);let o=await fetch("".concat(a,"/assesmentResult/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let e=await o.json().catch(()=>({}));throw Error(e.message||"Failed to submit evaluation")}console.log("Evaluation submitted successfully"),d("submitted")}catch(e){console.error("Submit error:",e),alert("Failed to submit evaluation: "+e.message)}finally{w(!1)}}};if("instructions"===c)return(0,l.jsx)("div",{className:"w-full max-w-2xl",children:(0,l.jsxs)("div",{className:"bg-white p-8 rounded-lg shadow-lg",children:[(0,l.jsx)("h2",{className:"text-2xl font-bold text-blue-600 mb-6",children:"Assessment Rules & Instructions"}),(0,l.jsx)("p",{className:"text-gray-700 mb-6",children:"Welcome to the Excelrs Assessment! Please read the following instructions carefully before you begin:"}),(0,l.jsxs)("div",{className:"space-y-4 text-gray-700 mb-8",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-blue-600",children:"1."})," ",(0,l.jsx)("strong",{children:"Round 1:"})," 10 MCQ questions. Each correct answer gives you 1 point."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-blue-600",children:"2."})," ",(0,l.jsx)("strong",{children:"Minimum 8 points"})," required to qualify."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-blue-600",children:"3."})," Each round is timed. Please keep track of your time and submit before the timer ends."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-blue-600",children:"4."})," Do not refresh or close the browser during the assessment."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-blue-600",children:"5."})," Use your registered email for verification before starting round 1."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-blue-600",children:"6."})," Any suspicious activity may lead to disqualification."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-blue-600",children:"7."})," Results and feedback will be shown after completion."]})]}),(0,l.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:(0,l.jsxs)("p",{className:"text-blue-800 text-sm",children:[(0,l.jsx)("strong",{children:"Tip:"})," Stay calm, read each question carefully, and manage your time wisely. Good luck!"]})}),(0,l.jsx)("button",{onClick:()=>d("round1"),className:"w-full bg-green-600 text-white py-3 rounded-lg font-semibold hover:bg-green-700 transition-colors",children:"Start Round 1"})]})});if("submitted"===c)return(0,l.jsx)("div",{className:"w-full max-w-2xl text-center",children:(0,l.jsxs)("div",{className:"bg-white p-8 rounded-lg shadow-lg",children:[(0,l.jsx)("div",{className:"text-green-600 text-6xl mb-4",children:"â"}),(0,l.jsx)("h2",{className:"text-2xl font-bold text-gray-800 mb
1-4",children:"Assessment Completed!"}),(0,l.jsx)("p",{className:"text-gray-600 mb-6",children:"Thank you for completing the workshop evaluation. Your responses have been submitted successfully."}),(0,l.jsx)("button",{onClick:()=>window.location.href="/my-workshops/".concat(i),className:"bg-blue-600 text-white px-6 py-3 rounded-lg hover:bg-blue-700 font-semibold",children:"Back to Workshop"})]})});if(j)return(0,l.jsxs)("div",{className:"w-full max-w-2xl text-center",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),(0,l.jsx)("p",{children:"Loading questions..."})]});if(0===u.length)return(0,l.jsxs)("div",{className:"w-full max-w-2xl text-center",children:[(0,l.jsxs)("p",{className:"text-xl text-gray-600 mb-4",children:["No questions found for training ID: ",s]}),(0,l.jsx)("button",{onClick:()=>window.history.back(),className:"bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700",children:"Go Back"})]});let E=u[b],C=(b+1)/u.length*100;return(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,l.jsx)("h1",{className:"text-2xl font-bold text-gray-800",children:"Workshop Evaluation"}),(0,l.jsxs)("div",{className:"text-xl font-bold text-red-600",children:["Time: ","".concat(Math.floor(g/60).toString().padStart(2,"0"),":").concat((g%60).toString().padStart(2,"0"))]})]}),(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex justify-between text-sm text-gray-600 mb-2",children:[(0,l.jsxs)("span",{children:["Question ",b+1," of ",u.length]}),(0,l.jsxs)("span",{children:[Math.round(C),"% Complete"]})]}),(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,l.jsx)("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:"".concat(C,"%")}})})]}),(0,l.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 mb-6",children:[(0,l.jsxs)("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:["Q",b+1,". ",E.text," "]}),(0,l.jsx)("div",{className:"space-y-3",children:E.options.map((e,t)=>(0,l.jsxs)("label",{className:"flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer",children:[(0,l.jsx)("input",{type:"radio",name:"question-".concat(E.id),value:e,checked:m[E.id]===e,onChange:()=>k(E.id,e),className:"mr-3 text-blue-600 focus:ring-blue-500"}),(0,l.jsx)("span",{className:"text-gray-700",children:e})]},t))})]}),(0,l.jsxs)("div",{className:"flex justify-between items-center",children:[(0,l.jsx)("button",{onClick:()=>f(e=>Math.max(0,e-1)),disabled:0===b,className:"px-6 py-2 bg-gray-300 text-gray-700 rounded-lg hover:bg-gray-400 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,l.jsx)("div",{className:"flex gap-2",children:u.map((e,t)=>(0,l.jsx)("button",{onClick:()=>f(t),className:"w-8 h-8 rounded text-sm font-semibold ".concat(t===b?"bg-blue-600 text-white":m[u[t].id]?"bg-green-500 text-white":"bg-gray-200 text-gray-600 hover:bg-gray-300"),children:t+1},t))}),b===u.length-1?(0,l.jsx)("button",{onClick:S,disabled:y,className:"px-6 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:opacity-50",children:y?"Submitting...":"Submit"}):(0,l.jsx)("button",{onClick:()=>f(e=>Math.min(u.length-1,e+1)),className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:"Next"})]})]})},o=s(96450);let c=n.CT,d=async e=>{try{let t=await fetch("".concat(c,"/users/").concat(e));if(!t.ok)return null;let s=await t.json();return(null==s?void 0:s.fullName)||null}catch(e){return null}},u=async e=>{try{let t=await fetch("".concat(c,"/trainings/").concat(e));if(!t.ok)return null;let s=await t.json();return(null==s?void 0:s.title)||null}catch(e){return null}};var h=e=>{let{params:t}=e,{workshopId:s}=r.use(t),{user:n}=(0,o.useAuthStore)(),[a,h]=(0,r.useState)(null),[m,x]=(0,r.useState)(null),[b,f]=(0,r.useState)(null),[g,p]=(0,r.useState)(null),[j,v]=(0,r.useState)(!0),[y,w]=(0,r.useState)(null);if((0,r.useEffect)(()=>{(async()=>{try{v(!0);let e=localStorage.getItem("user"),t=e?JSON.parse(e):null,l=(null==t?void 0:t.userId)||(null==t?void 0:t._id);if(!l)throw Error("User not found");p(l);let n=await fetch("".concat(c,"/workshopAssignments/user/").concat(l));if(!n.ok)throw Error("Failed to fetch assignments");let r=(await n.json()).find(e=>
1e.workshopId===s);if(!(null==r?void 0:r.trainingId))throw Error("Training ID not found for this workshop");f(r.trainingId)}catch(e){console.error("Error fetching training ID:",e),w(e.message||"Error fetching evaluation data")}finally{v(!1)}})()},[s]),(0,r.useEffect)(()=>{g&&(n&&n._id===g&&n.fullName?h(n.fullName):d(g).then(h)),b&&u(b).then(x)},[g,b,n]),j)return(0,l.jsx)("div",{className:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-blue-100 via-purple-100 to-pink-100",children:(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),(0,l.jsx)("p",{children:"Loading evaluation..."})]})});if(y)return(0,l.jsx)("div",{className:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-blue-100 via-purple-100 to-pink-100",children:(0,l.jsxs)("div",{className:"text-center text-red-600",children:[(0,l.jsx)("p",{className:"text-xl font-semibold mb-4",children:"Error"}),(0,l.jsx)("p",{children:y}),(0,l.jsx)("button",{onClick:()=>window.history.back(),className:"mt-4 bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700",children:"Go Back"})]})});if(!b||!g)return(0,l.jsx)("div",{className:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-blue-100 via-purple-100 to-pink-100",children:(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("p",{className:"text-xl text-gray-600",children:"Missing evaluation data"}),(0,l.jsx)("button",{onClick:()=>window.history.back(),className:"mt-4 bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700",children:"Go Back"})]})});let N=Math.random().toString(36).substring(2,12);return(0,l.jsx)("div",{className:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-blue-100 via-purple-100 to-pink-100",children:(0,l.jsxs)("div",{className:"w-full max-w-8xl h-[100vh] bg-white rounded-2xl shadow-2xl flex overflow-hidden",children:[(0,l.jsxs)("div",{className:"w-1/3 bg-gradient-to-b from-blue-600 to-purple-600 text-white flex flex-col justify-between p-8",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-3xl font-extrabold mb-4",children:"Assessment"}),(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)("div",{className:"font-semibold",children:"Training:"}),(0,l.jsx)("div",{className:"text-lg",children:m||b||"N/A"})]}),(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)("div",{className:"font-semibold",children:"User:"}),(0,l.jsx)("div",{className:"text-lg",children:a||g||"N/A"})]}),(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)("div",{className:"font-semibold",children:"Session:"}),(0,l.jsx)("div",{className:"text-lg",children:N})]})]}),(0,l.jsx)("div",{className:"text-xs text-blue-100 opacity-80 mt-8",children:"Excelrs Assessment"})]}),(0,l.jsx)("div",{className:"w-2/3 flex flex-col items-center justify-center p-10 bg-white",children:(0,l.jsx)(i,{userId:g,trainingId:b,random:N,workshopId:s})})]})})}},58357:function(e,t,s){"use strict";s.d(t,{CT:function(){return l},bz:function(){return r},nL:function(){return n}});let l=(s(20357).env.NEXT_PUBLIC_CLOUD_API_URL||"https://excelrs-cloud-new-1069037816864.asia-south1.run.app").replace(/\/+$/,""),n="https://powr-api.lawazia.tech";function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=String(e||"").replace(/^\/+/,"");return t?"".concat(n,"/").concat(t):n}},96450:function(e,t,s){"use strict";s.r(t),s.d(t,{useAuthStore:function(){return r}});var l=s(10903),n=s(89291);let r=(0,l.U)()((0,n.tJ)((e,t)=>({user:null,token:null,refreshToken:null,isHydrated:!1,setAuthData:function(t,s){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e({user:t,token:s,refreshToken:l,isHydrated:!0})},clearAuthData:()=>{let s=t();if(null!==s.user||null!==s.token||null!==s.refreshToken){e({user:null,token:null,refreshToken:null,isHydrated:!0});try{localStorage.removeItem("auth-store")}catch(e){console.warn("Failed to clear localStorage:",e)}}}}),{name:"auth-store",storage:(0,n.FL)(()=>localStorage),skipHydration:!0,onRehydrateStorage:()=>e=>{e&&(e.isHydrated=!0)}}));try{r.persist.rehydrate()}catch(e){console.warn("Failed to rehydrate auth store:",e)}}},function(e){e.O(0,[5367,2971,7023,1744],function(){return e(e.s=31810)}),_N_E=e.O()}]);
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.