PageSourceSearch

https://nircle.com/assets/LearningDetailView-D4OGyKai.js

js nircle.com collected 2026-10-02 22:14:30 UTC 13,044 bytes, 1 lines download raw bytes

1import{e as ie,r as m,c as j,f as de,w as ue,S as ce,p as W,i as X,b as o,a as s,h as p,n as w,v as _,j as ge,k as g,s as ye,t as c,F as A,l as M,C as fe,o as t}from"./vendor-D3ahWMFY.js";import{u as ve,L as Z,K as ee,h as me,a as V}from"./index-YqUjisW-.js";import{M as xe}from"./MainLayout-IssbuzrT.js";import{r as pe}from"./ArrowLeftIcon-u3u3gHvg.js";const _e={class:"w-full px-4 sm:px-6 lg:px-8 pb-24 -mt-4"},he={key:0,class:"flex items-center justify-center py-20"},be={key:1,class:"text-center py-20"},ke={key:2},we={class:"flex flex-col lg:flex-row gap-6 mb-8"},Ce={class:"lg:w-1/3 flex-shrink-0"},Ee={class:"aspect-video lg:aspect-[4/3] rounded-2xl overflow-hidden bg-gray-100 dark:bg-gray-700"},Le=["src"],Se={key:1,class:"w-full h-full flex items-center justify-center"},Be={class:"flex-1"},Ae={class:"text-2xl font-bold text-gray-900 dark:text-white mb-2"},Me=["innerHTML"],Ne={key:1,class:"mb-4"},Te={class:"text-sm text-gray-500 dark:text-gray-400"},je={class:"font-medium text-gray-700 dark:text-gray-300"},$e={class:"flex items-center gap-4 mb-4"},Fe={key:0,class:"text-sm text-[#026B63] font-medium"},Ie={key:1,class:"text-sm text-gray-400"},He={class:"mb-4"},Pe={key:0,class:"text-xl font-bold text-[#026B63]"},Ve={key:1,class:"text-xl font-bold text-[#026B63]"},Ue={key:0,class:"flex items-center gap-2"},qe={key:1,disabled:"",class:"px-8 py-3 rounded-full font-semibold bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed"},Ye=["disabled"],Ke={key:0,class:"flex items-center gap-2"},ze={key:1},Ge={key:0,class:"mb-8"},Re={key:0,class:"text-lg font-semibold text-gray-900 dark:text-white mb-2"},De=["innerHTML"],Je={key:1,class:"mb-8"},Oe={class:"text-lg font-bold text-gray-900 dark:text-white mb-4"},Qe={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"},We={class:"w-20 h-20 rounded-full overflow-hidden bg-gray-100 dark:bg-gray-700 mb-3 flex-shrink-0"},Xe=["src","alt"],Ze={key:1,class:"w-full h-full flex items-center justify-center"},et={class:"font-semibold text-gray-900 dark:text-white"},tt={key:0,class:"text-sm text-gray-500 dark:text-gray-400 mt-1"},st={key:2,class:"mb-8"},rt={class:"space-y-3"},ot={class:"w-8 h-8 rounded-full bg-[#026B63] bg-opacity-10 flex items-center justify-center flex-shrink-0"},lt={class:"text-sm font-bold text-[#026B63]"},at={class:"flex-1 min-w-0"},nt={class:"font-medium text-gray-900 dark:text-white truncate"},it=["innerHTML"],dt={key:3,class:"mb-8"},ut={class:"grid grid-cols-1 sm:grid-cols-2 gap-4"},ct={class:"text-sm text-gray-600 dark:text-gray-400 italic mb-2"},gt={key:0,class:"text-xs font-medium text-gray-900 dark:text-white"},yt={key:4,class:"mb-8"},ft={class:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3"},vt=["src"],mt={key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4"},xt={class:"relative bg-white dark:bg-gray-800 rounded-2xl shadow-xl max-w-md w-full p-6"},pt={class:"font-semibold text-gray-900 dark:text-white mb-3"},_t={key:0,class:"text-sm text-gray-500 dark:text-gray-400 mb-4"},ht={class:"font-bold text-[#026B63]"},bt={key:1,class:"text-sm text-gray-500 dark:text-gray-400 mb-4"},kt={class:"flex gap-3 justify-end"},wt=["disabled"],Ct={key:0,class:"flex items-center gap-2"},Et={key:1},Mt=ie({__name:"LearningDetailView",props:{courseCode:{}},setup(te){const x=te,se=ye(),N=ve(),U=m(),$=m(!0),a=m(null),h=m(!1),T=m(!1),C=m(!0),b=m(!1),re=m([]);function F(){var l;N.isAuthenticated||(l=U.value)==null||l.openSignIn()}const i=j(()=>{var l,e;return((e=(l=a.value)==null?void 0:l.course)==null?void 0:e[0])||null}),q=j(()=>{var l,e,d,n,u,y;return(e=(l=a.value)==null?void 0:l.images)!=null&&e.length?a.value.images[0].image_url||a.value.images[0].img_url||null:(d=i.value)!=null&&d.profile_photo?i.value.profile_photo:(n=i.value)!=null&&n.image_url?i.value.image_url:(u=a.value)!=null&&u.image_url?a.value.image_url:(y=a.value)!=null&&y.profile_photo?a.value.profile_photo:null}),I=j(()=>{var l,e;return((e=(l=i.value)==null?void 0:l.modules)==null?void 0:e.length)||0}),Y=j(()=>{var l;return Number((l=i.value)==null?void 0:l.enrollment_snapshot)||0});function oe(l){return l>=1e6?(l/1e6).toFixed(1).replace(/\.0$/,"")+"M":l>=1e3?(l/1e3).toFixed(1).replace(/\.0$/,"")+"K":l.toString()}function H(l){const e=l.target;e.style.display="none"}async function K(){var e;$.value=!0;const l=await V.getProducts({product_code:x.courseCode,is_course:!0});if(l.success){const d=l.data,n=((e=d==null?void 0:d.results)==null?void 0:e[0])||(d==null?void 0:d[0])||d,u=(n==null?void 0:n.payload)||[];Array.isArray(u)&&u.length>0?a.value=u[0]:(n==null?void 0:n.status)==="SUCCESS"&&Array.isArray(n.payload)&&(a.value=n.payload[0]||null)}$.value=!1}async function P(){var e,d,n;if(!N.isAuthenticated){C.value=!1;return}C.value=!0;const l=await V.getMyEnrollments();if(l.success){const u=l.data,y=((e=u==null?void 0:u.results)==null?void 0:e[0])||(u==null?void 0:u[0])||u,k=(y==null?void 0:y.payload)||(u==null?void 0:u.payload)||[];if(Array.isArray(k)){re.value=k;const E=(n=(d=i.value)==null?void 0:d.id)==null?void 0:n.toString();T.value=k.some(v=>{var L,S,B;if(E&&((L=v.course_id)==null?void 0:L.toString())===E||v.unique_code===x.c
1ourseCode||v.product_code===x.courseCode)return!0;const f=((S=v.course_data)==null?void 0:S[0])||((B=v.course)==null?void 0:B[0]);return(f==null?void 0:f.unique_code)===x.courseCode||(f==null?void 0:f.product_unique_code)===x.courseCode})}}C.value=!1}function le(){if(!N.isAuthenticated){F();return}b.value=!0}async function ae(){var e;h.value=!0;const l=await V.enrollInCourse(x.courseCode);if(l.success){const d=l.data,n=((e=d==null?void 0:d.results)==null?void 0:e[0])||(d==null?void 0:d[0])||d;(n==null?void 0:n.status)==="SUCCESS"?(T.value=!0,b.value=!1):alert((n==null?void 0:n.message)||"Enrollment failed. Please try again.")}else alert(l.error||"Something went wrong. Please try again.");h.value=!1,b.value=!1}return de(async()=>{F(),await K(),await P()}),ue(()=>x.courseCode,async()=>{a.value=null,T.value=!1,C.value=!0,await K(),await P(),window.scrollTo(0,0)}),ce(async()=>{F(),window.scrollTo(0,0),await P()}),(l,e)=>{const d=ge("router-link");return t(),W(xe,{ref_key:"mainLayout",ref:U,"show-category-tabs":!1,"show-floating-actions":!1,"force-login":!w(N).isAuthenticated},{default:X(()=>{var n,u,y,k,E,v,f,L,S,B,z,G,R,D,J,O,Q;return[o("div",_e,[$.value?(t(),s("div",he,[p(Z,{width:80,height:80,"container-class":"mx-auto"})])):a.value?(t(),s("div",ke,[o("button",{onClick:e[0]||(e[0]=r=>w(se).push("/learning")),class:"flex items-center text-sm text-gray-500 dark:text-gray-400 hover:text-[#026B63] mb-4 transition-colors"},[p(w(pe),{class:"w-4 h-4 mr-1"}),e[5]||(e[5]=_(" Back to Learning ",-1))]),o("div",we,[o("div",Ce,[o("div",Ee,[q.value?(t(),s("img",{key:0,src:q.value,class:"w-full h-full object-cover",alt:"",onError:H},null,40,Le)):(t(),s("div",Se,[p(w(ee),{class:"w-16 h-16 text-gray-400"})]))])]),o("div",Be,[o("h1",Ae,c(((n=i.value)==null?void 0:n.title)||a.value.title||"Untitled Course"),1),(u=i.value)!=null&&u.description||a.value.description?(t(),s("div",{key:0,class:"text-gray-600 dark:text-gray-400 mb-4 prose prose-sm dark:prose-invert max-w-none",innerHTML:((y=i.value)==null?void 0:y.description)||a.value.description},null,8,Me)):g("",!0),(E=(k=i.value)==null?void 0:k.instructors)!=null&&E.length?(t(),s("div",Ne,[o("p",Te,[o("span",je,"Instru
1ctor"+c(i.value.instructors.length>1?"s":"")+":",1),_(" "+c(i.value.instructors.map(r=>r.name||r.title).join(", ")),1)])])):g("",!0),o("div",$e,[I.value>0?(t(),s("span",Fe,c(I.value)+" module"+c(I.value!==1?"s":""),1)):g("",!0),Y.value?(t(),s("span",Ie,c(oe(Y.value))+" enrolled ",1)):g("",!0)]),o("div",He,[a.value.price&&Number(a.value.price)>0?(t(),s("span",Pe,c(a.value.currency||"$")+c(Number(a.value.price).toFixed(2)),1)):(t(),s("span",Ve,"Free"))]),o("div",null,[C.value?(t(),s("div",Ue,[p(Z,{width:40,height:40})])):T.value?(t(),s("button",qe," Enrolled ")):(t(),s("button",{key:2,disabled:h.value,class:"px-8 py-3 rounded-full font-semibold bg-[#026B63] text-white hover:bg-[#025A54] transition-all disabled:opacity-60 disabled:cursor-not-allowed",onClick:le},[h.value?(t(),s("span",Ke,[...e[6]||(e[6]=[o("div",{class:"w-4 h-4 border-2 border-white border-r-transparent rounded-full animate-spin"},null,-1),_(" Processing... ",-1)])])):(t(),s("span",ze,c(a.value.price&&Number(a.value.price)>0?"Enroll Now":"Enroll for Free"),1))],8,Ye))])])]),(f=(v=i.value)==null?void 0:v.marketing_copy_sections)!=null&&f.length?(t(),s("div",Ge,[(t(!0),s(A,null,M(i.value.marketing_copy_sections,r=>(t(),s("div",{key:r.id,class:"mb-4 bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 p-6"},[r.title?(t(),s("h3",Re,c(r.title),1)):g("",!0),r.description||r.content?(t(),s("div",{key:1,class:"text-gray-600 dark:text-gray-400 text-sm prose prose-sm dark:prose-invert max-w-none",innerHTML:r.description||r.content},null,8,De)):g("",!0)]))),128))])):g("",!0),(S=(L=i.value)==null?void 0:L.instructors)!=null&&S.length?(t(),s("div",Je,[o("h2",Oe," Instructor"+c(i.value.instructors.length>1?"s":""),1),o("div",Qe,[(t(!0),s(A,null,M(i.value.instructors,r=>(t(),s("div",{key:r.id,class:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 p-5 flex flex-col items-center text-center"},[o("div",We,[r.profile_image_url?(t(),s("img",{key:0,src:r.profile_image_url,alt:r.name,class:"w-full h-full object-cover",onError:H},null,40,Xe)):(t(),s("div",Ze,[p(w(me),{class:"w-10 h-10 text-gray-400"}
1)]))]),o("p",et,c(r.name||r.title),1),r.short_bio?(t(),s("p",tt,c(r.short_bio),1)):g("",!0)]))),128))])])):g("",!0),(z=(B=i.value)==null?void 0:B.modules)!=null&&z.length?(t(),s("div",st,[e[7]||(e[7]=o("h2",{class:"text-lg font-bold text-gray-900 dark:text-white mb-4"},"Modules",-1)),o("div",rt,[(t(!0),s(A,null,M(i.value.modules,(r,ne)=>(t(),s("div",{key:r.id,class:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-4 flex items-center gap-4"},[o("div",ot,[o("span",lt,c(ne+1),1)]),o("div",at,[o("p",nt,c(r.title||"Untitled Module"),1),r.description?(t(),s("div",{key:0,class:"text-xs text-gray-400 mt-1 line-clamp-2 prose prose-xs dark:prose-invert max-w-none",innerHTML:r.description},null,8,it)):g("",!0)])]))),128))])])):g("",!0),(R=(G=i.value)==null?void 0:G.testimonials)!=null&&R.length?(t(),s("div",dt,[e[8]||(e[8]=o("h2",{class:"text-lg font-bold text-gray-900 dark:text-white mb-4"},"Testimonials",-1)),o("div",ut,[(t(!0),s(A,null,M(i.value.testimonials,r=>(t(),s("div",{key:r.id,class:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-4"},[o("p",ct,' "'+c(r.content||r.description||r.comment)+'" ',1),r.name||r.author?(t(),s("p",gt," — "+c(r.name||r.author),1)):g("",!0)]))),128))])])):g("",!0),((D=a.value.images)==null?void 0:D.length)>1?(t(),s("div",yt,[e[9]||(e[9]=o("h2",{class:"text-lg font-bold text-gray-900 dark:text-white mb-4"},"Gallery",-1)),o("div",ft,[(t(!0),s(A,null,M(a.value.images,r=>(t(),s("div",{key:r.id,class:"aspect-video rounded-xl overflow-hidden bg-gray-100 dark:bg-gray-700"},[o("img",{src:r.image_url||r.img_url,class:"w-full h-full object-cover",alt:"",onError:H},null,40,vt)]))),128))])])):g("",!0)])):(t(),s("div",be,[p(w(ee),{class:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-3"}),e[4]||(e[4]=o("p",{class:"text-gray-500 dark:text-gray-400 font-medium"},"Learning not found",-1)),p(d,{to:"/learning",class:"text-[#026B63] text-sm mt-2 inline-block hover:underline"},{default:X(()=>[...e[3]||(e[3]=[_(" Back to Learning ",-1)])]),_:1})]))]),(t(),W(fe,{to:"body"},[b.value?(t(),s("div",mt,[o("div",{class:"absolute inset-0 bg-black bg-opacity-50",onClick:e[1]||(e[1]=r=>b.value=!1)}),o("div",xt,[e[13]||(e[13]=o("h3",{class:"text-lg font-bold text-gray-900 dark:text-white mb-2"},"Confirm Enrollment",-1)),e[14]||(e[14]=o("p",{class:"text-gray-600 dark:text-gray-400 mb-1"}," You are about to enroll in: ",-1)),o("p",pt,' "'+c(((J=i.value)==null?void 0:J.title)||((O=a.value)==null?void 0:O.title))+'" ',1),(Q=a.value)!=null&&Q.price&&Number(a.value.price)>0?(t(),s("p",_t,[e[10]||(e[10]=_(" Your wallet will be charged ",-1)),o("span",ht,c(a.value.currency||"$")+c(Number(a.value.price).toFixed(2)),1),e[11]||(e[11]=_(" for this course. ",-1))])):(t(),s("p",bt," This course is free to enroll. ")),o("div",kt,[o("button",{class:"px-5 py-2.5 rounded-full font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:e[2]||(e[2]=r=>b.value=!1)}," Cancel "),o("button",{disabled:h.value,class:"px-5 py-2.5 rounded-full font-semibold bg-[#026B63] text-white hover:bg-[#025A54] transition-colors disabled:opacity-60 disabled:cursor-not-allowed",onClick:ae},[h.value?(t(),s("span",Ct,[...e[12]||(e[12]=[o("div",{class:"w-4 h-4 border-2 border-white border-r-transparent rounded-full animate-spin"},null,-1),_(" Processing... ",-1)])])):(t(),s("span",Et,"Yes, Enroll"))],8,wt)])])])):g("",!0)]))]}),_:1},8,["force-login"])}}});export{Mt 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.