1import{t as k,u as D,r as l,d as T,j as e,F as x,T as i,h as g,b as r,g as n}from"./index-QgM5GAdg.js";const $=t=>k.get("/academic/my-exam",{params:t}).then(({data:s})=>s.data.item).catch(s=>{throw s}),M="/assets/exam-header-left-DPFeVpXB.png",v="/assets/exam-header-right-DfsrQ18V.png",S="/assets/no-exam-found-DS7x1UFj.png",A=n(r)` 2 width: 90%; 3 padding: 20px; 4 align-items: center; 5`,I=n(x)` 6 background: #0d2f55; 7 color: white; 8 align-items: center; 9 justify-content: space-between; 10 width: 100%; 11 height: 120px; 12 border-radius: 16px; 13 padding: 20px; 14 gap: 20px; 15 margin-bottom: 40px; 16 overflow: hidden; 17 18 @media (max-width: 768px) { 19 flex-direction: column; 20 height: auto; 21 padding: 20px; 22 justify-content: center; 23 } 24`,C=n.img` 25 width: 152px; 26 height: 121px; 27 opacity: 1; 28 margin-bottom: -40px; 29 @media (max-width: 768px) { 30 width: 120px; 31 height: 96px; 32 } 33`,F=n.img` 34 width: 152px; 35 height: 121px; 36 opacity: 1; 37 margin-bottom: -30px; 38 @media (max-width: 768px) { 39 width: 120px; 40 height: 96px; 41 } 42`,L=n(r)` 43 text-align: center; 44 align-items: center; 45 gap: 5px; 46 flex: 1; 47`,N=n(r)` 48 padding: 40px 20px; 49 text-align: center; 50 align-items: center; 51 gap: 10px; 52 width: 90%; 53 background: #ffffff; 54 border-radius: 8px; 55 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); 56 57 @media (max-width: 768px) { 58 padding: 20px; 59 } 60`,Y=n.img` 61 width: 60px; 62 height: auto; 63 64 @media (max-width: 768px) { 65 width: 50px; 66 } 67`,R=n(r)` 68 width: 100%; 69 gap: 10px; 70 background: #ffffff; 71 border-radius: 20px; 72 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); 73 padding: 20px; 74`,B=n(i)` 75 color: #ff6f00; 76 text-align: center; 77 margin-bottom: 10px; 78`,H=n(x)` 79 align-items: center; 80 justify-content: space-between; 81 padding: 25px; 82 border-radius: 15px; 83 background: ${({index:t})=>["#dddddd","#aaaaaa"][t%2]}; 84 gap: 10px; 85 width: 95%; 86 87 @media (max-width: 768px) { 88 flex-direction: column; 89 align-items: flex-start; 90 } 91`,m=n(i)` 92 color: gray; 93 font-size: 12px; 94`,f=n(i)` 95 font-weight: bold; 96`,V=n.button` 97 background: #0d2f551a; 98 color: #11173a; 99 padding: 8px 16px; 100 border-radius: 10px; 101 text-decoration: none; 102 font-weight: bold; 103 cursor: ${({disabled:t})=>t?"not-allowed":"pointer"}; 104 border: none; 105 opacity: ${({disabled:t})=>t?.5:1}; 106 107 &:hover { 108 background: ${({disabled:t})=>t?"#0d2f551a":"linear-gradient(0deg, #0d2f55, #0d2f55), linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))"}; 109 color: ${({disabled:t})=>t?"#11173a":"#fff"}; 110 } 111`,O=()=>{var y,b;const t=D(a=>a.profile),s=`${(b=(y=t.userReference)==null?void 0:y.userId)==null?void 0:b.toLowerCase()}@onlinevarsity.com`,[u,w]=l.useState([]),[p,j]=l.useState([]);T(),l.useEffect(()=>{(async()=>{if(!s)return;const d=s;try{const o=await $({email:d});w(o.tests||[])}catch(o){console.error("Failed to fetch exams:",o)}})()},[s]),l.useEffect(()=>{j(u)},[u]);const E=a=>{const d=encodeURIComponent(t.name||"Student"),o=`/digital-learning/my-exam/exam?slug=${a.slug}&hash=${a.hash}&email=${a==null?void 0:a.email}&fullName=${d}`,c=` 112 toolbar=no, 113 location=no, 114 status=no, 115 menubar=no, 116 scrollbars=yes, 117 resizable=yes, 118 top=0, 119 left=0, 120 width=${window.screen.availWidth}, 121 height=${window.screen.availHeight} 122 `.replace(/\s+/g,"");window.open(o,"test",c)};return e.jsxs(A,{children:[e.jsx(I,{children:e.jsxs(x,{style:{gap:"10px",flex:1},children:[e.jsx(C,{src:v,alt:"Writing on laptop"}),e.jsxs(L,{children:[e.jsx(i,{type:"h4",color:"white",style:{margin:0},children:"My Exams"}),e.jsx(i,{type:"body",color:"white",children:"View your active exams and start when you're ready."})]}),e.jsx(F,{src:M,alt:"Student reading"})]})}),p.length>0?e.jsxs(R,{children:[e.jsxs(i,{type:"h3",style:{textAlign:"left"},children:["AVAILABLE EXAMS (",p.length,")"]}),e.jsx(B,{type:"body",children:"Exam Can Be Taken On Scheduled Date & Time Only !"}),p.map((a,d)=>{const o=g(a.start_time).local(),c=g(a.expiry).local(),h=g().isBetween(o,c,void 0,"[]");return console.log(h),e.jsxs(H,{index:d,children:[e.jsxs(x,{style:{gap:"10px",flex:1},children:[e.jsxs(r,{style:{gap:"5px",flex:1},children:[e.jsx(m,{type:"body",children:"Exam Topic"}),e.jsx(f,{type:"body",children:a.test_name})]}),e.jsxs(r,{style:{gap:"5px",flex:1},children:[e.jsx(m,{type:"body",children:"Start Date & Time"}),e.jsx(f,{type:"body",children:o.format("DD MMM YYYY, hh:mm A")})]}),e.jsxs(r,{style:{gap:"5px",flex:1},children:[e.jsx(m,{type:"body",children:"End Date & Time"}),e.jsx(f,{type:"body",children:c.format("DD MMM YYYY, hh:mm A")})]})]}),e.jsx(V,{disabled:!h,onClick:()=>{h&&E(a)},children:"Take Exam"})]},d)})]}):e.jsxs(N,{children:[e.jsx(Y,{src:S,alt:"No exams available"}),e.jsx(i,{type:"h3",style:{margin:0},children:"No exams available right now."}),e.jsx(i,{type:"body",children:"Please check back soon!"})]})]})};export{O 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.