PageSourceSearch

https://app.healthychurchestoolkit.com/assets/PersonalLeadershipPlan-CsrJsdt9.js

js healthychurchestoolkit.com collected 2026-10-04 06:29:04 UTC 73,282 bytes, 1 lines download raw bytes

1import{r as i,b as F,j as e,B as k,m as ua,e as me,a as xa,l as ha,L as $}from"./index-uPuoBMhx.js";import{P as pa}from"./PageSkeleton-C4cCZsu0.js";import{T as ga,j as _a,m as ja,n as va,b as fa,o as Gs,a1 as ya,Y as Na,h as Ks,J as ba,K as wa,A as De,w as Sa,B as Qs,P as Xs}from"./pages.config-hgExbgEC.js";import{C as q,b as z,c as Y,a as V,d as he}from"./card-1lN1_Se8.js";import{B as _}from"./badge-CrRB5M6z.js";import{T as ts,a as as,b as oe}from"./tabs-CJ62Nd3v.js";import{c as L}from"./index-A7ElDbZk.js";import{T as Ca}from"./TaskDetailsModal-DJno0q72.js";import{T as ka}from"./TeamEditorModal-D1b7SRUr.js";import{D as it,a as ct,b as ot,c as dt,d as Ra,e as mt}from"./dialog-DXhopuNX.js";import{S as se,a as te,b as ae,c as re,d as x}from"./select-D07I9jAC.js";import{L as y}from"./label-BejpMhEw.js";import{L as Re}from"./constants-C7eot9Ct.js";import{U as Ee}from"./users-U-Rdm9PF.js";import{U as cs}from"./user-CtT-IPS_.js";import{L as ut}from"./loader-circle-CClJTEjr.js";import"./sheet-CRixps9Y.js";import{T as Ma}from"./textarea-lM6uA-MR.js";import{I as de}from"./input-BmSpt0Eh.js";import{M as Aa}from"./MeetingsTab-D3wBDdMy.js";import{A as Ta,a as Da,b as Pa,c as Fa,d as La,e as Oa,g as Ea}from"./alert-dialog-C88D3be2.js";import{C as Zs}from"./checkbox-Chkf7-xA.js";import{h as Ia,c as rs,a as ls}from"./deriveDirectReports-CTgZh3AO.js";import{T as $a,a as qa,b as et,c as st,d as Va,e as Se}from"./table-C44Ca0MX.js";import{A as Ua,a as za}from"./arrow-up-AttvlR97.js";import{S as xt}from"./square-pen-CBgOWTmU.js";import{E as Oe}from"./external-link-DCG1godj.js";import{P as Ya}from"./PageContainer-DxZiU86J.js";import{T as Ce}from"./waypoints-DB6uEXAV.js";import{P as Ba}from"./plus-nao29ywL.js";import{C as Pe}from"./circle-check-BO0sHK-q.js";import{S as ns}from"./sparkles-BMLEjkPv.js";import{A as ee}from"./arrow-right-VpgmkQjv.js";import{A as Ha}from"./index-Ck7DnIc4.js";import{m as ke}from"./proxy-kYcqYoy3.js";import{a as Wa,C as tt}from"./dropdown-menu-iCIlU9cC.js";import{F as Fe,D as Ja}from"./trending-up-DI8OWV5v.js";import{B as Ga}from"./briefcase-Bc5BNsP1.js";import{a as Ka}from"./chevron-down-BNqv1YJ1.js";import{B as Qa}from"./building-2-CH0TgYOF.js";import{h as is}from"./format-WoXbaKoi.js";import"./skeleton-DOGFCoEw.js";import"./tooltip-B-l-dOqs.js";import"./index-BaASz1SR.js";import"./index-CPcWs2mZ.js";import"./index-Wvdu2dI_.js";import"./index-BLbwat6W.js";import"./index-ovzA6VBT.js";import"./index-BIK2eHIR.js";import"./quill.snow-CfUTnqzn.js";import"./switch-BehuccBp.js";import"./circle-alert-C0QDXt7F.js";import"./crown-Dka_-Nxk.js";import"./graduation-cap-DFwKZhhE.js";import"./clock-D9btEWFO.js";import"./SupervisedGuidesRoster-DrArdAB4.js";import"./avatar-Bhxn90qL.js";import"./ChurchTag-FinbzF8x.js";import"./clipboard-list-3xEa1kOf.js";import"./journeyApi-CQ6eKrk4.js";import"./search-CqNdnPxG.js";import"./index-BmCJDWmK.js";import"./video-CYNXJfA8.js";import"./JourneyCard-6WViabqj.js";import"./info-D7uJ7LVm.js";import"./x-ChRmB3ff.js";import"./shield-check-Ds0sNnHc.js";import"./globe-CcruHzdM.js";import"./badge-check-D0W_elOA.js";import"./megaphone-CGb0rIfX.js";import"./user-plus-DYMIVDGV.js";import"./circle-check-big-DOAasZi7.js";import"./useQuery-BHFaz3Mh.js";import"./Loader-yhtKwwRu.js";import"./lock-BWkWm970.js";import"./index-Cu1sS3TT.js";import"./index-DoY6TkfM.js";import"./scroll-area-PVGhhXG6.js";import"./index-BdQq_4o_.js";import"./trash-2-CNhP3AqE.js";import"./alert-DhGFo-aW.js";import"./mic-DcRiwPfw.js";import"./square-BcO-hK2U.js";import"./MeetingFormDrawer-qH4J-SvK.js";import"./command-C4dJiwHt.js";import"./RevealMore-KEkRkQnc.js";import"./ellipsis-CzlaRWtW.js";import"./arrow-up-down-vjGAMNOZ.js";import"./link-q-TY0bPt.js";import"./mail-Dn9HRcgA.js";const Xa=["January","February","March","April","May","June","July","August","September","October","November","December"];function Za({isOpen:h,onClose:n,role:l,currentVolunteer:c,allVolunteers:N,onComplete:p}){const[v,R]=i.useState((c==null?void 0:c.id)||""),[w,t]=i.useState(!1),[d,T]=i.useState("inherit"),[B,O]=i.useState("inherit"),[H,W]=i.useState({co
1aching:"inherit",month:"inherit"});i.useEffect(()=>{if(!h||!(c!=null&&c.id)||!(l!=null&&l.id)){W({coaching:"inherit",month:"inherit"}),T("inherit"),O("inherit");return}let S=!1;return F.entities.VolunteerRoleAssignment.filter({volunteer_profile_id:c.id,org_chart_role_id:l.id,deleted_at:null}).then(G=>{if(S)return;const M=G[0]||null,K=(M==null?void 0:M.coaching_cadence_override)||"inherit",A=M!=null&&M.annual_review_month_override?String(M.annual_review_month_override):"inherit";W({coaching:K,month:A}),T(K),O(A)}).catch(()=>{}),()=>{S=!0}},[h,c==null?void 0:c.id,l==null?void 0:l.id]);const be=S=>{R(S),S===(c==null?void 0:c.id)?(T(H.coaching),O(H.month)):(T("inherit"),O("inherit"))},J=async()=>{var S,G;t(!0);try{const M=l.corporate_account_id,K={coaching_cadence_override:d==="inherit"?null:d,annual_review_month_override:B==="inherit"?null:parseInt(B,10)};if(c&&c.id!==v){const A=await F.entities.VolunteerRoleAssignment.filter({volunteer_profile_id:c.id,org_chart_role_id:l.id,deleted_at:null});for(const r of A)await F.entities.VolunteerRoleAssignment.update(r.id,{deleted_at:new Date().toISOString()})}if(v&&v!=="__NONE__"){const A=await F.entities.VolunteerRoleAssignment.filter({volunteer_profile_id:v,org_chart_role_id:l.id,deleted_at:null});if(A.length===0){const r=await F.entities.VolunteerRoleAssignment.filter({volunteer_profile_id:v,is_primary:!0,deleted_at:null});if(await F.entities.VolunteerRoleAssignment.create({volunteer_profile_id:v,org_chart_role_id:l.id,corporate_account_id:M,is_primary:r.length===0,start_date:new Date().toISOString().split("T")[0],...K}),l.sync_to_planning_center&&l.planning_center_team_position_id)try{await ua.syncRoleToPlanningCenter({corporateAccountId:M,action:"roster_person",roleId:l.id,volunteerProfileId:v})}catch(m){console.error("Failed to roster volunteer in Planning Center:",m),me.error(((G=(S=m.response)==null?void 0:S.data)==null?void 0:G.error)||"Assigned, but could not roster in Planning Center.")}}else await F.entities.VolunteerRoleAssignment.update(A[0].id,K);me.success("Volunteer assigned successfully!")}else c&&me.success("Assignment cleared successfully!");p(),n()}catch(M){console.error("Failed to update assignment:",M),me.error("Failed to update assignment")}finally{t(!1)}},pe=N;return e.jsx(it,{open:h,onOpenChange:n,children:e.jsxs(ct,{className:"max-w-md",children:[e.jsxs(ot,{children:[e.jsxs(dt,{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"w-5 h-5"}),"Assign Volunteer to Role"]}),e.jsx(Ra,{children:"Select a volunteer to assign to this role"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm",children:l.role_title}),l.summary&&e.jsx("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2",children:l.summary.replace(/<[^>]*>/g,"")})]}),e.jsx(_,{className:Re[l.leadership_level],children:l.leadership_level})]})}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"volunteer-select",children:"Assign Volunteer"}),e.jsxs(se,{value:v,onValueChange:be,children:[e.jsx(te,{id:"volunteer-select",className:"mt-1.5",children:e.jsx(ae,{placeholder:"Select a volunteer..."})}),e.jsxs(re,{children:[e.jsx(x,{value:"__NONE__",children:e.jsx("span",{className:"text-gray-500 italic",children:"No one assigned"})}),pe.map(S=>e.jsx(x,{value:S.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cs,{className:"w-3 h-3"}),S.first_name," ",S.last_name]})},S.id))]})]}),pe.length===0&&e.jsx("p",{className:"text-xs text-amber-600 mt-2",children:"All volunteers are currently assigned to roles. Create new volunteer profiles to assign to this role."})]}),v&&v!=="__NONE__"&&e.jsxs("div",{className:"space-y-3 border border-gray-200 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600",children:"Assessment Cycle override (optional)"}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"coaching-override",className:"text-xs",children:"Coaching Cadence"}),e.jsxs(se,{value:d,onValueChange:T,children:[e.jsx(te,{id:"coaching-override",className:"mt-1",children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx(x,{value:"inherit",children:"Use role's default"}),e.jsx(x,{value:"none",children:"No set cadence"}),e.jsx(x,{value:"weekly",children:"Weekly"}),e.jsx(x,{value:"monthly",children:"Monthly"}),e.jsx(x,{value:"quarterly",children:"Quarterly"})]})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"review-month-override",className:"text-xs",children:"Annual Review Month"}),e.jsxs(se,{value:B,onValueChange:O,children:[e.jsx(te,{id:"review-month-override",className:"mt-1",children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx(x,{value:"inherit",children:"Use role's default"}),e.jsx(x,{value:"none",children:"Not scheduled"}),Xa.map((S,G)=>e.jsx(x,{value:String(G+1),children:S},S))]})]})]})]}),c&&e.jsxs("div",{className:"text-xs text-gray-500 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[e.jsx("span",{className:"font-medium",children:"Currently assigned:"})," ",c.first_name," ",c.last_name]})]}),e.jsxs(mt,{children:[e.jsx(k,{variant:"outline",onClick:n,disabled:w,children:"Cancel"}),e.jsx(k,{onClick:J,disabled:w||v==="__NONE__"&&!c,className:"bg-brand-primary hover:bg-brand-primary-hover",children:w?e.jsxs(e.Fragment,{children:[e.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Assignment"})]})]})})}
1function er({isOpen:h,onClose:n,meeting:l,meetingType:c,onSave:N,user:p,volunteerProfiles:v,templates:R,preSelectedParticipant:w}){var M,K,A;const[t,d]=i.useState({meeting_type:"one_on_one",custom_type_name:"",meeting_title:"",meeting_date:"",duration_minutes:60,location:"",participants:[],template_id:null,notes:"",status:"scheduled",is_recurring:!1,recurrence_pattern:null,recurrence_interval:1,recurrence_days_of_week:[],recurrence_monthly_type:"date",recurrence_day_of_month:null,recurrence_week_of_month:null,recurrence_day_of_week:null,recurrence_month:null,recurrence_end_date:"",recurrence_end_after_count:null}),[T,B]=i.useState(!1),[O,H]=i.useState([]),[W,be]=i.useState([]),[J,pe]=i.useState([]);i.useEffect(()=>{h&&p&&(async()=>{try{const m=p.account_type==="corporate_sub"?p.corporate_account_id:p.id,D=await F.entities.MeetingType.filter({corporate_account_id:m});pe(D)}catch(m){console.error("Failed to load meeting types:",m)}})()},[h,p]),i.useEffect(()=>{(async()=>{var Q;let m,D=[];if(l)m={meeting_type:l.meeting_type||"one_on_one",custom_type_name:l.custom_type_name||"",meeting_title:l.meeting_title||"",meeting_date:l.meeting_date?l.meeting_date.slice(0,16):"",duration_minutes:l.duration_minutes||60,location:l.location||"",participants:l.participants||[],template_id:l.template_id||null,notes:l.notes||"",status:l.status||"scheduled",is_recurring:l.is_recurring||!1,recurrence_pattern:l.recurrence_pattern||null,recurrence_interval:l.recurrence_interval||1,recurrence_days_of_week:l.recurrence_days_of_week||[],recurrence_monthly_type:l.recurrence_monthly_type||"date",recurrence_day_of_month:l.recurrence_day_of_month||null,recurrence_week_of_month:l.recurrence_week_of_month||null,recurrence_day_of_week:l.recurrence_day_of_week||null,recurrence_month:l.recurrence_month||null,recurrence_end_date:l.recurrence_end_date?l.recurrence_end_date.slice(0,10):"",recurrence_end_after_count:l.recurrence_end_after_count||null},D=((Q=l.participants)==null?void 0:Q.map(U=>U.volunteer_profile_id))||[];else if(c){const U=c==="Coaching Session";m={meeting_type:U?"coaching_session":"custom",custom_type_name:U?"":c.template_name||"",meeting_title:U?"Coaching Session":c.template_name||"",meeting_date:"",duration_minutes:c.default_duration_minutes||60,location:"",participants:[],template_id:c.agenda_template_id||null,notes:"",status:"scheduled",is_recurring:!1,recurrence_pattern:null,recurrence_interval:1,recurrence_days_of_week:[],recurrence_monthly_type:"date",recurrence_day_of_month:null,recurrence_week_of_month:null,recurrence_day_of_week:null,recurrence_month:null,recurrence_end_date:"",recurrence_end_after_count:null},D=w?[w.id]:[]}else m={meeting_type:"one_on_one",custom_type_name:"",meeting_title:"",meeting_date:"",duration_minutes:60,location:"",participants:[],template_id:null,notes:"",status:"scheduled",is_recurring:!1,recurrence_pattern:null,recurrence_interval:1,recurrence_days_of_week:[],recurrence_monthly_type:"date",recurrence_day_of_month:null,recurrence_week_of_month:null,recurrence_day_of_week:null,recurrence_month:null,recurrence_end_date:"",recurrence_end_after_count:null},D=w?[w.id]:[];d(m),H(D),be(v)})()},[l,c,h,w,p,v]);const S=r=>{H(m=>m.includes(r)?m.filter(D=>D!==r):[...m,r])},G=async r=>{if(r.preventDefault(),!t.meeting_title||!t.meeting_date){me.error("Please fill in all required fields");return}B(!0);try{const m=p.account_type==="corporate_sub"?p.corporate_account_id:p.id,D=O.map(U=>{const le=v.find(Ie=>Ie.id===U);return{volunteer_profile_id:U,name:le?`${le.first_name} ${le.last_name}`:"Unknown",email:(le==null?void 0:le.email)||""}}),Q={...t,corporate_account_id:m,host_id:p.id,participants:D,agenda_template_id:t.template_id};l?(await F.entities.Meeting.update(l.id,Q),me.success("Meeting updated successfully")):(await F.entities.Meeting.create(Q),me.success("Meeting created successfully")),N()}catch(m){console.error("Failed to save meeting:",m),me.error("Failed to save meeting")}finally{B(!1)}};return e.jsx(it,{open:h,onOpenChange:n,children:e.jsxs(ct,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(ot,{children:e.jsx(dt,{children:l?"Edit Meeting":"Schedule New Meeting"})}),e.jsxs("form",{onSubmit:G,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"meeting_type",children:"Meeting Type *"}),e.jsxs(se,{value:t.meeting_type,onValueChange:r=>{const m=J.find(D=>D.id===r);d({...t,meeting_type:"custom",custom_type_name:(m==null?void 0:m.type_name)||"",template_id:(m==null?void 0:m.agenda_template_id)||null,duration_minutes:(m==null?void 0:m.default_duration_minutes)||t.duration_minutes})},children:[e.jsx(te,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[J.filter(r=>r.is_active).map(r=>
1e.jsx(x,{value:r.id,children:r.type_name},r.id)),J.length===0&&e.jsx(x,{value:"custom",children:"Custom Meeting"})]})]})]}),!J.find(r=>r.id===t.meeting_type)&&t.meeting_type==="custom"&&e.jsxs("div",{children:[e.jsx(y,{htmlFor:"custom_type_name",children:"Custom Type Name"}),e.jsx(de,{id:"custom_type_name",value:t.custom_type_name,onChange:r=>d({...t,custom_type_name:r.target.value}),placeholder:"e.g., Strategy Review"})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"meeting_title",children:"Meeting Title *"}),e.jsx(de,{id:"meeting_title",value:t.meeting_title,onChange:r=>d({...t,meeting_title:r.target.value}),placeholder:"e.g., Weekly Check-in with John",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"meeting_date",children:"Date & Time *"}),e.jsx(de,{id:"meeting_date",type:"datetime-local",value:t.meeting_date,onChange:r=>d({...t,meeting_date:r.target.value}),required:!0})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"duration",children:"Duration (minutes)"}),e.jsx(de,{id:"duration",type:"number",value:t.duration_minutes,onChange:r=>d({...t,duration_minutes:parseInt(r.target.value)||60}),min:"15",step:"15"})]})]}),e.jsxs("div",{className:"space-y-4 border rounded-lg p-4 bg-gray-50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zs,{id:"is_recurring",checked:t.is_recurring,onCheckedChange:r=>d({...t,is_recurring:r,recurrence_pattern:r?"weekly":null})}),e.jsx(y,{htmlFor:"is_recurring",className:"cursor-pointer font-medium",children:"Recurring Meeting"})]}),t.is_recurring&&e.jsxs("div",{className:"space-y-4 pl-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_pattern",children:"Repeat Pattern"}),e.jsxs(se,{value:t.recurrence_pattern||"",onValueChange:r=>d({...t,recurrence_pattern:r}),children:[e.jsx(te,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx(x,{value:"daily",children:"Daily"}),e.jsx(x,{value:"weekly",children:"Weekly"}),e.jsx(x,{value:"monthly",children:"Monthly"}),e.jsx(x,{value:"yearly",children:"Yearly"})]})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_interval",children:"Every"}),e.jsx(de,{id:"recurrence_interval",type:"number",min:"1",value:t.recurrence_interval,onChange:r=>d({...t,recurrence_interval:parseInt(r.target.value)||1})})]})]}),t.recurrence_pattern==="weekly"&&e.jsxs("div",{children:[e.jsx(y,{children:"Repeat On"}),e.jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map((r,m)=>{var D;return e.jsx(k,{type:"button",variant:(D=t.recurrence_days_of_week)!=null&&D.includes(m)?"default":"outline",size:"sm",onClick:()=>{const Q=t.recurrence_days_of_week||[];d({...t,recurrence_days_of_week:Q.includes(m)?Q.filter(U=>U!==m):[...Q,m].sort()})},children:r},r)})})]}),t.recurrence_pattern==="monthly"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(y,{children:"Monthly Recurrence Type"}),e.jsxs(se,{value:t.recurrence_monthly_type||"date",onValueChange:r=>d({...t,recurrence_monthly_type:r}),children:[e.jsx(te,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx(x,{value:"date",children:"On day of month"}),e.jsx(x,{value:"day",children:"On day of week"})]})]})]}),t.recurrence_monthly_type==="date"?e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_day_of_month",children:"Day of Month"}),e.jsx(de,{id:"recurrence_day_of_month",type:"number",min:"1",max:"31",value:t.recurrence_day_of_month||"",onChange:r=>d({...t,recurrence_day_of_month:parseInt(r.target.value)||null}),placeholder:"e.g., 15"})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_week_of_month",children:"Week"}),e.jsxs(se,{value:((M=t.recurrence_week_of_month)==null?void 0:M.toString())||"",onValueChange:r=>d({...t,recurrence_week_of_month:parseInt(r)}),children:[e.jsx(te,{children:e.jsx(ae,{placeholder:"Select..."})}),e.jsxs(re,{children:[e.jsx(x,{value:"1",children:"First"}),e.jsx(x,{value:"2",children:"Second"}),e.jsx(x,{value:"3",children:"Third"}),e.jsx(x,{value:"4",children:"Fourth"}),e.jsx(x,{value:"5",children:"Last"})]})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_day_of_week",children:"Day"}),e.jsxs(se,{value:((K=t.recurrence_day_of_week)==null?void 0:K.toString())||"",onValueChange:r=>d({...t,recurrence_day_of_week:parseInt(r)}),children:[e.jsx(te,{children:e.jsx(ae,{placeholder:"Select..."})}),e.jsxs(re,{children:[e.jsx(x,{value:"0",children:"Sunday"}),e.jsx(x,{value:"1",children:"Monday"}),e.jsx(x,{value:"2",children:"Tuesday"}),e.jsx(x,{value:"3",children:"Wednesday"}),e.jsx(x,{value:"4",children:"Thursday"}),e.jsx(x,{value:"5",children:"Friday"}),e.jsx(x,{value:"6",children:"Saturday"})]})]})]})]})]}),t.recurrence_pattern==="yearly"&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_month",children:"Month"}
1),e.jsxs(se,{value:((A=t.recurrence_month)==null?void 0:A.toString())||"",onValueChange:r=>d({...t,recurrence_month:parseInt(r)}),children:[e.jsx(te,{children:e.jsx(ae,{placeholder:"Select..."})}),e.jsx(re,{children:["January","February","March","April","May","June","July","August","September","October","November","December"].map((r,m)=>e.jsx(x,{value:(m+1).toString(),children:r},r))})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_day_of_month_yearly",children:"Day"}),e.jsx(de,{id:"recurrence_day_of_month_yearly",type:"number",min:"1",max:"31",value:t.recurrence_day_of_month||"",onChange:r=>d({...t,recurrence_day_of_month:parseInt(r.target.value)||null})})]})]}),e.jsxs("div",{children:[e.jsx(y,{children:"Ends"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-2",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_end_date",className:"text-xs",children:"On Date"}),e.jsx(de,{id:"recurrence_end_date",type:"date",value:t.recurrence_end_date,onChange:r=>d({...t,recurrence_end_date:r.target.value,recurrence_end_after_count:null})})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"recurrence_end_after_count",className:"text-xs",children:"After Occurrences"}),e.jsx(de,{id:"recurrence_end_after_count",type:"number",min:"1",value:t.recurrence_end_after_count||"",onChange:r=>d({...t,recurrence_end_after_count:parseInt(r.target.value)||null,recurrence_end_date:""}),placeholder:"e.g., 10"})]})]})]})]})]}),e.jsxs("div",{children:[e.jsx(y,{children:"Participants"}),e.jsxs("div",{className:"border rounded-lg p-4 max-h-48 overflow-y-auto space-y-2",children:[W.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zs,{id:`participant-${r.id}`,checked:O.includes(r.id),onCheckedChange:()=>S(r.id)}),e.jsxs(y,{htmlFor:`participant-${r.id}`,className:"cursor-pointer flex-1",children:[r.first_name," ",r.last_name]})]},r.id)),W.length===0&&e.jsx("p",{className:"text-sm text-gray-500",children:"No volunteer profiles available"})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"location",children:"Location / Meeting Link"}),e.jsx(de,{id:"location",value:t.location,onChange:r=>d({...t,location:r.target.value}),placeholder:"e.g., Conference Room A or https://zoom.us/..."})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"agenda_template_id",children:"Agenda Template (Optional)"}),e.jsxs(se,{value:t.template_id||"",onValueChange:r=>d({...t,template_id:r||null}),children:[e.jsx(te,{children:e.jsx(ae,{placeholder:"Select a template..."})}),e.jsxs(re,{children:[e.jsx(x,{value:null,children:"None"}),R&&R.map(r=>e.jsx(x,{value:r.id,children:r.template_name},r.id))]})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"notes",children:"Meeting Notes"}),e.jsx(Ma,{id:"notes",value:t.notes,onChange:r=>d({...t,notes:r.target.value}),placeholder:"Add agenda, discussion points, or notes...",rows:4})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"status",children:"Status"}),e.jsxs(se,{value:t.status,onValueChange:r=>d({...t,status:r}),children:[e.jsx(te,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx(x,{value:"scheduled",children:"Scheduled"}),e.jsx(x,{value:"completed",children:"Completed"}),e.jsx(x,{value:"cancelled",children:"Cancelled"})]})]})]}),e.jsxs(mt,{children:[e.jsx(k,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),e.jsxs(k,{type:"submit",disabled:T,className:"bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)]",children:[T?e.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):null,l?"Update Meeting":"Schedule Meeting"]})]})]})]})})}const sr={L1:1,L2:2,L3:3,L4:4,L5:5},tr=[{key:"role",label:"Role"},{key:"name",label:"Name"},{key:"status",label:"Status"},{key:"level",label:"Level"}],Le=(h,n)=>{const{role:l,volunteer:c}=h;return n==="role"?(l.role_title||"").toLowerCase():n==="name"?c?`${c.first_name} ${c.last_name}`.toLowerCase():"zzz":n==="status"?c?0:1:sr[l.leadership_level]||0};function ar({members:h,onEdit:n,onView:l}){const[c,N]=i.useState("level"),[p,v]=i.useState("desc"),R=i.useMemo(()=>{const t=[...h];return t.sort((d,T)=>{const B=Le(d,c),O=Le(T,c);
1return B===O?Le(d,"role")<Le(T,"role")?-1:1:(B<O?-1:1)*(p==="asc"?1:-1)}),t},[h,c,p]),w=t=>{t===c?v(p==="asc"?"desc":"asc"):(N(t),v("asc"))};return h.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Ee,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-600 font-medium",children:"No Team Members"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"No roles report to your position yet"})]}):e.jsx("div",{className:"border rounded-lg overflow-x-auto",children:e.jsxs($a,{children:[e.jsx(qa,{children:e.jsxs(et,{children:[tr.map(t=>e.jsx(st,{children:e.jsxs("button",{onClick:()=>w(t.key),className:"flex items-center gap-1 font-medium hover:text-[var(--color-accent)] transition-colors",children:[t.label,c===t.key&&(p==="asc"?e.jsx(Ua,{className:"w-3 h-3"}):e.jsx(za,{className:"w-3 h-3"}))]})},t.key)),e.jsx(st,{className:"w-24 text-right",children:"Actions"})]})}),e.jsx(Va,{children:R.map(({role:t,volunteer:d})=>e.jsxs(et,{className:d?"":"bg-gray-50/60",children:[e.jsx(Se,{className:"font-medium text-sm",children:t.role_title}),e.jsx(Se,{className:"text-sm",children:d?e.jsxs("button",{onClick:()=>l(d),className:"text-[var(--color-accent)] hover:underline",children:[d.first_name," ",d.last_name]}):e.jsx("span",{className:"text-gray-400 italic",children:"Unassigned"})}),e.jsx(Se,{children:d?e.jsx(_,{variant:"outline",className:"text-xs bg-green-50 text-green-700 border-green-200",children:"Filled"}):e.jsx(_,{variant:"outline",className:"text-xs bg-amber-50 text-amber-700 border-amber-200",children:"Open"})}),e.jsx(Se,{children:t.leadership_level&&e.jsx(_,{variant:"outline",className:`text-xs ${Re[t.leadership_level]}`,children:t.leadership_level})}),e.jsxs(Se,{className:"text-right whitespace-nowrap",children:[e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>n(t,d||null),children:e.jsx(xt,{className:"w-4 h-4"})}),d&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(d),children:e.jsx(Oe,{className:"w-4 h-4"})})]})]},t.id))})]})})}const at={weekly:7,monthly:30,quarterly:91},rt={none:"No set cadence",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly"};function rr(h,n){const l=n==null?void 0:n.coaching_cadence_override;return l||(h==null?void 0:h.coaching_cadence)||"none"}function lr(h,n){const l=n==null?void 0:n.annual_review_month_override;return l??(h==null?void 0:h.annual_review_month)??null}function lt({role:h,assignment:n,meetings:l=[],today:c=new Date}){const N=rr(h,n);if(N==="none"||!at[N])return{cadence:"none",applicable:!1};const p=(l||[]).filter(t=>t.meeting_type==="coaching_session"&&t.status==="completed"&&!t.deleted_at).sort((t,d)=>new Date(d.meeting_date)-new Date(t.meeting_date)),v=p.length>0?p[0].meeting_date:null,R=v||(n==null?void 0:n.start_date)||null;if(!R)return{cadence:N,applicable:!0,lastSessionDate:null,nextDueDate:null,status:"unknown"};const w=new Date(R);return w.setDate(w.getDate()+at[N]),{cadence:N,applicable:!0,lastSessionDate:v,nextDueDate:w.toISOString().slice(0,10),status:w<=c?"overdue":"on_track"}}function nt({role:h,assignment:n,reviews:l=[],today:c=new Date}){const N=lr(h,n);if(!N)return{month:null,applicable:!1};const p=c.getFullYear(),v=c.getMonth()+1,R=w=>(l||[]).some(t=>Number(t.review_year)===w&&!t.deleted_at);if(v<N)return{month:N,applicable:!0,cycleYear:p,status:R(p)?"completed":"upcoming"};if(R(p))return{month:N,applicable:!0,cycleYear:p,status:"completed"};if(n!=null&&n.start_date){const w=new Date(n.start_date),t=new Date(p,N-1,1);if(w>t)return{month:N,applicable:!0,cycleYear:p,status:"upcoming"}}return{month:N,applicable:!0,cycleYear:p,status:v===N?"due":"overdue"}}const nr={self:"Your Self-Assessment",supervisor:"Supervisor Review",peer:"Peer Review"};function ir(){var Ts,Ds,Ps,Fs,Ls,Os,Es,Is;const{user:h}=xa(),[n,l]=i.useState(h),[c,N]=i.useState(!0),[p,v]=i.useState(!1),[R,w]=i.useState(null),[t,d]=i.useState(null),[T,B]=i.useState([]),[O,H]=i.useState([]),[W,be]=i.useState("active"),[J,pe]=i.useState([]),[S,G]=i.useState([]),[M,K]=i.useState([]),[A,r]=i.useState(null),[m,D]=i.useState(null),[Q,U]=i.useState({}),[le,Ie]=i.useState([]),[ht,pt]=i.useState([]),[os,gt]=i.useState([]),[$e,ds]=i.useState(null),[ue,_t]=i.useState(null),[_e,ms]=i.useState(null),[jt,us]=i.useState(!1),[xs,hs]=i.useState(null),[ps,vt]=i.useState([]),[ft,gs]=i.useState(!1),[cr,or]=i.useState(!1),[qe,yt]=i.useState(!1),[_s,Ve]=i.useState(!1),[js,Ue]=i.useState(!1),[vs,ze]=i.useState(null),[Nt,Ye]=i.useState(null),[dr,mr]=i.useState(!1),[bt,fs]=i.useState(null),[ys,Ns]=i.useState(!1),[wt,bs]=i.useState(null),[St,Ct]=i.useState([]),[je,kt]=i.useState(0),[ve,Rt]=i.useState(0),[Me,Mt]=i.useState([]),[At,Tt]=i.useState([]),[ws,Dt]=i.useState("self"),[Ss,Pt]=i.useState(null),[Cs,Ft]=i.useState([]),[ne,Lt]=i.useState(null),[fe,Ot]=i.useState("overview"),[Et,Be]=i.useState(!1),[ye,It]=i.useState(null),$t=ha();i.useEffect(()=>{ge()},[h]),i.useEffect(()=>{const s=()=>{ge()};return window.addEventListener("coachingSessionDeleted",s),()=>window.removeEventListener("coachingSessionDeleted",s)},[h]);const ge=async()=>{var s;N(!0),v(!1);try{const a=h;if(!a)return;l(a);const o=a.account_type==="corporate_sub"?a.corporate_account_id:a.id,u=j=>_a(o,j);let C=await u("VolunteerProfile").filter({corporate_account_id:o,user_id:a.id,deleted_at:null});if(C.length===0&&a.email){const j=await u("VolunteerProfile").filter({corporate_account_id:o,email:a.email,deleted_at:null});j.length>0&&(await u("VolunteerProfile").update(j[0].id,{user_id:a.id}),C=[{...j[0],user_id:a.id}])}if(C.length===0){let j=null;try{const{data:P}=await F.functions.invoke("createLeaderProfileForUser",{});P!=null&&P.profile&&(j=P.profile)}catch(P){console.error("Failed to auto-create volunteer profile:",P)}if(j)C=[j];else{if(!(a.account_type!=="corporate_sub"||a.can_manage_volunteer_profiles))try{const{data:Z}=await F.functions.invoke("getReviewsOwnerContact",{});Z&&!Z.error&&Lt(Z)}catch(Z){console.error("Failed to load account owner contact:",Z)}N(!1);return}}const X=C[0];w(X);
1const[E,We]=await Promise.all([ja(o,[{key:"competencies",entityName:"CoreCompetency",query:{deleted_at:null}},{key:"projects",entityName:"StrategyProject",query:{deleted_at:null}},{key:"profiles",entityName:"VolunteerProfile",query:{deleted_at:null,is_active:!0}},{key:"roles",entityName:"OrgChartRole",query:{deleted_at:null,is_active:!0}},{key:"teams",entityName:"TeamStructure",query:{deleted_at:null,is_active:!0}},{key:"design",entityName:"AssessmentResult",query:{participant_email:a.email,deleted_at:null},sort:"-created_date"},{key:"assignments",entityName:"VolunteerRoleAssignment",query:{volunteer_profile_id:X.id,deleted_at:null}},{key:"invitations",entityName:"ReviewInvitation",query:{reviewer_user_id:a.id,deleted_at:null}},{key:"startedReviews",entityName:"Review",query:{initiated_by_user_id:a.id,status:"in_progress",deleted_at:null}},{key:"reviews",entityName:"Review",query:{deleted_at:null},sort:"-review_year"},{key:"meetings",entityName:"Meeting",query:{meeting_type:"coaching_session",deleted_at:null}}]),F.entities.AgendaTemplate.filter({$or:[{corporate_account_id:o},{corporate_account_id:null}],deleted_at:null,is_active:!0})]),Xt=E.competencies||[],Zt=E.projects||[],Je=E.profiles||[],xe=E.roles||[],Ge=E.teams||[],$s=E.design||[],Ke=E.assignments||[],qs=E.invitations||[],ea=E.startedReviews||[],sa=E.reviews||[],ta=E.meetings||[];Ct(We),kt(qs.filter(j=>j.status!=="submitted").length),Tt(qs||[]),Rt(ea.length),Mt(sa||[]),Ft(ta||[]),$s.length>0&&_t($s[0]);const aa=Zt.reduce((j,P)=>(j[P.id]=P,j),{});U(aa),Ie(Je),pt(xe),gt(Ge);const Qe=await F.functions.invoke("getCorporateAccountUsers",{corporateAccountId:o});vt(((s=Qe==null?void 0:Qe.data)==null?void 0:s.data)||[]);const Vs=va(Ke,xe),Xe=Vs.find(j=>j.is_primary);Pt(Xe||null);const ra=Vs.map(j=>{const P=xe.find(Z=>Z.id===j.org_chart_role_id);return P?{...P,is_primary:j.is_primary,assignment_id:j.id}:null}).filter(Boolean);if(B(ra),Xe){const j=xe.find(P=>P.id===Xe.org_chart_role_id);if(j){if(d(j),j.team_id){const g=Ge.find(f=>f.id===j.team_id);ds(g||null)}const P=await u("VolunteerRoleAssignment").filter({corporate_account_id:o,deleted_at:null});if(j.reports_to_role_id){const g=xe.find(f=>f.id===j.reports_to_role_id);if(g){r(g);const f=P.filter(b=>b.org_chart_role_id===g.id);if(f.length>0){const b=Je.find(I=>I.id===f[0].volunteer_profile_id&&I.is_active);D(b||null)}else D(null)}}const Z=Ke.map(g=>xe.find(f=>f.id===g.org_chart_role_id)).filter(Boolean),Us=Z.reduce((g,f)=>{const b={L1:1,L2:2,L3:3,L4:4,L5:5};return(b[f.leadership_level]||0)>(b[g]||0)?f.leadership_level:g},j.leadership_level),na=Xt.filter(g=>{var f;return g.competency_group!=="role-specific"?(f=g.level_expectations)==null?void 0:f.some(b=>b.level===Us):Z.some(b=>{var I,we;return((I=b.required_competencies)==null?void 0:I.includes(g.id))||((we=b.preferred_competencies)==null?void 0:we.includes(g.id))})}).map(g=>{var b;const f=(b=g.level_expectations)==null?void 0:b.find(I=>I.level===Us);return{...g,myLevelExpectation:(f==null?void 0:f.expectation)||null}});pe(na);const Ae=new Set,Ze=new Map;if(Z.forEach(g=>{var f;(f=g.required_courses)==null||f.forEach(b=>{Ae.add(b.module_id),Ze.has(b.module_id)||Ze.set(b.module_id,b)})}),Ae.size>0){const[g,f]=await Promise.all([F.entities.TrainingModule.filter({id:{$in:Array.from(Ae)},corporate_account_id:null,deleted_at:null}),F.entities.TrainingModule.filter({id:{$in:Array.from(Ae)},corporate_account_id:o,deleted_at:null})]),b=[...g,...f],I=Array.from(Ze.values()).map(we=>{var Bs,Hs,Ws;const Te=b.find(ss=>ss.id===we.module_id);if(!Te)return null;const Ys=((Hs=(Bs=a.training_progress)==null?void 0:Bs.completed_lessons)==null?void 0:Hs.filter(ss=>{var Js;return(Js=Te.lessons)==null?void 0:Js.some(ma=>ma.id===ss)}).length)||0,es=((Ws=Te.lessons)==null?void 0:Ws.length)||0,da=es>0?Ys/es*100:0;return{...we,moduleData:Te,progress:da,completedLessons:Ys,totalLessons:es}}).filter(Boolean);G(I)}const ia=Ke.map(g=>g.org_chart_role_id),ca=xe.filter(g=>ia.includes(g.id)),oa=Ia(ca,xe,Ge),zs=new Map;oa.forEach(g=>{const f=P.find(I=>I.org_chart_role_id===g.id),b=f?Je.find(I=>I.id===f.volunteer_profile_id&&I.is_active):null;zs.set(g.id,{role:g,volunteer:b||null,assignment:f||null})}
1),K(Array.from(zs.values()))}else console.warn("[PersonalLeadershipPlan] Primary assignment found but role not found in active roles."),d(null),r(null),D(null),pe([]),G([]),K([]),ds(null)}else console.log("[PersonalLeadershipPlan] No primary role assignment found for profile");const la=await u("ProjectTask").filter({corporate_account_id:o,assigned_to_id:a.id,deleted_at:null},"-due_date");H(la)}catch(a){console.error("[PersonalLeadershipPlan] Failed to load personal leadership plan:",a),v(!0)}finally{N(!1)}},qt=s=>{l(a=>a?{...a,profile_picture_url:s}:null),window.dispatchEvent(new CustomEvent("userUpdated",{detail:{profile_picture_url:s}}))},Vt=s=>{ms(s),hs(null),us(!0)},Ut=s=>{H(a=>a.map(o=>o.id===s.id?{...o,...s}:o))},zt=async s=>{const a={status:"completed",completed_date:is(new Date,"yyyy-MM-dd")},o=O;H(u=>u.map(C=>C.id===s.id?{...C,...a}:C));try{await F.entities.ProjectTask.update(s.id,a),me.success("Task marked as complete!")}catch(u){console.error("Failed to complete task:",u),H(o),me.error("Failed to complete task")}},Yt=async s=>{const a=ps.find(o=>o.id===s.assigned_to_id);It({success:!0,taskName:s.task_name,assignedToName:a?`${a.first_name} ${a.last_name}`:"Unknown User"}),Be(!0),await Bt()},Bt=async()=>{const s=n.account_type==="corporate_sub"?n.corporate_account_id:n.id,a=await F.entities.ProjectTask.filter({corporate_account_id:s,assigned_to_id:n.id,deleted_at:null},"-due_date");H(a)},Ht=(s,a)=>{ze(s),Ye(a),Ue(!0)},Wt=()=>{Ue(!1),ze(null),Ye(null),ge()},Jt=async()=>{await ge(),Ns(!1),fs(null),bs(null)};if(c)return e.jsx(pa,{cards:2,columns:1});if(p)return e.jsxs("div",{role:"alert",className:"space-y-4 p-8 text-center",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Unable to load your leadership plan"}),e.jsx("p",{className:"text-muted-foreground",children:"Your saved plan has not changed. Please try loading it again."}),e.jsx(k,{variant:"outline",onClick:ge,children:"Try Again"})]});if(!R){const s=(n==null?void 0:n.account_type)!=="corporate_sub"||(n==null?void 0:n.can_manage_volunteer_profiles);return e.jsx("div",{className:"max-w-4xl mx-auto p-6",children:e.jsxs(q,{children:[e.jsx(z,{children:e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-6 h-6"}),"My Leadership Plan"]})}),e.jsx(V,{children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-gray-600 mb-4",children:"We couldn't set up your volunteer profile automatically. Once you're added as a leader with a role of your own, this page will track your tasks, coaching rhythm, and reviews."}),e.jsx($,{to:L("LeaderProfiles"),children:e.jsxs(k,{className:"bg-[#00584f] hover:bg-[#00584f]/90",children:[e.jsx(Ba,{className:"w-4 h-4 mr-2"}),"Add Yourself as a Leader"]})})]}):e.jsxs("p",{className:"text-gray-600 mb-4",children:["We couldn't set up your volunteer profile automatically. Reach out to your account owner",ne!=null&&ne.first_name?`, ${ne.first_name} ${ne.last_name||""}`.trim():"",ne!=null&&ne.email?e.jsxs(e.Fragment,{children:[" ","(",e.jsx("a",{href:`mailto:${ne.email}`,className:"text-[var(--color-accent)] hover:underline",children:ne.email}),")"]}):null," ","to get added as a leader with a role."]})})]})})}const Gt=_e!=null&&_e.strategy_project_id?Q[_e.strategy_project_id]:null,He=O.filter(s=>W==="active"?s.status!=="completed":W==="completed"?s.status==="completed":!0),Kt=new Set(M.map(s=>{var a;return(a=s.volunteer)==null?void 0:a.id}).filter(Boolean)),Ne=Me.filter(s=>R&&s.reviewee_volunteer_profile_id===R.id||(n==null?void 0:n.id)&&s.reviewee_user_id===n.id),ks=Me.filter(s=>Kt.has(s.reviewee_volunteer_profile_id)),Rs=new Map(Me.map(s=>[s.id,s])),Ms=At.filter(s=>s.status!=="submitted"&&!s.deleted_at&&Rs.has(s.review_id)).map(s=>({invitation:s,review:Rs.get(s.review_id)})).sort((s,a)=>new Date(s.review.due_date||0)-new Date(a.review.due_date||0)),ie=lt({role:t,assignment:Ss,meetings:Cs.filter(s=>s.volunteer_profile_id===(R==null?void 0:R.id))}),ce=nt({role:t,assignment:Ss,reviews:Ne}),Qt=ie.applicable||ce.applicable||je>0||ve>0||!!Ne.find(s=>s.status==="completed"),As=M.filter(({volunteer:s})=>!!s).map(({role:s,volunteer:a,assignment:o})=>{const u=lt({role:s,assignment:o,meetings:Cs.filter(X=>X.volunteer_profile_id===a.id)}),C=nt({role:s,assignment:o,reviews:Me.filter(X=>X.reviewee_volunteer_profile_id===a.id)});return{role:s,volunteer:a,coaching:u,review:C}}).filter(({coaching:s,review:a})=>s.applicable||a.applicable);return e.jsxs(e.Fragment,{children:[e.jsx(fa,{isOpen:ft,onClose:()=>gs(!1),onUpdate:qt}),(_e||xs)&&e.jsx(Ca,{task:_e,isOpen:jt,onClose:()=>{us(!1),ms(null),hs(null)},onUpdate:Ut,onSave:Yt,currentUser:n,teamMembers:ps,project:Gt,prefilledData:xs}),e.jsx(Ta,{open:Et,onOpenChange:Be,children:e.jsxs(Da,{children:[e.jsxs(Pa,{children:[e.jsxs(Fa,{className:"flex items-center gap-2 text-green-700",children:[e.jsx(Pe,{className:"w-5 h-5"}),"Task Created Successfully!"]}),e.jsxs(La,{className:"space-y-2 pt-2",children:[e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-gray-500 uppercase tracking-wide",children:"Task Name"}),e.jsx("p",{className:"font-semibold text-gray-900",children:ye==null?void 0:ye.taskName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-gray-500 uppercase tracking-wide",children:"Assigned To"}),e.jsx("p",{className:"font-semibold text-gray-900",children:ye==null?void 0:ye.assignedToName})]})]}),e.jsx("p",{className:"text-sm text-gray-600 pt-2",children:"The task has been added to My Tasks and can be viewed or edited anytime."})]})]}),e.jsx(Oa,{children:e.jsx(Ea,{onClick:()=>Be(!1),children:"Got it!"})})]})}),e.jsxs(Ya,{width:"standard",className:"p-6 space-y-6",children:[e.jsx("div",{className:"overflow-hidden rounded-2xl shadow-sm border border-gray-100",children:e.jsx("div",{className:"bg-gradient-to-br from-[#00584f] via-[#004d45] to-[#003d37] p-8 md:p-12",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("div",{className:"flex-shrink-0 cursor-pointer group",onClick:()=>gs(!0),children:e.jsx("div",{className:"relative",children:n.profile_picture_url?e.jsx("img",{src:n.profile_picture_url,alt:`${n.first_name} ${n.last_name}`,className:"w-24 h-24 md:w-32 md:h-32 rounded-full object-cover border-4 border-white/20 shadow-xl group-hover:border-white/40 transition-all"}):e.jsxs("div",{className:"w-24 h-24 md:w-32 md:h-32 rounded-full bg-white/90 backdrop-blur-sm border-4 border-white/20 shadow-xl flex items-center justify-center text-3xl md:text-4xl font-bold text-[#00584f] group-hover:border-white/40 transition-all",children:[(Ts=n.first_name)==null?void 0:Ts[0],(Ds=n.last_name)==null?void 0:Ds[0]]})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white mb-2 break-words",children:"My Leadership Plan"}),e.jsxs("p",{className:"text-white/90 text-lg md:text-xl font-medium mb-4",children:[n.first_name," ",n.last_name,"'s personal development dashboard"]}),T.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:T.map(s=>e.jsxs("div",{className:"flex items-center gap-2 text-white/90 bg-white/10 backdrop-blur-sm px-3 py-1.5 rounded-lg w-fit",children:[e.jsx(Ce,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:s.role_title})]},s.assignment_id))})]}),Gs(T)&&e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:"bg-white rounded-xl p-4 shadow-lg",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl font-bold text-[var(--color-accent)] mb-1",children:Gs(T)}),e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide",children:"Leadership Level"})]})})})]}),e.jsx("div",{className:"mt-6 max-w-4xl mx-auto",children:ue?e.jsxs("div",{className:"bg-white/10 backdrop-blur-sm border border-white/20 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(ns,{className:"w-5 h-5"}),"Divine Design Profile"]}),e.jsx(k,{asChild:!0,variant:"ghost",size:"sm",className:"text-white/90 hover:text-white hover:bg-white/10",children:e.jsxs($,{to:L(`DivineDesignResult?id=${ue.id}`),children:["View Full Report",e.jsx(ee,{className:"w-3 h-3 ml-1"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ue.disc_style&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/70 uppercase tracking-wide mb-2",children:"DiSC Style"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(_,{className:"bg-white/20 text-white border-white/30 backdrop-blur-sm",children:ue.disc_style})})]}),ue.spiritual_gifts&&ue.spiritual_gifts.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/70 uppercase tracking-wide mb-2",children:"Spiritual Gifts"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[ue.spiritual_gifts.slice(0,3).map(s=>e.jsx(_,{className:"bg-white/20 text-white border-white/30 backdrop-blur-sm",children:s},s)),ue.spiritual_gifts.length>3&&e.jsxs(_,{className:"bg-white/20 text-white border-white/30 backdrop-blur-sm",children:["+",ue.spiritual_gifts.length-3," more"]})]})]})]})]}):e.jsx("div",{className:"bg-white/10 backdrop-blur-sm border border-white/20 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ns,{className:"w-5 h-5 text-white"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold",children:"Discover Your Divine Design"}),e.jsx("p",{className:"text-sm text-white/70",children:"Take the assessment to understand your spiritual gifts and DiSC style"})]})]}),e.jsx(k,{asChild:!0,variant:"ghost",size:"sm",className:"text-white/90 hover:text-white hover:bg-white/10 flex-shrink-0",children:e.jsxs($,{to:ya(n),children:["Take Assessment",e.jsx(ee,{className:"w-3 h-3 ml-1"})]})})]})})})]})})}),e.jsx(ts,{value:fe,onValueChange:Ot,children:e.jsxs(as,{className:"w-full",children:[e.jsx(oe,{value:"overview",className:"flex-1",children:"Overview"}),e.jsx(oe,{value:"team",className:"flex-1",children:"My Team"}),e.jsx(oe,{value:"reviews",className:"flex-1",children:"Reviews"}),e.jsx(oe,{value:"training",className:"flex-1",children:"Training"}),e.jsx(oe,{value:"coaching",className:"flex-1",children:"Meetings"})]})}),e.jsxs(Ha,{mode:"wait",children:[fe==="overview"&&e.jsxs(ke.div,{initial:{opacity:0,x:-20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.3},className:"space-y-6 mt-6",children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 px-1",children:"Action Items"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 items-start",children:[e.jsxs(q,{className:"glass-card",children:[e.jsxs(z,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Y,{className:"flex items-center gap-2 text-base",children:[e.jsx(Na,{className:"w-5 h-5"}),"My Tasks"]}),He.length>5&&e.jsx(k,{asChild:!0,variant:"ghost",size:"sm",children:e.jsxs($,{to:L("MyTasks"),children:["View All",e.jsx(ee,{className:"w-3 h-3 ml-1"})]})})]}),e.jsx(ts,{value:W,onValueChange:be,className:"mt-2",children:e.jsxs(as,{children:[e.jsx(oe,{value:"all",children:"All"}),e.jsx(oe,{value:"active",children:"Active"}),e.jsx(oe,{value:"completed",children:"Completed"})]})})]}),e.jsx(V,{children:He.length>0?e.jsx("div",{className:"space-y-3",children:He.slice(0,5).map(s=>{const a={not_started:{label:"Not Started",className:"bg-gray-100 text-gray-700 hover:bg-gray-100"},in_progress:{label:"In Progress",className:"bg-blue-100 text-blue-800 hover:bg-blue-100"},completed:{label:"Completed",className:"bg-green-100 text-green-800 hover:bg-green-100"}},o=a[s.status]||a.not_started,u=s.due_date?Ks(s.due_date):null,C=u&&s.status!=="completed"&&ba(u)&&!wa(u);return e.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"flex-shrink-0",children:s.status==="completed"?e.jsx(Pe,{className:"w-5 h-5 text-green-600"}):e.jsx(Wa,{className:"w-5 h-5 text-gray-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:`font-medium text-sm ${s.status==="completed"?"line-through text-gray-500":""}`,children:s.task_name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx(_,{className:`${o.className} text-xs`,children:o.label}),s.due_date&&e.jsxs("p",{className:`text-xs ${C?"text-red-600 font-medium":"text-gray-500"}`,children:[C?"Overdue: ":"Due: ",is(u,"MMM d, yyyy")]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.status!=="completed"&&e.jsxs(k,{variant:"ghost",size:"sm",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:X=>{X.stopPropagation(),zt(s)},children:[e.jsx(Pe,{className:"w-4 h-4 mr-1 text-green-600"}),e.jsx("span",{className:"text-xs",children:"Complete"})]}),e.jsx(k,{variant:"ghost",size:"sm",onClick:()=>Vt(s),children:e.jsx(xt,{className:"w-4 h-4"})})]})]},s.id)})}):e.jsxs("div",{className:"text-center py-6 text-gray-500",children:[e.jsx(Pe,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm",children:W==="completed"?"No completed tasks":W==="all"?"No tasks":"No active tasks"})]})})]}),Qt&&e.jsxs("div",{className:"space-y-4",children:[(ie.applicable||ce.applicable)&&e.jsxs(q,{className:"glass-card",children:[e.jsxs(z,{className:"pb-3",children:[e.jsxs(Y,{className:"flex items-center gap-2 text-base",children:[e.jsx(tt,{className:"w-5 h-5"}),"My Coaching & Reviews"]}),e.jsx(he,{children:"Your coaching and review cadence, set on your role."})]}),e.jsxs(V,{className:"space-y-2",children:[ie.applicable&&e.jsxs("div",{className:"flex items-center justify-between gap-3 p-3 bg-gray-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium text-sm text-gray-900",children:[rt[ie.cadence]," Coaching"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:ie.lastSessionDate?`Last session ${is(Ks(ie.lastSessionDate),"MMM d, yyyy")}`:"No session logged yet"})]}),e.jsx(_,{variant:"outline",className:ie.status==="overdue"?"bg-red-50 text-red-600 border-red-200":ie.status==="unknown"?"bg-amber-50 text-amber-700 border-amber-200":"bg-green-50 text-green-700 border-green-200",children:ie.status==="overdue"?"Overdue":ie.status==="unknown"?"Get started":"On track"})]}),ce.applicable&&e.jsxs("div",{className:"flex items-center justify-between gap-3 p-3 bg-gray-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm text-gray-900",children:"Annual Review"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["Targeted for ",["January","February","March","April","May","June","July","August","September","October","November","December"][ce.month-1]]})]}),e.jsx(_,{variant:"outline",className:ce.status==="overdue"?"bg-red-50 text-red-600 border-red-200":ce.status==="due"?"bg-amber-50 text-amber-700 border-amber-200":ce.status==="completed"?"bg-green-50 text-green-700 border-green-200":"bg-gray-100 text-gray-500 border-gray-200",children:ce.status==="overdue"?"Overdue":ce.status==="due"?"Due":ce.status==="completed"?"Completed":"Upcoming"})]})]})]}),(je>0||ve>0)&&e.jsx(q,{className:"glass-card",children:e.jsx(V,{className:"py-4",children:e.jsxs($,{to:L("Reviews"),className:"flex items-center justify-between gap-4 group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-[var(--bg-accent-1)] flex items-center justify-center flex-shrink-0",children:e.jsx(Fe,{className:"w-5 h-5 text-[var(--color-accent)]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm text-gray-900",children:"Reviews"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[je>0&&e.jsxs("span",{children:[je," review",je===1?"":"s"," waiting on you"]}),je>0&&ve>0&&e.jsx("span",{children:" · "}),ve>0&&e.jsxs("span",{children:[ve," team review",ve===1?"":"s"," in progress"]})]})]})]}),e.jsx(ee,{className:"w-4 h-4 text-gray-400 group-hover:text-[var(--color-accent)] transition-colors flex-shrink-0"})]})})}),Ne.find(s=>
1s.status==="completed")&&e.jsx(q,{className:"glass-card",children:e.jsx(V,{className:"py-4",children:(()=>{const s=Ne.find(C=>C.status==="completed"),a=rs(s),o=ls(s);let u;return a.hasExternalFeedback&&a.score!==null?u=`Overall score: ${a.score} / 5`:o!==null?u=`Self score: ${o} / 5 (no supervisor or peer feedback yet)`:u="Self-assessment only — no supervisor or peer feedback",e.jsxs($,{to:L("AnnualReview")+`?id=${s.id}`,className:"flex items-center justify-between gap-4 group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-[var(--bg-accent-1)] flex items-center justify-center flex-shrink-0",children:e.jsx(De,{className:"w-5 h-5 text-[var(--color-accent)]"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium text-sm text-gray-900",children:["My ",s.review_year," Review"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:u})]})]}),e.jsx(ee,{className:"w-4 h-4 text-gray-400 group-hover:text-[var(--color-accent)] transition-colors flex-shrink-0"})]})})()})})]})]}),e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 px-1 pt-2",children:"Your Role"}),e.jsxs(q,{className:"glass-card",children:[e.jsx(z,{children:e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(Ga,{className:"w-5 h-5"}),T.length===1?"My Role":"My Roles"]})}),e.jsx(V,{children:T.length>0?e.jsx("div",{className:"space-y-3",children:T.map(s=>e.jsxs("div",{className:`${s.is_primary?"p-3 bg-blue-50 rounded-lg":"pb-3 border-b last:border-0"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-700",children:s.role_title}),s.leadership_level&&e.jsx(_,{variant:"outline",className:`text-xs ${Re[s.leadership_level]}`,children:s.leadership_level}),s.is_primary&&e.jsx(_,{variant:"outline",className:"text-xs bg-[var(--bg-accent-1)] text-[var(--color-accent)] border-[var(--color-accent)]/30",children:"Primary"})]}),s.team_id&&(()=>{const a=os.find(o=>o.id===s.team_id);return a?e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["Team: ",a.team_name]}):null})(),s.is_primary&&s.summary&&e.jsx("div",{className:"text-xs text-gray-600 leading-relaxed pt-2 mt-2 border-t border-[var(--color-accent)]/10",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:s.summary}})})]},s.id))}):e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(Ce,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"font-medium",children:"No Roles Assigned"}),e.jsx("p",{className:"text-sm mt-1",children:"Contact your supervisor to be assigned a role"})]})})]}),e.jsxs(q,{className:"glass-card",children:[e.jsxs(z,{className:"cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>yt(!qe),children:[e.jsxs(Y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-5 h-5"}),"Role Details"]}),e.jsx(Ka,{className:`w-5 h-5 text-gray-400 transition-transform ${qe?"rotate-180":""}`})]}),e.jsx(he,{children:"Competencies, summary, responsibilities, and details for your role"})]}),qe&&e.jsxs(V,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-semibold text-sm mb-3 flex items-center gap-2",children:[e.jsx(De,{className:"w-4 h-4"}),"Competencies"]}),J.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:J.map(s=>e.jsxs("div",{className:"border rounded-lg p-4 hover:border-brand-primary/30 hover:shadow-md transition-all bg-white",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:s.competency_name}),e.jsx(_,{variant:"outline",className:"text-xs shrink-0 ml-2",children:s.competency_group==="role-specific"?"Role":s.competency_group==="character"?"Character":"Capacity"})]}),s.myLevelExpectation&&e.jsxs("div",{className:"bg-[var(--bg-accent-1)] border border-[var(--color-accent)]/20 rounded-lg p-2.5 mt-2",children:[e.jsxs("p",{className:"text-xs font-medium text-[var(--color-accent)] mb-1",children:["At ",R.leadership_level,":"]}
1),e.jsx("p",{className:"text-xs text-[var(--color-accent)] leading-relaxed",children:s.myLevelExpectation})]})]},s.id))}):e.jsx("p",{className:"text-gray-500 text-center py-4",children:"No competencies defined for your role"})]}),e.jsx("div",{className:"border-t pt-6",children:t?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Summary"}),e.jsx("div",{className:"text-sm text-gray-600 prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.summary||"No summary provided"}})]}),t.responsibilities&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Responsibilities"}),e.jsx("div",{className:"text-sm text-gray-600 prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.responsibilities}})]}),t.time_commitment&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Time Commitment"}),e.jsx("p",{className:"text-sm text-gray-600",children:t.time_commitment})]}),t.divine_design_alignment&&(((Ps=t.divine_design_alignment.spiritual_gifts)==null?void 0:Ps.length)>0||((Fs=t.divine_design_alignment.disc_styles)==null?void 0:Fs.length)>0)&&e.jsxs("div",{className:"border-t pt-4",children:[e.jsxs("h4",{className:"font-semibold text-sm mb-3 flex items-center gap-2",children:[e.jsx(ns,{className:"w-4 h-4 text-purple-600"}),"Divine Design Alignment"]}),e.jsxs("div",{className:"space-y-3",children:[((Ls=t.divine_design_alignment.spiritual_gifts)==null?void 0:Ls.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",children:"Ideal Spiritual Gifts"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.divine_design_alignment.spiritual_gifts.map(s=>e.jsx(_,{variant:"outline",className:"bg-[var(--bg-accent-2)] text-[var(--color-accent-2)] border-[var(--color-accent-2)]/30",children:s},s))})]}),((Os=t.divine_design_alignment.disc_styles)==null?void 0:Os.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",children:"Ideal DiSC Styles"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.divine_design_alignment.disc_styles.map(s=>e.jsx(_,{variant:"outline",className:"bg-[var(--bg-accent-1)] text-[var(--color-accent)] border-[var(--color-accent)]/20",children:s},s))})]})]})]}),t.position_description_pdf_url&&e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h4",{className:"font-semibold text-sm mb-3",children:"Position Description"}),e.jsx(k,{variant:"outline",asChild:!0,className:"w-full sm:w-auto",children:e.jsxs("a",{href:t.position_description_pdf_url,download:!0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(Ja,{className:"w-4 h-4 mr-2"}),"Download Position Description (PDF)"]})})]}),t.additional_notes&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Additional Notes"}),e.jsx("div",{className:"text-sm text-gray-600 prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.additional_notes}})]})]}):e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(Ce,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"font-medium",children:"No Role Assigned"}),e.jsx("p",{className:"text-sm mt-1",children:"Contact your supervisor to be assigned a role"})]})})]})]})]},"overview"),fe==="team"&&e.jsxs(ke.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.3},className:"space-y-6 mt-6",children:[A&&e.jsxs(q,{className:"glass-card",children:[e.jsxs(z,{children:[e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(cs,{className:"w-5 h-5"}),"My Supervisor"]}),e.jsx(he,{children:"The role you report to"})]}),e.jsx(V,{children:e.jsx("div",{className:`flex items-center gap-3 p-4 border rounded-lg transition-all ${m?"hover:border-[var(--color-accent)] hover:bg-[var(--bg-accent-1)]/30":"bg-gray-50 border-dashed"}`,children:m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-12 h-12 rounded-full bg-[var(--color-accent)] text-white flex items-center justify-center text-lg font-semibold flex-shrink-0",children:[(Es=m.first_name)==null?void 0:Es[0],(Is=m.last_name)==null?void 0:Is[0]]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm",children:[m.first_name," ",m.last_name]}),e.jsx("p",{className:"text-xs text-gray-500",children:A.role_title}),A.leadership_level&&e.jsx(_,{variant:"outline",className:`text-xs mt-1 ${Re[A.leadership_level]}`,children:A.leadership_level})]}),e.jsx("a",{href:`mailto:${m.email}`,className:"text-[var(--color-accent)] hover:text-[var(--color-accent-hover)] transition-colors flex-shrink-0",onClick:s=>s.stopPropagation(),children:e.jsx(Oe,{className:"w-4 h-4"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center text-lg font-semibold flex-shrink-0 text-gray-400",children:e.jsx(cs,{className:"w-6 h-6"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm text-gray-700",children:A.role_title}),e.jsx("p",{className:"text-xs text-gray-500 italic",children:"No one assigned yet"}),A.leadership_level&&e.jsx(_,{variant:"outline",className:`text-xs mt-1 ${Re[A.leadership_level]}`,children:A.leadership_level})]})]})})})]}),e.jsxs(q,{className:"glass-card",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"w-5 h-5"}),"My Team Members"]}),e.jsx(he,{children:"Roles that report to you"})]}),((n==null?void 0:n.can_manage_org_chart)||(n==null?void 0:n.account_type)==="corporate_owner")&&t&&$e&&e.jsx(k,{variant:"ghost",size:"icon",onClick:()=>Ve(!0),className:"h-8 w-8",children:e.jsx(Sa,{className:"w-4 h-4"})})]})}),e.jsx(V,{children:e.jsx(ar,{members:M,onEdit:Ht,onView:s=>$t(L(`LeaderDetails?id=${s.id}`))})})]}),As.length>0&&e.jsxs(q,{className:"glass-card",children:[e.jsxs(z,{children:[e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(tt,{className:"w-5 h-5"}),"Team Coaching & Reviews"]}),e.jsx(he,{children:"Coaching and review cadence for the people who report to you."})]}),e.jsx(V,{className:"space-y-2",children:As.map(({role:s,volunteer:a,coaching:o,review:u})=>e.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg space-y-2",children:[e.jsxs("p",{className:"font-medium text-sm text-gray-900",children:[a.first_name," ",a.last_name,e.jsxs("span",{className:"text-xs text-gray-500 font-normal",children:[" · ",s.role_title]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.applicable&&e.jsxs(_,{variant:"outline",className:o.status==="overdue"?"bg-red-50 text-red-600 border-red-200":o.status==="unknown"?"bg-amber-50 text-amber-700 border-amber-200":"bg-green-50 text-green-700 border-green-200",children:[rt[o.cadence]," coaching — ",o.status==="overdue"?"overdue":o.status==="unknown"?"get started":"on track"]}),u.applicable&&e.jsxs(_,{variant:"outline",className:u.status==="overdue"?"bg-red-50 text-red-600 border-red-200":u.status==="due"?"bg-amber-50 text-amber-700 border-amber-200":u.status==="completed"?"bg-green-50 text-green-700 border-green-200":"bg-gray-100 text-gray-500 border-gray-200",children:["Annual review — ",u.status==="overdue"?"overdue":u.status==="due"?"due":u.status==="completed"?"completed":"upcoming"]}),(o.status==="overdue"||o.status==="unknown")&&e.jsx($,{to:L("Meetings"),className:"text-xs text-[var(--color-accent)] hover:underline",children:"Log a session →"}),(u.status==="due"||u.status==="overdue")&&e.jsx($,{to:L("Reviews")+`?startReview=1&revieweeId=${a.id}&reviewYear=${u.cycleYear}`,className:"text-xs text-[var(--color-accent)] hover:underline",children:"Start review →"})]})]},s.id))})]})]},"team"),fe==="reviews"&&e.jsxs(ke.div,{initial:{opacity:0,x:-20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.3},className:"space-y-6 mt-6",children:[Ms.length>0&&e.jsxs(q,{className:"glass-card border-[var(--color-accent)]/30",children:[e.jsx(z,{children:e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(Oe,{className:"w-5 h-5 text-[var(--color-accent)]"}),"Reviews Waiting on You"]})}),e.jsx(V,{className:"space-y-2",children:Ms.map(({invitation:s,review:a})=>e.jsxs("a",{href:L("TakeReview")+`?token=${s.access_token}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between gap-3 p-3 bg-[var(--bg-accent-1)] rounded-lg hover:opacity-90 transition-opacity",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-sm text-gray-900 truncate",children:s.reviewer_type==="self"?"Your Self-Assessment":a.reviewee_name}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5 truncate",children:[nr[s.reviewer_type]||"Review"," · ",a.review_year," Review",a.due_date&&e.jsxs(e.Fragment,{children:[" · Due ",new Date(`${a.due_date}T00:00:00`).toLocaleDateString()]})]})]}),e.jsx(k,{size:"sm",className:"bg-brand-primary hover:bg-brand-primary-hover flex-shrink-0",children:s.status==="in_progress"?"Continue":"Start"})]},s.id))})]}),e.jsxs(q,{className:"glass-card",children:[e.jsxs(z,{children:[e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(Fe,{className:"w-5 h-5"}),"Reviews"]}),e.jsx(he,{children:"Leadership review results, with a link to the full report for each."}),e.jsx(ts,{value:ws,onValueChange:Dt,className:"mt-2",children:e.jsxs(as,{children:[e.jsx(oe,{value:"self",children:"Self"}),e.jsx(oe,{value:"team",disabled:M.length===0,children:"My Team"})]})})]}),e.jsx(V,{children:ws==="self"?Ne.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(Fe,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm",children:"No reviews yet."})]}):e.jsx("div",{className:"space-y-2",children:Ne.map(s=>{const a=rs(s);return e.jsxs($,{to:L("AnnualReview")+`?id=${s.id}`,className:"flex items-center justify-between gap-3 p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium text-sm text-gray-900",children:[s.review_year," Review"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:s.status==="completed"?"Completed":"In Progress"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.status==="completed"&&(a.hasExternalFeedback&&a.score!==null?e.jsxs(_,{variant:"outline",className:"bg-[var(--bg-accent-1)] text-[var(--color-accent)] border-[var(--color-accent)]/30 font-semibold",children:[a.score," / 5"]}):(()=>{const o=ls(s);return o!==null?e.jsxs(_,{variant:"outline",className:"bg-gray-100 text-gray-500 border-gray-200 text-xs",children:[o," / 5 (self)"]}):e.jsx(_,{variant:"outline",className:"bg-gray-100 text-gray-400 border-gray-200 text-xs",children:"Self-only"})})()),e.jsx(ee,{className:"w-4 h-4 text-gray-400"})]})]},s.id)})}):M.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(Ee,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm",children:"You don't supervise anyone yet, so there's nothing to show here."})]}):ks.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(Fe,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm",children:"No reviews for your team yet."})]}):e.jsx("div",{className:"space-y-2",children:ks.map(s=>{const a=rs(s);return e.jsxs($,{to:L("AnnualReview")+`?id=${s.id}`,className:"flex items-center justify-between gap-3 p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm text-gray-900",children:s.reviewee_name}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[s.reviewee_role_title||"No role on file"," · ",s.review_year," · ",s.status==="completed"?"Completed":"In Progress"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.status==="completed"&&(a.hasExternalFeedback&&a.score!==null?e.jsxs(_,{variant:"outline",className:"bg-[var(--bg-accent-1)] text-[var(--color-accent)] border-[var(--color-accent)]/30 font-semibold",children:[a.score," / 5"]}):(()=>{const o=ls(s);return o!==null?e.jsxs(_,{variant:"outline",className:"bg-gray-100 text-gray-500 border-gray-200 text-xs",children:[o," / 5 (self)"]}):e.jsx(_,{variant:"outline",className:"bg-gray-100 text-gray-400 border-gray-200 text-xs",children:"Self-only"})})()),e.jsx(ee,{className:"w-4 h-4 text-gray-400"})]})]},s.id)})})})]})]},"reviews"),fe==="training"&&e.jsxs(ke.div,{initial:{opacity:0,x:-20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.3},className:"space-y-6 mt-6",children:[e.jsxs(q,{className:"glass-card",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qs,{className:"w-5 h-5 text-green-700"}),e.jsxs("div",{children:[e.jsx(Y,{children:"Required Courses"}),e.jsx(he,{children:"Training modules assigned to your roles"})]})]})}),e.jsx(V,{children:S.length>0?e.jsx("div",{className:"space-y-3",children:S.map(s=>{var a;return e.jsx("div",{className:"border rounded-lg p-4 hover:border-green-200 hover:bg-green-50/30 transition-all",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[e.jsx("h4",{className:"font-semibold text-sm",children:s.module_title}),s.completion_required&&e.jsx(_,{variant:"destructive",className:"text-xs",children:"Required"}),((a=s.moduleData)==null?void 0:a.corporate_account_id)&&e.jsxs(_,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[e.jsx(Qa,{className:"w-3 h-3 mr-1"}),"Church"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600",children:[e.jsxs("span",{children:[s.completedLessons," of ",s.totalLessons," lessons"]}),e.jsxs("span",{className:"font-medium",children:[Math.round(s.progress),"%"]})]}),e.jsx(Xs,{value:s.progress,className:"h-1.5"})]})]}),e.jsx(k,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:e.jsxs($,{to:L(`TrainingModule?id=${s.module_id}`),children:[s.progress===100?"Review":s.progress>0?"Continue":"Start",e.jsx(ee,{className:"w-3 h-3 ml-1"})]})})]})},s.module_id)})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Qs,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-600 font-medium",children:"No Required Courses"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"No training courses have been assigned to your roles"})]})})]}),e.jsxs(q,{className:"glass-card",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{className:"w-5 h-5 text-purple-700"}),e.jsxs("div",{children:[e.jsx(Y,{children:"Competency Development Resources"}),e.jsx(he,{children:"Modules, lessons, books, articles, and resources for your competencies"})]})]})}),e.jsx(V,{children:J.some(s=>{var a;return((a=s.developmental_resources)==null?void 0:a.length)>0})?e.jsx("div",{className:"space-y-4",children:J.filter(s=>{var a;return((a=s.developmental_resources)==null?void 0:a.length)>0}).map(s=>e.jsxs("div",{className:"border rounded-lg p-4 bg-purple-50/30",children:[e.jsx("h4",{className:"font-semibold text-sm mb-3 text-gray-900",children:s.competency_name}),e.jsx("div",{className:"space-y-2",children:s.developmental_resources.map((a,o)=>{let u=0,C=null,X=0,E=0;return a.type==="module"&&a.module_id&&(C=S.find(We=>We.module_id===a.module_id),C&&(u=C.progress,X=C.completedLessons,E=C.totalLessons)),e.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white rounded-lg border hover:border-purple-200 transition-colors",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h5",{className:"font-medium text-sm",children:a.title}),e.jsx(_,{variant:"outline",className:"text-xs capitalize",children:a.type.replace("_"," ")}),a.completion_required&&e.jsx(_,{variant:"destructive",className:"text-xs",children:"Required"})]}),a.type==="module"&&a.module_id&&e.jsxs("div",{className:"space-y-1 mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600",children:[e.jsxs("span",{children:[X," of ",E," lessons"]}),e.jsxs("span",{className:"font-medium",children:[Math.round(u),"%"]})]}),e.jsx(Xs,{value:u,className:"h-1.5"})]})]}),a.type==="module"&&a.module_id?e.jsx(k,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:e.jsxs($,{to:L(`TrainingModule?id=${a.module_id}`),children:[u===100?"Review":u>0?"Continue":"Start",e.jsx(ee,{className:"w-3 h-3 ml-1"})]})}):a.type==="lesson"&&a.module_id&&a.lesson_id?e.jsx(k,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:e.jsxs($,{to:L(`TrainingModule?id=${a.module_id}&lesson=${a.lesson_id}`),children:["View Lesson",e.jsx(ee,{className:"w-3 h-3 ml-1"})]})}):a.type==="internal_article"&&a.internal_article_id?e.jsx(k,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:e.jsxs($,{to:L(`Article?id=${a.internal_article_id}`),children:["Read",e.jsx(ee,{className:"w-3 h-3 ml-1"})]})}):a.url?e.jsx(k,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:e.jsxs("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",children:["View",e.jsx(Oe,{className:"w-3 h-3 ml-1"})]})}):null]},o)})})]},s.id))}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(De,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-600 font-medium",children:"No Development Resources"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"No additional resources have been assigned to your competencies"})]})})]})]},"training"),fe==="coaching"&&e.jsx(ke.div,{initial:{opacity:0,x:-20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.3},children:e.jsx(Aa,{user:n,volunteerProfile:R,viewingOwnPlan:!0,corporateAccountId:n.account_type==="corporate_sub"?n.corporate_account_id:n.id,allVolunteerProfiles:le})},"coaching")]})]}),_s&&$e&&e.jsx(ka,{isOpen:_s,onClose:()=>{Ve(!1),ge()},onComplete:()=>{Ve(!1),ge()},team:$e,allRoles:ht,allTeams:os,currentUser:n}),js&&vs&&e.jsx(Za,{isOpen:js,onClose:()=>{Ue(!1),ze(null),Ye(null)},role:vs,currentVolunteer:Nt,allVolunteers:le,onComplete:Wt}),ys&&e.jsx(er,{isOpen:ys,onClose:()=>{Ns(!1),fs(null),bs(null)},meetingType:wt,onSave:Jt,user:n,volunteerProfiles:le,templates:St,preSelectedParticipant:bt})]})}function Jl(){return e.jsx(ga,{requiredTier:"plus",featureName:"Personal Leadership Plan",children:e.jsx(ir,{})})}export{Jl 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.