1import{_ as ye,a as we,c as ke}from"./OWWYgf2Y.js";import{_ as je}from"./B-5qM8bm.js";import{x as Ce,A as q,e as ze,m as Se,c as a,b as l,a as e,k as s,N as p,w as u,j as w,d as k,F as ee,r as te,g as S,h as Oe,o as n,s as L,i as $e,n as v,t as g,z as Pe,a2 as Te,v as Be}from"./Cny-jMUR.js";import{_ as De}from"./CSHkLFmR.js";import{u as Ie,_ as Ne,a as Ee}from"./BYSF8i36.js";import{_ as Ue}from"./tJRDHKHm.js";import{_ as Ae}from"./CUxeBhNB.js";import{u as Fe}from"./YF0e3wke.js";import{u as Ve}from"./CnWiBKLW.js";import{u as We}from"./DrlOTjhu.js";import{u as qe}from"./CTtVCRI9.js";import{u as se}from"./DdRwPrpw.js";import{u as Le}from"./Cjn-UK2L.js";import{_ as Re}from"./DlAUqK2U.js";import"./CByX21Df.js";import"./BGx-vc2c.js";import"./CXDzCsr7.js";import"./COjSgi5K.js";import"./BRdsWsvc.js";import"./B5rxJs06.js";import"./n8lNb2hy.js";import"./Bm98wYY5.js";import"./CRt-pR_f.js";import"./DRbcCXkf.js";import"./DmDz5m4l.js";import"./B7NayylV.js";import"./BcOQZI7O.js";import"./Bhcf4Zif.js";import"./CIcK5AWm.js";import"./CU6Mnxa5.js";import"./Dkp9_4T-.js";import"./C9RKA-P2.js";import"./DgxW0n38.js";import"./YoF-LljS.js";import"./BesTg-G_.js";import"./CUX1A6tG.js";import"./D548Katv.js";import"./DbKi9FIK.js";import"./Deq16PoT.js";import"./CAIa7X-A.js";const Me={class:"min-h-screen bg-gray-50 dark:bg-gray-900"},Ge={class:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-2 md:py-8 flex flex-col md:flex-row gap-4"},Je={class:"md:min-w-1/4 md:sticky md:top-24 md:self-start"},Ye={class:"w-full"},He={key:0,class:"flex justify-center items-center py-12"},Ze={key:2},Ke={key:0,class:"text-center py-12 mx-auto"},Qe={class:"w-16 h-16 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mx-auto mb-4"},Xe={key:1},et={key:0},tt={class:"grid grid-cols-1 gap-2 mt-8"},st={key:0},ot={class:"flex items-center justify-between mb-6 gap-4"},lt={class:"flex flex-row gap-2 items-baseline"},nt={class:"text-2xl font-bold text-gray-900 dark:text-white"},it={key:0},at={class:"grid grid-cols-1 gap-6"},rt={class:"font-bold text-2xl"},ct={class:"font-thin italic text-neutral-500 text-xl ms-2"},dt={class:"flex flex-row items-center gap-4"},ut={key:0},mt={key:0,class:"text-2xl text-center text-primary-500 mt-4"},ft={key:1,class:"flex flex-col gap-4 mt-8"},_t={class:"flex flex-row items-center gap-4 mb-4"},gt={key:0},bt={class:"text-2xl"},ht={key:1},xt={key:0,class:"mt-4"},pt={class:"mt-8"},vt={class:"flex flex-row gap-4 items-center"},yt={class:"font-bold text-2xl"},wt={class:"flex flex-row justify-between mt-8 px-4"},kt={class:"flex flex-row justify-between mt-1"},jt={class:"text-center"},Ct={class:"flex flex-col shrink-0 border border-neutral-300 rounded-lg px-4 py-1 items-center"},zt={class:"text-xl font-bold"},St={class:"text-sm"},Ot={class:"flex-1 items-center my-auto"},$t={class:"w-full bg-gray-200 rounded-none h-6 overflow-hidden"},Pt={class:"text-center"},Tt={class:"flex flex-col shrink-0 border border-neutral-300 rounded-lg px-4 py-1 items-center"},Bt={class:"text-xl font-bold"},Dt={class:"text-sm"},It={class:"flex flex-row items-center gap-4"},Nt={key:0,class:"text-2xl font-semibold text-primary-700"},Et={key:1,class:"flex flex-col justify-center mt-8"},Ut={class:"flex flex-row items-center gap-4 mb-4"},At={key:0},Ft={class:"text-2xl"},Vt={key:1},Wt={class:"mt-8"},qt={class:"flex flex-row gap-4 items-center"},Lt={class:"mt-8 mb-20"},Rt={key:0},Mt={class:"flex flex-row gap-2 justify-between items-center mt-8"},Gt={class:"flex flex-row gap-4 items-center"},Jt={class:"flex flex-col gap-2"},Yt={class:"text-lg font-semibold"},Ht={class:"mt-8"},Zt={key:1},Kt={class:"flex flex-row gap-4 items-center mb-8"},Qt={__name:"coaching",setup(Xt){const T=S(!0),E=S(null),m=S(null),N=S(!1),R=L(()=>T.value||re.value),U=Ce();q();const{formatDate:O,isInFuture:oe}=Fe(),{profile:A,fetchProfile:le,fetchProfileById:ne}=Ve(),{quizCompletion:F,fetchSkills:ie}=We(),{fetchBusinesses:ae,businesses:V}=qe(),{coachingPlans:$,loading:re,error:M,fetchCoachingPlans:ce,fetchCoachingWeeks:de,activePlans:c,inactivePlans:ue,calculatePlanProgress:me,updateCoachingPlan:fe}=se(),{selectSlot:_e,msBooking:G}=Le(),J=L(()=>{var h,i,f,d,C,y,B;const r=((h=m.value)==null?void 0:h.full_name)||((i=m.value)==null?void 0:i.fullName);if(r)return r;const t=((f=m.value)==null?void 0:f.first_name)||((d=m.value)==null?void 0:d.firstName)||"",b=((C=m.value)==null?void 0:C.last_name)||((y=m.value)==null?void 0:y.lastName)||"",_=`${t} ${b}`.trim();return _||((B=m.value)==null?void 0:B.email)||"your coach"}),{fetchCoachingTasks:ge}=Ie(),Y=async()=>{var r;T.value=!0,E.value=null,setTimeout(()=>{T.value&&(T.value=!1,E.value="Request timed out. Please try again.")},15e3);try{const t=h=>new Promise((i,f)=>setTimeout(()=>f(new Error("Request timed out")),h));await Promise.race([Promise.all([ce(),de(),ge(),ae(),le(),ie()]),t(1e4)]);const b=(r=c.value)==null?void 0:r[0];console.log("activePlan : ",b);const _=b==null?void 0:b.coach;if(_){const{data:h,error:i}=await ne(_);i||(m.value=h)}}catch(t){console.error("Error loading coaching data:",t),E.value=t.message||"Failed to load coaching data"}finally{T.value=!1}},be=L(()=>{var _;const r=(_=c==null?void 0:c.value)==null?void 0:_[0];return r?r.onboarding_meeting?new Date(r.onboarding_meeting)>new Date:!0:!1}),j=S(""),W=S(!1),H=S(null),{setObjectiveForPlan:he}=se(),xe=async r=>{if(j.value.trim()){W.value=!0;
1try{await he(r.id,j.value),r.objective=j.value,j.value="",H.value=null}catch(t){console.error("Failed to set objective:",t)}finally{W.value=!1}}};async function pe(r){var b,_,h,i,f,d;const t=(b=c.value)==null?void 0:b[0];if(t)try{await _e(r,{coachEmail:(_=m.value)==null?void 0:_.email,clientEmail:((h=A.value)==null?void 0:h.email)||((i=U.value)==null?void 0:i.email),subject:"Revby Onboarding Call",location:((f=m.value)==null?void 0:f.meeting_link)||"Zoom",meetingLink:((d=m.value)==null?void 0:d.meeting_link)||null});const C=G.value.lastEvent,y=A.value.meeting_link||null;t.onboarding_meeting=r.startISO,y&&(t.onboarding_meeting_url=y),await fe(t.id,{onboarding_meeting:r.startISO,onboarding_meeting_url:y||null}),q().add({title:"Onboarding call scheduled!",color:"success"})}catch(C){console.error("Booking failed:",C),q().add({title:"Failed to schedule call",color:"error"})}}return ze(()=>{U.value&&Y()}),Se(U,r=>{r&&Y()}),(r,t)=>{var Z,K,Q;const b=ye,_=we,h=je,i=$e,f=Oe,d=De,C=Ne,y=Ue,B=Ee,z=Ae,ve=Be;return n(),a("div",Me,[l(b,{profile:s(A)},null,8,["profile"]),e("div",Ge,[e("div",Je,[l(_)]),e("div",Ye,[s(R)?(n(),a("div",He,[...t[2]||(t[2]=[e("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary-500"},null,-1)])])):s(M)?(n(),p(h,{key:1,icon:"i-heroicons-exclamation-triangle",color:"error",variant:"soft",title:s(M),class:"mb-6"},null,8,["title"])):(n(),a("div",Ze,[e("div",null,[!s(R)&&((Z=s($))==null?void 0:Z.length)===0?(n(),a("div",Ke,[e("div",Qe,[l(i,{name:"i-heroicons-building-office",class:"w-8 h-8 text-gray-400"})]),t[4]||(t[4]=e("h3",{class:"text-lg font-medium text-gray-900 dark:text-white mb-2"}," No coaching plans yet ",-1)),t[5]||(t[5]=e("p",{class:"text-gray-500 dark:text-gray-400 mb-6"}," Get started by creating your first coaching plan. ",-1)),l(f,{to:"/coaching"},{default:u(()=>[...t[3]||(t[3]=[k(" Check out our coaching plans ",-1)])]),_:1})])):(n(),a("div",Xe,[s(c)&&s(oe)((K=s(c)[0])==null?void 0:K.onboarding_meeting)?(n(),a("div",et,[l(d,{class:"mb-8 border border-secondary bg-secondary-50"},{default:u(()=>{var o,x,P,D,I,X;return[t[6]||(t[6]=e("h2",{class:"text-2xl font-bold text-secondary dark:text-white"}," Welcome to your coaching plan ",-1)),t[7]||(t[7]=e("p",{class:"mt-4"}," There are a few things we need you to do to get started with your improvement journey: ",-1)),e("div",tt,[e("div",{class:v(["rounded-full border border-neutral-300 bg-white px-5 py-3 flex flex-row justify-between gap-4 items-center",[s(F)<100?"border border-warning-500":"border border-success-600"]])},[e("span",{class:v([s(F)>=100?"text-success-600":""])},"Complete the business skills assessment",2),s(F)<100?(n(),a("div",st,[l(f,{to:"/dashboard/skills/quiz",class:"rounded-full px-4 py-2",label:"Take quiz"})])):(n(),p(i,{key:1,name:"i-lucide-check",class:"text-success-600 size-6"}))],2),e("div",{class:v(["rounded-full border border-neutral-300 bg-white px-5 py-3 flex flex-row justify-between gap-4 items-center",[s(V)[0]?"border border-success-600":"border border-warning-500"]])},[e("span",{class:v([s(V)[0]?"text-success-600":""])},"Add details about your business",2),e("div",null,[s(V)[0]?(n(),p(i,{key:0,name:"i-lucide-check",class:"text-success-600 size-6"})):(n(),p(f,{key:1,to:"/dashboard/businesses",class:"rounded-full px-4 py-2",label:"Add details"}))])],2),e("div",{class:v(["rounded-full border border-neutral-300 bg-white px-5 py-3 flex flex-row justify-between gap-4",[(o=s(c)[0])!=null&&o.onboarding_meeting?"border border-success-600":"border border-warning-500"]])},[e("span",{class:v([(x=s(c)[0])!=null&&x.onboarding_meeting?"text-success-600":""])},"Schedule your first meeting with your coach",2),(P=s(c)[0])!=null&&P.onboarding_meeting?(n(),p(i,{key:0,name:"i-lucide-check",class:"text-success-600 size-6"})):w("",!0)],2),e("div",{class:v(["rounded-full border border-neutral-300 bg-white px-5 py-3 flex flex-row justify-between gap-4 items-center",[(D=s(c)[0])!=null&&D.objective?"border border-success-600":"border border-warning-500"]])},[e("span",{class:v([(I=s(c)[0])!=null&&I.objective?"text-success-600":""])},"Agree on your coaching objective",2),e("div",null,[(X=s(c)[0])!=null&&X.objective?(n(),p(i,{key:0,name:"i-lucide-check",class:"text-success-600 size-6"})):w("",!0)])],2)])]}),_:1})])):w("",!0),e("div",ot,[e("div",lt,[e("h2",nt,[t[8]||(t[8]=k(" Your coaching plan",-1)),((Q=s($))==null?void 0:Q.length)>1?(n(),a("span",it,"s")):w("",!0)])])]),e("div",at,[(n(!0),a(ee,null,te(s(c),o=>(n(),p(d,{key:o.id},{default:u(()=>[e("h3",rt,[k(g(o.plan)+" ",1),e("span",ct,g(o.weeks)+" weeks",1)]),l(C,{start:o.start_date,end:o.end_date,plan:o},null,8,["start","end","plan"]),l(d,{class:"mt-8"},{default:u(()=>[e("div",dt,[l(i,{name:"i-lucide-target",class:"size-9"}),t[9]||(t[9]=e("h3",{class:"text-xl font-bold"},"Plan Objective",-1))]),s(H)!==o.id?(n(),a("div",ut,[o.objective?(n(),a("h3",mt,' "'+g(o.objective)+'" ',1)):(n(),a("div",ft,[l(y,{modelValue:s(j),"onUpdate:modelValue":t[0]||(t[0]=x=>Pe(j)?j.value=x:null),placeholder:"What's your overall objective(s)",autofocus:""},null,8,["modelValue"]),l(f,{color:"primary",size:"lg",onClick:x=>xe(o),loading:s(W),class:"rounded-full px-8 mx-auto"},{default:u(()=>[...t[10]||(t[10]=[k(" Set Objective ",-1)])]),_:1},8,["onClick","loading"])]))])):w("",!0)]),_:2},1024),l(d,{class:"mt-8"},{default:u(()=>{var x;return[e("div",_t,[l(i,{name:"i-lucide-phone",class:"size-9"}),t[11]||(t[11]=e("h3",{class:"text-xl font-bold"},"Onboarding call",-1))]),o!=null&&o.onboarding_meeting?(n(),a("div",gt,[e("h3",bt,g(s(O)(o==null?void 0:o.onboarding_meeting,"full")),1),l(f,{class:"rounded-full mt-8 px-8",to:o==null?void 0:o.onboarding_meeting_url,disabled:!(o!=null&&o.onboarding_meeting_url)},{default:u(()=>[...t[12]||(t[12]=[k(" Join call ",-1)])]),_:1},8,["to","disabled"])])):(n(),a("div",ht,[l(ke,{class:"mt-6","coach-email":((x=s(m))==null?void 0:x.email)||"","coach-name":s(J),instructions:`Choose a date and time for your onboarding call with ${s(J)}`,"booking-state":s(G),"confirm-title":"Confirm onboarding call details","booking-cta-label":"Book call",onSlotSelected:pe},null,8,["coach-email","coach-name","instructions","booking-state"])])),s(be)?(n(),p(d,{key:2,class:"border border-info bg-info-50 mt-4"},{default:u(()=>[e("div",{class:"flex flex-row gap-2 justify-between items-center",onClick:t[1]||(t[1]=P=>N.value=!s(N))},[t[13]||(t[13]=e("h3",{class:"text-xl font-semibold"},"About your 1-hr onboarding call",-1)),l(i,{name:"i-lucide-chevron-down",class:v(["transition-transform duration-200 size-7",{"rotate-180":s(N)}])},null,8,["class"])]),s(N)?(n(),a("div",xt,[...t[14]||(t[14]=[e("p",null,"The onboarding call is designed to take longer than your usual weekly coaching c
1all because it helps us get to know you, your business, and understand your context and how we can best help you. The call is split into two parts:",-1),e("div",{class:"mt-8"},[e("p",{class:"text-lg font-semibold"},"1. Getting to know you and your business"),e("p",null,"In order to provide you the most effective coaching, we need to understand both you and your business."),e("p",{class:"text-lg font-semibold mt-4"},"2. Agreeing on your coaching objective"),e("p",null,"You and your coach will come up with a measurable, achievable objective to guide all the activities during your coaching plan. Everything you do each week will be related to achieving this objective.")],-1),e("h3",{class:"text-xl font-semibold mb-4 mt-8"},"Tips for a successful call",-1),e("ul",{class:"list-disc ps-4"},[e("li",null,"Take the Business Skills survey before the call"),e("li",null,"Think about what areas you want to focus on"),e("li",null,"Bring an open mind and willingness to share")],-1)])])):w("",!0)]),_:1})):w("",!0)]}),_:2},1024),e("div",pt,[l(d,null,{default:u(()=>[e("div",vt,[l(i,{name:"i-lucide-calendar",class:"size-9"}),t[15]||(t[15]=e("h2",{class:"text-xl font-bold text-gray-900 dark:text-white"}," Weekly plans ",-1))]),l(B,{plan:o.id,class:"mt-8"},null,8,["plan"])]),_:2},1024)])]),_:2},1024))),128)),(n(!0),a(ee,null,te(s(ue),o=>(n(),p(d,{key:o.id},{default:u(()=>[e("h3",yt,g(o.plan),1),e("div",wt,[l(i,{name:"healthicons-exercise-running-outline",class:"size-8"}),l(i,{name:"lets-icons-flag-finish-alt",class:"size-7"})]),e("div",kt,[e("div",jt,[e("div",Ct,[e("span",zt,g(s(O)(o.start_date,{day:"numeric"})),1),e("span",St,g(s(O)(o.start_date,{month:"short"})),1)])]),e("div",Ot,[e("div",$t,[e("div",{class:"bg-primary-500 h-6 text-center text-xs font-bold leading-6 text-white",style:Te({width:(s(me)(o)||0)+"%"})},null,4)])]),e("div",Pt,[e("div",Tt,[e("span",Bt,g(s(O)(o.end_date,{day:"numeric"})),1),e("span",Dt,g(s(O)(o.end_date,{month:"short"})),1)])])]),l(d,{class:"mt-8"},{default:u(()=>[e("div",It,[l(i,{name:"i-lucide-target",class:"size-9"}),t[16]||(t[16]=e("h3",{class:"text-xl font-bold"},"Objective",-1))]),o.objective?(n(),a("h3",Nt,' "'+g(o.objective)+'" ',1)):(n(),a("div",Et,[l(z,{class:"h-6 w-3/4 mx-auto mb-2"}),l(z,{class:"h-6 w-1/2 mx-auto"}),l(f,{class:"rounded-full mt-8 mx-auto px-8"},{default:u(()=>[...t[17]||(t[17]=[k("Set objective",-1)])]),_:1})]))]),_:2},1024),l(d,{class:"mt-8"},{default:u(()=>{var x,P,D,I;return[e("div",Ut,[l(i,{name:"i-lucide-phone",class:"size-9"}),t[18]||(t[18]=e("h3",{class:"text-xl font-bold"},"Onboarding call",-1))]),(x=s($)[0])!=null&&x.onboarding_meeting?(n(),a("div",At,[e("h3",Ft,g(s(O)((P=s($)[0])==null?void 0:P.onboarding_meeting,"full")),1),l(f,{class:"rounded-full mt-8 px-8",to:(D=s($)[0])==null?void 0:D.onboarding_meeting_url,disabled:!((I=s($)[0])!=null&&I.onboarding_meetning_url)},{default:u(()=>[...t[19]||(t[19]=[k(" Join call ",-1)])]),_:1},8,["to","disabled"])])):(n(),a("div",Vt,[...t[20]||(t[20]=[e("p",{class:"italic text-neutral-500"}," Onboarding meeting not yet scheduled ",-1)])]))]}),_:1}),e("div",Wt,[l(d,null,{default:u(()=>[e("div",qt,[l(i,{name:"i-lucide-calendar",class:"size-9"}),t[21]||(t[21]=e("h2",{class:"text-xl font-bold text-gray-900 dark:text-white"}," Weekly plans ",-1))]),l(B,{plan:o.id,class:"mt-8"},null,8,["plan"])]),_:2},1024)])]),_:2},1024))),128))]),e("div",Lt,[l(d,null,{default:u(()=>{var o;return[t[23]||(t[23]=e("h3",{class:"text-2xl font-bold mb-8"},"About your coach",-1)),s(m)?(n(),a("div",Rt,[e("div",Mt,[e("div",Gt,[l(ve,{src:s(m).avatar_url,class:"rounded-full h-14 w-14"},null,8,["src"]),e("div",Jt,[e("h4",Yt,g(s(m).full_name),1)])]),s(c)[0]&&((o=s(c)[0])!=null&&o.conversation_id)?(n(),p(f,{key:0,to:`/dashboard/messages/conversations/${s(c)[0].conversation_id}`,class:"rounded-full px-4 py-2"},{default:u(()=>[...t[22]||(t[22]=[k(" Message your coach ",-1)])]),_:1},8,["to"])):w("",!0)]),e("p",Ht,g(s(m).bio),1)])):(n(),a("div",Zt,[e("div",Kt,[l(z,{class:"rounded-full h-14 w-14"}),l(z,{class:"h-6 w-1/3"})]),l(z,{class:"h-4 w-full mb-2"}),l(z,{class:"h-4 w-full mb-2"}),l(z,{class:"h-4 w-1/3"})]))]}),_:1})])]))])]))])])])}}},Vs=Re(Qt,[["__scopeId","data-v-498ee335"]]);export{Vs 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.