import{j as e,b as P,a as w,u as W}from"./query-PJ0ZdjbV.js";import{f as Ts,a as C,O as Vs,k as Ks,u as $s}from"./vendor-CWhr2lg4.js";import{a2 as We,b0 as ie,b_ as us,cz as xs,bw as ps,bz as es,bf as Ls,ap as Ye,p as h,a4 as o,B as _,d as Fe,h as Ee,e as Oe,f as Qe,a as Os,P as re,s as J,t as X,v as ee,w as se,x as B,aa as le,ab as ce,ac as oe,ad as de,ae as me,q as u,I as $,r as Ke,af as ue,Q as he,V as ge,W as je,X as ye,Y as fe,Z as ve,_ as Ne,$ as _e,a0 as Se,ag as be,ah as Ce,ai as ke,aj as Y,ak as Pe,y as we,o as Qs,at as ze,b as Me,N as hs}from"./index-BSPIaiZU.js";import{L as Ms}from"./layout-dashboard-pgzECxsO.js";import{B as gs}from"./brain-CEoL1N-i.js";import{U as js}from"./users-round-Co0Z9sI2.js";import{A as ss}from"./award-BB4qCp8n.js";import{C as ys}from"./circle-alert-9pjtMKqA.js";import{B as He}from"./book-open-CYSpU_-u.js";import{C as fs}from"./calendar-check-BOVhup94.js";import{U as Is}from"./user-check-B2v_CMeM.js";import{L as vs}from"./layers-DdTlMVfO.js";import{F as Ns}from"./file-text-BeBoTfpI.js";import{L as Us}from"./list-checks-DgCazpHc.js";import{M as zs}from"./message-square-CrQ4L-TW.js";import{A as Rs}from"./activity-BBaZC8Hc.js";import{Z as _s}from"./zap-DzbXsdut.js";import{B as Ss}from"./building-2-boIK6K2k.js";import{L as Bs}from"./link-2-zJB3uZzB.js";import{F as as}from"./file-chart-column-increasing-DonUpE5r.js";import{C as ns}from"./chart-column-DbfNf7gS.js";import{B as Z}from"./badge-C34iUAiA.js";import{P as Ge}from"./page-header-D8tSLbK0.js";import{T as Gs}from"./trending-up-Cognoqa9.js";import{S as Ys}from"./star-DLH_J9Ff.js";import{A as cs}from"./arrow-right-Bmt6JCm_.js";import{u as te,t as ae,o as ne,s as q,c as Ve,l as Ze,e as De,b as Ae,a as Be}from"./date-range-picker-BB0TgAn8.js";import{u as xe}from"./use-data-table-state-CKRg6qY2.js";import{D as pe}from"./data-table-D_-xOEqd.js";import{E as qe}from"./ellipsis-DaNBIBaV.js";import{S as Hs}from"./send-hExJQKXK.js";import{A as Le}from"./async-select-BUbwdJEZ.js";import{w as Ws,i as os,a as Zs}from"./date-validation-D9gNvaP9.js";import{P as Js}from"./play-N42nmD6a.js";import{C as bs}from"./circle-check-Dgh1V3VA.js";import{C as Cs}from"./circle-x-C0sF-Oht.js";import{E as Je}from"./employee-select-DtUobKxP.js";import{S as Re}from"./status-badge-DPaiL_rL.js";import{M as Xs}from"./message-circle-DRPiqW4z.js";import{R as et}from"./rocket-dddDjFyA.js";import{L as st}from"./laptop-BvdVHGpX.js";import"./ui-aO-W1bxx.js";import"./chevron-left-DLFf1YD2.js";import"./core-hr.api-MChaGqvv.js";/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tt=We("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ks=We("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const at=We("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nt=We("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const it=We("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]),rt=[{heading:"Overview",items:[{to:"/training",label:"Dashboard",description:"Training overview",icon:Ms,permission:["training","dashboard","read"]}]},{heading:"Skills",items:[{to:"/training/skills",label:"Skill Taxonomy",description:"Manage skill tree",icon:gs,permission:["training","skill","read"]},{to:"/training/employee-skills",label:"Employee Skills",description:"Skill assignments",icon:js,permission:["training","employee_skill","read"]},{to:"/training/certifications",label:"Certifications",description:"Manage certifications",icon:ss,permission:["training","certification","read"]}]},{heading:"Training Needs",items:[{to:"/training/needs",label:"Training Needs",description:"Identify & approve",icon:ys,permission:["training","training_need","read"]}]},{heading:"Programs",items:[{to:"/training/programs",label:"Programs",description:"Training programs",icon:He,permission:["training","program","read"]},{to:"/training/sessions",label:"Sessions",description:"Schedule & track",icon:fs,permission:["training","session","read"]},{to:"/training/enrollments",label:"Enrollments",description:"Manage enrollments",icon:Is,permission:["training","enrollment","read"]}]},{heading:"Curriculum",items:[{to:"/training/curricula",label:"Curricula",description:"Learning paths",icon:at,permission:["training","curriculum","read"]},{to:"/training/modules",label:"Modules",description:"Course modules",icon:vs,permission:["training","module","read"]},{to:"/training/lessons",label:"Lessons",description:"Lesson content",icon:Ns,permission:["training","lesson","read"]}]},{heading:"Assessment",items:[{to:"/training/assessments",label:"Assessments",description:"Tests & exams",icon:us,permission:["training","assessment","read"]},{to:"/training/attempts",label:"Attempts",description:"View attempts",icon:Us,permission:["training","attempt","read"]}]},{heading:"Feedback",items:[{to:"/training/feedback",label:"Training Feedback",description:"Participant feedback",icon:zs,permission:["training","feedback","read"]},{to:"/training/behavior-assessments",label:"Behavior Assessments",description:"Post-training impact",icon:Rs,permission:["training","behavior_assessment","read"]}]},{heading:"Development",items:[{to:"/training/development-plans",label:"Development Plans",description:"Growth roadmaps",icon:xs,permission:["training","development_plan","read"]},{to:"/training/development-actions",label:"Actions",description:"Plan activities",icon:_s,permission:["training","development_plan","read"]}]},{heading:"Resources",items:[{to:"/training/trainers",label:"Trainers",description:"Manage trainers",icon:ps,permission:["training","trainer","read"]},{to:"/training/vendors",label:"Vendors",description:"Training providers",icon:Ss,permission:["training","vendor","read"]},{to:"/training/lms-integrations",label:"LMS Integrations",description:"External LMS",icon:Bs,permission:["training","lms","read"]}]},{heading:"Configuration",items:[{to:"/training/settings",label:"Settings",description:"Module config",icon:es,permission:["training","settings","read"]}]},{heading:"Insights",items:[{to:"/training/reports",label:"Reports",description:"Training reports",icon:as,permission:["training","report","read"]},{to:"/training/analytics",label:"Analytics",description:"Trends & insights",icon:ns,permission:["training","analytics","read"]}]}];function lt({item:t,isActive:s}){const a=t.icon;return e.jsxs(Ks,{to:t.to,end:t.to==="/training",className:Ye("group relative flex items-center gap-3 rounded-lg px-3 py-2.5 transition-all duration-150",s?"bg-primary-subtle/70":"hover:bg-slate-50"),children:[s&&e.jsx("span",{className:"absolute left-0 top-2.5 bottom-2.5 w-[3px] rounded-r-full bg-primary"}),e.jsx("div",{className:Ye("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors duration-150",s?"bg-primary/10 text-primary":"bg-slate-100 text-slate-400 group-hover:bg-slate-200/70 group-hover:text-slate-500"),children:e.jsx(a,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:Ye("block text-[13px] truncate leading-tight",s?"font-medium text-primary":"font-medium text-slate-700 group-hover:text-slate-900"),children:t.label}),e.jsx("span",{className:Ye("block text-[11px] truncate leading-tight mt-0.5",s?"text-primary/60":"text-slate-400"),children:t.description})]})]})}function ci(){const t=Ts(),s=C.useRef(null),{hasPermission:a}=ie();C.useEffect(()=>{var l;(l=s.current)==null||l.scrollTo(0,0)},[t.pathname]);const p=C.useMemo(()=>rt.map(l=>({...l,items:l.items.filter(y=>a(y.permission[0],y.permission[1],y.permission[2]))})).filter(l=>l.items.length>0),[a]);return e.jsxs("div",{className:"-m-6 flex h-[calc(100%+48px)]",children:[e.jsxs("aside",{className:"w-[260px] shrink-0 border-r border-slate-200/60 bg-white flex flex-col",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-6 pb-4 border-b border-slate-100",children:[e.jsx("h1",{className:"text-[15px] font-semibold text-slate-900 tracking-tight",children:"Training & Development"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-slate-400",children:"Programs, skills & learning paths"})]}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-3 scrollbar-thin",children:p.map((l,y)=>e.jsxs("div",{className:Ye(y>0&&"mt-6"),children:[e.jsx("p",{className:"mb-2 px-3 text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400",children:l.heading}),e.jsx("div",{className:"space-y-0.5",children:l.items.map(v=>{const D=v.to==="/training"?t.pathname==="/training":Ls(t.pathname,v.to);return e.jsx(lt,{item:v,isActive:D},v.to)})})]},l.heading))})]}),e.jsx("main",{ref:s,className:"flex-1 min-w-0 overflow-y-auto bg-background scrollbar-thin",children:e.jsx("div",{className:"px-8 py-6 w-full",children:e.jsx(Vs,{})})})]})}const g="/training",m={settings:["training","settings"],skills:["training","skills"],employeeSkills:["training","employee-skills"],endorsements:["training","endorsements"],certifications:["training","certifications"],employeeCertifications:["training","employee-certifications"],needs:["training","needs"],vendors:["training","vendors"],trainers:["training","trainers"],curricula:["training","curricula"],modules:["training","modules"],lessons:["training","lessons"],programs:["training","programs"],program:t=>["training","programs",t],sessions:["training","sessions"],session:t=>["training","sessions",t],enrollments:["training","enrollments"],attendance:["training","attendance"],assessments:["training","assessments"],attempts:["training","attempts"],feedbackForms:["training","feedback-forms"],feedback:["training","feedback"],behaviorAssessments:["training","behavior-assessments"],developmentPlans:["training","development-plans"],developmentActions:["training","development-actions"],lmsIntegrations:["training","lms-integrations"],externalCourses:["training","external-courses"],dashboard:["training","dashboard"]};function ct(){return W({queryKey:m.settings,queryFn:()=>h.get(`${g}/settings/`).then(t=>t.data)})}function ot(){const t=P();return w({mutationFn:s=>h.patch(`${g}/settings/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.settings}),o.success("Training settings updated")},onError:()=>o.error("Failed to update training settings")})}function ts(t){return W({queryKey:[...m.skills,t],queryFn:()=>h.get(`${g}/skills/`,{params:t}).then(s=>s.data)})}function dt(){const t=P();return w({mutationFn:s=>h.post(`${g}/skills/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.skills}),o.success("Skill created")},onError:()=>o.error("Failed to create skill")})}function mt(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/skills/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.skills}),o.success("Skill updated")},onError:()=>o.error("Failed to update skill")})}function ut(){const t=P();return w({mutationFn:s=>h.delete(`${g}/skills/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.skills}),o.success("Skill deleted")},onError:()=>o.error("Failed to delete skill")})}function xt(t){return W({queryKey:[...m.employeeSkills,t],queryFn:()=>h.get(`${g}/employee-skills/`,{params:t}).then(s=>s.data)})}function pt(){const t=P();return w({mutationFn:s=>h.post(`${g}/employee-skills/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.employeeSkills}),o.success("Employee skill added")},onError:()=>o.error("Failed to add employee skill")})}function ht(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/employee-skills/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.employeeSkills}),o.success("Employee skill updated")},onError:()=>o.error("Failed to update employee skill")})}function gt(){const t=P();return w({mutationFn:s=>h.delete(`${g}/employee-skills/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.employeeSkills}),o.success("Employee skill removed")},onError:()=>o.error("Failed to remove employee skill")})}function oi(t){return W({queryKey:[...m.endorsements,t],queryFn:()=>h.get(`${g}/skill-endorsements/`,{params:t}).then(s=>s.data)})}function di(){const t=P();return w({mutationFn:s=>h.post(`${g}/skill-endorsements/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.endorsements}),t.invalidateQueries({queryKey:m.employeeSkills}),o.success("Skill endorsed")},onError:()=>o.error("Failed to endorse skill")})}function jt(t){return W({queryKey:[...m.certifications,t],queryFn:()=>h.get(`${g}/certifications/`,{params:t}).then(s=>s.data)})}function yt(){const t=P();return w({mutationFn:s=>h.post(`${g}/certifications/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.certifications}),o.success("Certification created")},onError:()=>o.error("Failed to create certification")})}function ft(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/certifications/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.certifications}),o.success("Certification updated")},onError:()=>o.error("Failed to update certification")})}function vt(){const t=P();return w({mutationFn:s=>h.delete(`${g}/certifications/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.certifications}),o.success("Certification deleted")},onError:()=>o.error("Failed to delete certification")})}function mi(t){return W({queryKey:[...m.employeeCertifications,t],queryFn:()=>h.get(`${g}/employee-certifications/`,{params:t}).then(s=>s.data)})}function ui(){const t=P();return w({mutationFn:s=>h.post(`${g}/employee-certifications/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.employeeCertifications}),o.success("Employee certification added")},onError:()=>o.error("Failed to add employee certification")})}function xi(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/employee-certifications/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.employeeCertifications}),o.success("Employee certification updated")},onError:()=>o.error("Failed to update employee certification")})}function pi(){const t=P();return w({mutationFn:s=>h.delete(`${g}/employee-certifications/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.employeeCertifications}),o.success("Employee certification removed")},onError:()=>o.error("Failed to remove employee certification")})}function Nt(t){return W({queryKey:[...m.needs,t],queryFn:()=>h.get(`${g}/needs/`,{params:t}).then(s=>s.data)})}function _t(){const t=P();return w({mutationFn:s=>h.post(`${g}/needs/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.needs}),o.success("Training need created")},onError:()=>o.error("Failed to create training need")})}function St(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/needs/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.needs}),o.success("Training need updated")},onError:()=>o.error("Failed to update training need")})}function bt(){const t=P();return w({mutationFn:s=>h.delete(`${g}/needs/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.needs}),o.success("Training need deleted")},onError:()=>o.error("Failed to delete training need")})}function hi(){const t=P();return w({mutationFn:({id:s,action:a,approved_by:p})=>h.post(`${g}/needs/${s}/${a}/`,a==="approve"?{approved_by:p}:{}).then(l=>l.data),onSuccess:(s,a)=>{t.invalidateQueries({queryKey:m.needs}),t.invalidateQueries({queryKey:m.dashboard}),o.success(`Training need ${a.action==="approve"?"approved":"rejected"}`)},onError:()=>o.error("Failed to process training need")})}function Ct(t){return W({queryKey:[...m.vendors,t],queryFn:()=>h.get(`${g}/vendors/`,{params:t}).then(s=>s.data)})}function kt(){const t=P();return w({mutationFn:s=>h.post(`${g}/vendors/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.vendors}),o.success("Vendor created")},onError:()=>o.error("Failed to create vendor")})}function Pt(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/vendors/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.vendors}),o.success("Vendor updated")},onError:()=>o.error("Failed to update vendor")})}function wt(){const t=P();return w({mutationFn:s=>h.delete(`${g}/vendors/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.vendors}),o.success("Vendor deleted")},onError:()=>o.error("Failed to delete vendor")})}function Ps(t){return W({queryKey:[...m.trainers,t],queryFn:()=>h.get(`${g}/trainers/`,{params:t}).then(s=>s.data)})}function qt(){const t=P();return w({mutationFn:s=>h.post(`${g}/trainers/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.trainers}),o.success("Trainer created")},onError:()=>o.error("Failed to create trainer")})}function Ft(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/trainers/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.trainers}),o.success("Trainer updated")},onError:()=>o.error("Failed to update trainer")})}function Et(){const t=P();return w({mutationFn:s=>h.delete(`${g}/trainers/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.trainers}),o.success("Trainer deleted")},onError:()=>o.error("Failed to delete trainer")})}function ws(t){return W({queryKey:[...m.curricula,t],queryFn:()=>h.get(`${g}/curricula/`,{params:t}).then(s=>s.data)})}function At(){const t=P();return w({mutationFn:s=>h.post(`${g}/curricula/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.curricula}),o.success("Curriculum created")},onError:()=>o.error("Failed to create curriculum")})}function Dt(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/curricula/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.curricula}),o.success("Curriculum updated")},onError:()=>o.error("Failed to update curriculum")})}function Tt(){const t=P();return w({mutationFn:s=>h.delete(`${g}/curricula/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.curricula}),o.success("Curriculum deleted")},onError:()=>o.error("Failed to delete curriculum")})}function qs(t){return W({queryKey:[...m.modules,t],queryFn:()=>h.get(`${g}/curriculum-modules/`,{params:t}).then(s=>s.data)})}function Vt(){const t=P();return w({mutationFn:s=>h.post(`${g}/curriculum-modules/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.modules}),t.invalidateQueries({queryKey:m.curricula}),o.success("Module created")},onError:()=>o.error("Failed to create module")})}function Kt(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/curriculum-modules/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.modules}),t.invalidateQueries({queryKey:m.curricula}),o.success("Module updated")},onError:()=>o.error("Failed to update module")})}function $t(){const t=P();return w({mutationFn:s=>h.delete(`${g}/curriculum-modules/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.modules}),t.invalidateQueries({queryKey:m.curricula}),o.success("Module deleted")},onError:()=>o.error("Failed to delete module")})}function Lt(t){return W({queryKey:[...m.lessons,t],queryFn:()=>h.get(`${g}/lessons/`,{params:t}).then(s=>s.data)})}function Ot(){const t=P();return w({mutationFn:s=>h.post(`${g}/lessons/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.lessons}),t.invalidateQueries({queryKey:m.modules}),o.success("Lesson created")},onError:()=>o.error("Failed to create lesson")})}function Qt(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/lessons/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.lessons}),o.success("Lesson updated")},onError:()=>o.error("Failed to update lesson")})}function Mt(){const t=P();return w({mutationFn:s=>h.delete(`${g}/lessons/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.lessons}),t.invalidateQueries({queryKey:m.modules}),o.success("Lesson deleted")},onError:()=>o.error("Failed to delete lesson")})}function is(t){return W({queryKey:[...m.programs,t],queryFn:()=>h.get(`${g}/programs/`,{params:t}).then(s=>s.data)})}function gi(t){return W({queryKey:m.program(t),queryFn:()=>h.get(`${g}/programs/${t}/`).then(s=>s.data),enabled:!!t})}function It(){const t=P();return w({mutationFn:s=>h.post(`${g}/programs/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.programs}),t.invalidateQueries({queryKey:m.dashboard}),o.success("Training program created")},onError:()=>o.error("Failed to create training program")})}function Ut(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/programs/${s}/`,a).then(p=>p.data),onSuccess:(s,a)=>{t.invalidateQueries({queryKey:m.programs}),t.invalidateQueries({queryKey:m.program(a.id)}),o.success("Training program updated")},onError:()=>o.error("Failed to update training program")})}function zt(){const t=P();return w({mutationFn:s=>h.delete(`${g}/programs/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.programs}),t.invalidateQueries({queryKey:m.dashboard}),o.success("Training program deleted")},onError:()=>o.error("Failed to delete training program")})}function Rt(){const t=P();return w({mutationFn:s=>h.post(`${g}/programs/${s}/publish/`).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.programs}),t.invalidateQueries({queryKey:m.dashboard}),o.success("Program published")},onError:()=>o.error("Failed to publish program")})}function Bt(){const t=P();return w({mutationFn:s=>h.post(`${g}/programs/${s}/archive/`).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.programs}),o.success("Program archived")},onError:()=>o.error("Failed to archive program")})}function rs(t){return W({queryKey:[...m.sessions,t],queryFn:()=>h.get(`${g}/sessions/`,{params:t}).then(s=>s.data)})}function ji(t){return W({queryKey:m.session(t),queryFn:()=>h.get(`${g}/sessions/${t}/`).then(s=>s.data),enabled:!!t})}function Gt(){const t=P();return w({mutationFn:s=>h.post(`${g}/sessions/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.sessions}),t.invalidateQueries({queryKey:m.programs}),t.invalidateQueries({queryKey:m.dashboard}),o.success("Training session created")},onError:()=>o.error("Failed to create training session")})}function Yt(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/sessions/${s}/`,a).then(p=>p.data),onSuccess:(s,a)=>{t.invalidateQueries({queryKey:m.sessions}),t.invalidateQueries({queryKey:m.session(a.id)}),o.success("Training session updated")},onError:()=>o.error("Failed to update training session")})}function Ht(){const t=P();return w({mutationFn:s=>h.delete(`${g}/sessions/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.sessions}),t.invalidateQueries({queryKey:m.programs}),o.success("Training session deleted")},onError:()=>o.error("Failed to delete training session")})}function Wt(){const t=P();return w({mutationFn:s=>h.post(`${g}/sessions/${s}/start/`).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.sessions}),o.success("Session started")},onError:()=>o.error("Failed to start session")})}function Zt(){const t=P();return w({mutationFn:s=>h.post(`${g}/sessions/${s}/complete/`).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.sessions}),t.invalidateQueries({queryKey:m.programs}),o.success("Session completed")},onError:()=>o.error("Failed to complete session")})}function Jt(){const t=P();return w({mutationFn:s=>h.post(`${g}/sessions/${s}/cancel/`).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.sessions}),o.success("Session cancelled")},onError:()=>o.error("Failed to cancel session")})}function ls(t){return W({queryKey:[...m.enrollments,t],queryFn:()=>h.get(`${g}/enrollments/`,{params:t}).then(s=>s.data)})}function Xt(){const t=P();return w({mutationFn:s=>h.post(`${g}/enrollments/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.enrollments}),t.invalidateQueries({queryKey:m.sessions}),t.invalidateQueries({queryKey:m.dashboard}),o.success("Enrollment created")},onError:()=>o.error("Failed to create enrollment")})}function ea(){const t=P();return w({mutationFn:({id:s,action:a,approved_by:p,reason:l})=>h.post(`${g}/enrollments/${s}/${a}/`,a==="approve"?{approved_by:p}:{reason:l}).then(y=>y.data),onSuccess:(s,a)=>{t.invalidateQueries({queryKey:m.enrollments}),t.invalidateQueries({queryKey:m.sessions}),t.invalidateQueries({queryKey:m.dashboard}),o.success(`Enrollment ${a.action==="approve"?"approved":"rejected"}`)},onError:()=>o.error("Failed to process enrollment")})}function sa(){const t=P();return w({mutationFn:s=>h.post(`${g}/enrollments/${s}/complete/`).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.enrollments}),t.invalidateQueries({queryKey:m.dashboard}),o.success("Enrollment completed")},onError:()=>o.error("Failed to complete enrollment")})}function ta(){const t=P();return w({mutationFn:s=>h.delete(`${g}/enrollments/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.enrollments}),t.invalidateQueries({queryKey:m.sessions}),o.success("Enrollment deleted")},onError:()=>o.error("Failed to delete enrollment")})}function yi(t){return W({queryKey:[...m.attendance,t],queryFn:()=>h.get(`${g}/attendance/`,{params:t}).then(s=>s.data)})}function fi(){const t=P();return w({mutationFn:s=>h.post(`${g}/attendance/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.attendance}),t.invalidateQueries({queryKey:m.sessions}),o.success("Attendance recorded")},onError:()=>o.error("Failed to record attendance")})}function Fs(t){return W({queryKey:[...m.assessments,t],queryFn:()=>h.get(`${g}/assessments/`,{params:t}).then(s=>s.data)})}function aa(){const t=P();return w({mutationFn:s=>h.post(`${g}/assessments/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.assessments}),o.success("Assessment created")},onError:()=>o.error("Failed to create assessment")})}function na(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/assessments/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.assessments}),o.success("Assessment updated")},onError:()=>o.error("Failed to update assessment")})}function ia(){const t=P();return w({mutationFn:s=>h.delete(`${g}/assessments/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.assessments}),o.success("Assessment deleted")},onError:()=>o.error("Failed to delete assessment")})}function ra(t){return W({queryKey:[...m.attempts,t],queryFn:()=>h.get(`${g}/assessment-attempts/`,{params:t}).then(s=>s.data)})}function la(){const t=P();return w({mutationFn:s=>h.post(`${g}/assessment-attempts/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.attempts}),o.success("Assessment attempt started")},onError:()=>o.error("Failed to start assessment attempt")})}function vi(t){return W({queryKey:[...m.feedbackForms,t],queryFn:()=>h.get(`${g}/feedback-forms/`,{params:t}).then(s=>s.data)})}function Ni(){const t=P();return w({mutationFn:s=>h.post(`${g}/feedback-forms/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.feedbackForms}),o.success("Feedback form created")},onError:()=>o.error("Failed to create feedback form")})}function _i(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/feedback-forms/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.feedbackForms}),o.success("Feedback form updated")},onError:()=>o.error("Failed to update feedback form")})}function Si(){const t=P();return w({mutationFn:s=>h.delete(`${g}/feedback-forms/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.feedbackForms}),o.success("Feedback form deleted")},onError:()=>o.error("Failed to delete feedback form")})}function ca(t){return W({queryKey:[...m.feedback,t],queryFn:()=>h.get(`${g}/feedbacks/`,{params:t}).then(s=>s.data)})}function oa(){const t=P();return w({mutationFn:s=>h.post(`${g}/feedbacks/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.feedback}),o.success("Feedback submitted")},onError:()=>o.error("Failed to submit feedback")})}function da(t){return W({queryKey:[...m.behaviorAssessments,t],queryFn:()=>h.get(`${g}/behavior-assessments/`,{params:t}).then(s=>s.data)})}function ma(){const t=P();return w({mutationFn:s=>h.post(`${g}/behavior-assessments/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.behaviorAssessments}),o.success("Behavior assessment created")},onError:()=>o.error("Failed to create behavior assessment")})}function ua(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/behavior-assessments/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.behaviorAssessments}),o.success("Behavior assessment updated")},onError:()=>o.error("Failed to update behavior assessment")})}function Es(t){return W({queryKey:[...m.developmentPlans,t],queryFn:()=>h.get(`${g}/development-plans/`,{params:t}).then(s=>s.data)})}function xa(){const t=P();return w({mutationFn:s=>h.post(`${g}/development-plans/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.developmentPlans}),o.success("Development plan created")},onError:()=>o.error("Failed to create development plan")})}function pa(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/development-plans/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.developmentPlans}),o.success("Development plan updated")},onError:()=>o.error("Failed to update development plan")})}function ha(){const t=P();return w({mutationFn:s=>h.delete(`${g}/development-plans/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.developmentPlans}),o.success("Development plan deleted")},onError:()=>o.error("Failed to delete development plan")})}function ga(t){return W({queryKey:[...m.developmentActions,t],queryFn:()=>h.get(`${g}/development-actions/`,{params:t}).then(s=>s.data)})}function ja(){const t=P();return w({mutationFn:s=>h.post(`${g}/development-actions/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.developmentActions}),t.invalidateQueries({queryKey:m.developmentPlans}),o.success("Development action created")},onError:()=>o.error("Failed to create development action")})}function ya(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/development-actions/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.developmentActions}),t.invalidateQueries({queryKey:m.developmentPlans}),o.success("Development action updated")},onError:()=>o.error("Failed to update development action")})}function fa(){const t=P();return w({mutationFn:s=>h.delete(`${g}/development-actions/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.developmentActions}),t.invalidateQueries({queryKey:m.developmentPlans}),o.success("Development action deleted")},onError:()=>o.error("Failed to delete development action")})}function va(t){return W({queryKey:[...m.lmsIntegrations,t],queryFn:()=>h.get(`${g}/lms-integrations/`,{params:t}).then(s=>s.data)})}function Na(){const t=P();return w({mutationFn:s=>h.post(`${g}/lms-integrations/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.lmsIntegrations}),o.success("LMS integration created")},onError:()=>o.error("Failed to create LMS integration")})}function _a(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/lms-integrations/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.lmsIntegrations}),o.success("LMS integration updated")},onError:()=>o.error("Failed to update LMS integration")})}function Sa(){const t=P();return w({mutationFn:s=>h.delete(`${g}/lms-integrations/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.lmsIntegrations}),o.success("LMS integration deleted")},onError:()=>o.error("Failed to delete LMS integration")})}function bi(t){return W({queryKey:[...m.externalCourses,t],queryFn:()=>h.get(`${g}/external-courses/`,{params:t}).then(s=>s.data)})}function Ci(){const t=P();return w({mutationFn:s=>h.post(`${g}/external-courses/`,s).then(a=>a.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.externalCourses}),o.success("External course created")},onError:()=>o.error("Failed to create external course")})}function ki(){const t=P();return w({mutationFn:({id:s,...a})=>h.patch(`${g}/external-courses/${s}/`,a).then(p=>p.data),onSuccess:()=>{t.invalidateQueries({queryKey:m.externalCourses}),o.success("External course updated")},onError:()=>o.error("Failed to update external course")})}function Pi(){const t=P();return w({mutationFn:s=>h.delete(`${g}/external-courses/${s}/`),onSuccess:()=>{t.invalidateQueries({queryKey:m.externalCourses}),o.success("External course deleted")},onError:()=>o.error("Failed to delete external course")})}function ba(){return W({queryKey:m.dashboard,queryFn:()=>h.get(`${g}/dashboard/`).then(t=>t.data)})}const Ca={scheduled:"default",in_progress:"warning",completed:"success",cancelled:"destructive",postponed:"secondary"},ka={pending:"warning",approved:"default",rejected:"destructive",enrolled:"default",in_progress:"warning",completed:"success",dropped:"secondary",no_show:"destructive"};function wi(){var p;const t=$s(),{data:s,isLoading:a}=ba();return e.jsxs("div",{children:[e.jsx(Ge,{title:"Training Dashboard",description:"Overview of training programs, enrollments, and skill development across your organization.",actions:e.jsxs(_,{size:"sm",onClick:()=>t("/training/programs"),children:[e.jsx(He,{className:"mr-1.5 h-3.5 w-3.5"})," View Programs"]})}),e.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(He,{className:"h-4.5 w-4.5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Active Programs"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":(s==null?void 0:s.active_programs)??0})]})]})})}),e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-amber-500/10",children:e.jsx(js,{className:"h-4.5 w-4.5 text-amber-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Total Enrollments"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":(s==null?void 0:s.total_enrollments)??0})]})]})})}),e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-emerald-500/10",children:e.jsx(Gs,{className:"h-4.5 w-4.5 text-emerald-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Completion Rate"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":`${(s==null?void 0:s.completion_rate)??0}%`})]})]})})}),e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-red-500/10",children:e.jsx(ys,{className:"h-4.5 w-4.5 text-red-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Pending Needs"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":(s==null?void 0:s.pending_needs)??0})]})]})})})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-violet-500/10",children:e.jsx(fs,{className:"h-4.5 w-4.5 text-violet-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Upcoming Sessions"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":(s==null?void 0:s.upcoming_sessions)??0})]})]})})}),e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-yellow-500/10",children:e.jsx(Ys,{className:"h-4.5 w-4.5 text-yellow-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Avg Feedback"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":((p=s==null?void 0:s.avg_feedback_rating)==null?void 0:p.toFixed(1))??"0.0"})]})]})})}),e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-orange-500/10",children:e.jsx(ss,{className:"h-4.5 w-4.5 text-orange-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Expiring Certs"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":(s==null?void 0:s.expiring_certifications)??0})]})]})})}),e.jsx(Fe,{children:e.jsx(Ee,{className:"pt-5 pb-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/10",children:e.jsx(He,{className:"h-4.5 w-4.5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wider",children:"Total Programs"}),e.jsx("p",{className:"text-[22px] font-semibold text-slate-900 leading-tight",children:a?"...":(s==null?void 0:s.total_programs)??0})]})]})})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs(Fe,{children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Qe,{className:"text-[14px]",children:"Upcoming Sessions"}),e.jsxs(_,{variant:"ghost",size:"sm",className:"h-7 text-[12px] gap-1",onClick:()=>t("/training/sessions"),children:["View all ",e.jsx(cs,{className:"h-3 w-3"})]})]})}),e.jsx(Ee,{children:a?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(l=>e.jsx("div",{className:"h-14 rounded-lg skeleton-shimmer"},l))}):((s==null?void 0:s.upcoming_session_list)??[]).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Os,{className:"h-8 w-8 text-slate-300 mb-2"}),e.jsx("p",{className:"text-[13px] text-slate-500",children:"No upcoming sessions"})]}):e.jsx("ul",{className:"space-y-2",children:((s==null?void 0:s.upcoming_session_list)??[]).slice(0,5).map(l=>e.jsxs("li",{className:"flex items-center justify-between rounded-lg border border-slate-100 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13px] font-medium text-slate-800 truncate",children:l.name}),e.jsxs("p",{className:"text-[11px] text-slate-400 mt-0.5",children:[l.program_name," · ",new Date(l.session_date).toLocaleDateString("en-GB",{day:"numeric",month:"short"})]})]}),e.jsx(Z,{variant:Ca[l.status]??"secondary",className:"ml-2 text-[11px]",children:l.status.replace("_"," ")})]},l.id))})})]}),e.jsxs(Fe,{children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Qe,{className:"text-[14px]",children:"Recent Completions"}),e.jsxs(_,{variant:"ghost",size:"sm",className:"h-7 text-[12px] gap-1",onClick:()=>t("/training/enrollments"),children:["View all ",e.jsx(cs,{className:"h-3 w-3"})]})]})}),e.jsx(Ee,{children:a?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(l=>e.jsx("div",{className:"h-14 rounded-lg skeleton-shimmer"},l))}):((s==null?void 0:s.recent_completions)??[]).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(ss,{className:"h-8 w-8 text-slate-300 mb-2"}),e.jsx("p",{className:"text-[13px] text-slate-500",children:"No recent completions"})]}):e.jsx("ul",{className:"space-y-2",children:((s==null?void 0:s.recent_completions)??[]).slice(0,5).map(l=>e.jsxs("li",{className:"flex items-center justify-between rounded-lg border border-slate-100 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13px] font-medium text-slate-800 truncate",children:l.employee_name}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("p",{className:"text-[11px] text-slate-400 truncate",children:l.program_name}),l.score!==null&&e.jsxs("span",{className:"text-[11px] text-slate-500 font-medium",children:["Score: ",l.score,"%"]})]})]}),e.jsx(Z,{variant:ka[l.status]??"secondary",className:"ml-2 text-[11px]",children:l.status.replace("_"," ")})]},l.id))})})]})]})]})}const ds=[{value:"technical",label:"Technical"},{value:"soft_skills",label:"Soft Skills"},{value:"compliance",label:"Compliance"},{value:"leadership",label:"Leadership"},{value:"safety",label:"Safety"},{value:"product",label:"Product"},{value:"process",label:"Process"},{value:"onboarding",label:"Onboarding"}],Pa=[{value:"classroom",label:"Classroom"},{value:"virtual",label:"Virtual"},{value:"self_paced",label:"Self-Paced"},{value:"on_the_job",label:"On the Job"},{value:"blended",label:"Blended"}],wa=ne({name:q().min(1,"Name is required"),code:q().min(1,"Code is required"),description:q().optional(),category:De(["technical","soft_skills","compliance","leadership","safety","product","process","onboarding"]),delivery_mode:De(["classroom","virtual","self_paced","on_the_job","blended"]),max_participants:Ve.number().int().positive().optional().or(Ze("")),budget_per_session:q().optional()});function qi(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),[v,D]=C.useState(""),[E,T]=C.useState(""),{hasPermission:O,requirePermission:U}=ie(),I=O("training","program","create"),Q=O("training","program","update"),z=O("training","program","delete"),{pagination:A,setPagination:G,sorting:K,setSorting:N,globalFilter:S,setGlobalFilter:R,queryParams:f}=xe(),L={...f,...v&&{is_active:v},...E&&{category:E}},{data:d,isLoading:V}=is(L),k=It(),i=Ut(),H=zt(),n=Rt(),j=Bt(),c=te({resolver:ae(wa),defaultValues:{category:"technical",delivery_mode:"classroom"}});function r(){U("training","program","create")&&(p(null),c.reset({category:"technical",delivery_mode:"classroom",name:"",code:"",description:""}),s(!0))}function M(x){U("training","program","update")&&(p(x),c.reset({name:x.name,code:x.code,description:x.description,category:x.category,delivery_mode:x.delivery_mode,max_participants:x.max_participants??void 0,budget_per_session:x.budget_per_session??""}),s(!0))}function $e(x){const Te={...x,max_participants:x.max_participants?Number(x.max_participants):void 0};a?i.mutate({id:a.id,...Te},{onSuccess:()=>{s(!1),c.reset()}}):k.mutate(Te,{onSuccess:()=>{s(!1),c.reset()}})}function Ie(x){D(x==="__all__"?"":x),G(Te=>({...Te,pageIndex:0}))}function b(x){T(x==="__all__"?"":x),G(Te=>({...Te,pageIndex:0}))}const Ue=[{key:"name",header:"Program",render:x=>e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:x.name}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:x.code})]})},{key:"category",header:"Category",className:"w-28",render:x=>e.jsx(Z,{variant:"outline",className:"text-[11px] capitalize",children:x.category.replace("_"," ")})},{key:"delivery_mode",header:"Mode",className:"w-24",render:x=>e.jsx("span",{className:"text-[12px] text-slate-600 capitalize",children:x.delivery_mode.replace("_"," ")})},{key:"is_active",header:"Status",className:"w-28",render:x=>e.jsx(Z,{variant:x.is_active?"success":"secondary",className:"text-[11px]",children:x.is_active?"Active":"Inactive"})},{key:"session_count",header:"Sessions",className:"w-24",render:x=>e.jsx("span",{className:"text-[12px] text-slate-600",children:x.session_count})},{key:"actions",header:"",className:"w-10",render:x=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[Q&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>M(x),children:"Edit"}),Q&&!x.is_active&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>n.mutate(x.id),children:[e.jsx(Hs,{className:"h-3.5 w-3.5 text-slate-400"}),"Publish"]}),Q&&x.is_active&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>j.mutate(x.id),children:[e.jsx(tt,{className:"h-3.5 w-3.5 text-slate-400"}),"Archive"]}),Q&&z&&e.jsx(Pe,{}),z&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(x),children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsx(Ge,{title:"Training Programs",description:"Create and manage training programs for your organization.",actions:I&&e.jsxs(_,{size:"sm",onClick:r,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Program"]})}),e.jsx(pe,{actions:e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(J,{value:v,onValueChange:Ie,children:[e.jsx(X,{className:"w-[140px] h-9",children:e.jsx(ee,{placeholder:"All statuses"})}),e.jsxs(se,{children:[e.jsx(B,{value:"__all__",children:"All Statuses"}),e.jsx(B,{value:"true",children:"Active"}),e.jsx(B,{value:"false",children:"Inactive"})]})]}),e.jsxs(J,{value:E,onValueChange:b,children:[e.jsx(X,{className:"w-[140px] h-9",children:e.jsx(ee,{placeholder:"All categories"})}),e.jsxs(se,{children:[e.jsx(B,{value:"__all__",children:"All Categories"}),ds.map(x=>e.jsx(B,{value:x.value,children:x.label},x.value))]})]})]}),columns:Ue,data:(d==null?void 0:d.results)??[],isLoading:V,rowKey:x=>x.id,searchKeys:["name","code"],searchPlaceholder:"Search programs...",emptyMessage:"No training programs found",emptyDescription:"Create your first training program to get started.",totalCount:(d==null?void 0:d.count)??0,pagination:A,onPaginationChange:G,sorting:K,onSortingChange:N,globalFilter:S,onGlobalFilterChange:R}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Program":"New Program"}),e.jsx(me,{children:a?"Update program details.":"Create a new training program."})]}),e.jsxs("form",{onSubmit:c.handleSubmit($e),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Program Name *"}),e.jsx($,{className:"mt-1.5",...c.register("name"),placeholder:"e.g. Leadership Development 2026"}),c.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:c.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx($,{className:"mt-1.5",...c.register("code"),placeholder:"e.g. TRN-LD-001"}),c.formState.errors.code&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:c.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Description"}),e.jsx(Ke,{className:"mt-1.5",...c.register("description"),rows:3,placeholder:"Program objectives and scope..."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Category *"}),e.jsxs(J,{value:c.watch("category"),onValueChange:x=>c.setValue("category",x),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:ds.map(x=>e.jsx(B,{value:x.value,children:x.label},x.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Mode *"}),e.jsxs(J,{value:c.watch("delivery_mode"),onValueChange:x=>c.setValue("delivery_mode",x),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:Pa.map(x=>e.jsx(B,{value:x.value,children:x.label},x.value))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Max Participants"}),e.jsx($,{className:"mt-1.5",type:"number",...c.register("max_participants"),placeholder:"e.g. 30"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Budget Per Session"}),e.jsx($,{className:"mt-1.5",...c.register("budget_per_session"),placeholder:"e.g. 50000.00"})]})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:c.handleSubmit($e),disabled:k.isPending||i.isPending,children:k.isPending||i.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:x=>!x&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Program"}),e.jsxs(ve,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{U("training","program","delete")&&(l&&H.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const qa={scheduled:"default",enrollment_open:"default",enrollment_closed:"secondary",in_progress:"warning",completed:"success",cancelled:"destructive",postponed:"secondary"},Fa=[{value:"in_person",label:"In Person"},{value:"virtual",label:"Virtual"},{value:"hybrid",label:"Hybrid"}],Ea=Ws(ne({program:q().min(1,"Program is required"),session_code:q().min(1,"Session code is required"),batch_name:q().min(1,"Name is required"),start_date:os("Start date is required"),end_date:os("End date is required"),start_time:q().optional(),end_time:q().optional(),venue:q().optional(),mode:De(["in_person","virtual","hybrid"]).optional(),max_participants:Ve.number().int().positive().optional().or(Ze("")),notes:q().optional()}),"start_date","end_date");function Fi(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),[v,D]=C.useState(""),{hasPermission:E,requirePermission:T}=ie(),O=E("training","session","create"),U=E("training","session","update"),I=E("training","session","delete"),{pagination:Q,setPagination:z,sorting:A,setSorting:G,globalFilter:K,setGlobalFilter:N,queryParams:S}=xe(),R={...S,...v&&{status:v}},{data:f,isLoading:L}=rs(R),d=Gt(),V=Yt(),k=Ht(),i=Wt(),H=Zt(),n=Jt(),[j,c]=C.useState(""),{data:r,isLoading:M}=is({page_size:100,search:j||void 0}),$e=(r==null?void 0:r.results)??[],{data:Ie}=Ps({page_size:100}),b=te({resolver:ae(Ea)});function Ue(){T("training","session","create")&&(p(null),b.reset({program:"",session_code:"",batch_name:"",start_date:"",end_date:"",start_time:"",end_time:""}),s(!0))}function x(F){T("training","session","update")&&(p(F),b.reset({program:F.program,session_code:F.session_code,batch_name:F.batch_name,start_date:F.start_date,end_date:F.end_date,start_time:F.start_time??"",end_time:F.end_time??"",venue:F.venue,mode:F.mode,max_participants:F.max_participants??void 0,notes:F.notes}),s(!0))}function Te(F){const Xe={...F,max_participants:F.max_participants?Number(F.max_participants):void 0};a?V.mutate({id:a.id,...Xe},{onSuccess:()=>{s(!1),b.reset()}}):d.mutate(Xe,{onSuccess:()=>{s(!1),b.reset()}})}function As(F){D(F==="__all__"?"":F),z(Xe=>({...Xe,pageIndex:0}))}const Ds=[{key:"batch_name",header:"Session",render:F=>e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:F.batch_name||F.session_code}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:F.program_name})]})},{key:"start_date",header:"Date",className:"w-36",render:F=>e.jsxs("span",{className:"text-[12px] text-slate-600",children:[new Date(F.start_date).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}),F.end_date&&F.end_date!==F.start_date?` - ${new Date(F.end_date).toLocaleDateString("en-GB",{day:"numeric",month:"short"})}`:""]})},{key:"time",header:"Time",className:"w-32",render:F=>e.jsxs("span",{className:"text-[12px] text-slate-500",children:[F.start_time," - ",F.end_time]})},{key:"trainer_name",header:"Trainer",className:"w-36",render:F=>e.jsx("span",{className:"text-[12px] text-slate-600",children:F.trainer_name??"--"})},{key:"mode",header:"Mode",className:"w-24",render:F=>e.jsx("span",{className:"text-[12px] text-slate-600 capitalize",children:F.mode.replace("_"," ")})},{key:"enrolled",header:"Enrolled",className:"w-24",render:F=>e.jsxs("span",{className:"text-[12px] text-slate-600",children:[F.current_enrollment,F.max_participants?` / ${F.max_participants}`:""]})},{key:"status",header:"Status",className:"w-28",render:F=>e.jsx(Z,{variant:qa[F.status],className:"text-[11px]",children:F.status.replace("_"," ")})},{key:"actions",header:"",className:"w-10",render:F=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[U&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>x(F),children:"Edit"}),U&&F.status==="scheduled"&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>i.mutate(F.id),children:[e.jsx(Js,{className:"h-3.5 w-3.5 text-slate-400"}),"Start"]}),U&&F.status==="in_progress"&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>H.mutate(F.id),children:[e.jsx(bs,{className:"h-3.5 w-3.5 text-slate-400"}),"Complete"]}),U&&(F.status==="scheduled"||F.status==="postponed")&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>n.mutate(F.id),children:[e.jsx(Cs,{className:"h-3.5 w-3.5 text-slate-400"}),"Cancel"]}),U&&I&&e.jsx(Pe,{}),I&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(F),children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsx(Ge,{title:"Training Sessions",description:"Schedule and manage training sessions across programs.",actions:O&&e.jsxs(_,{size:"sm",onClick:Ue,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Session"]})}),e.jsx(pe,{actions:e.jsxs(J,{value:v,onValueChange:As,children:[e.jsx(X,{className:"w-[140px] h-9",children:e.jsx(ee,{placeholder:"All statuses"})}),e.jsxs(se,{children:[e.jsx(B,{value:"__all__",children:"All Statuses"}),e.jsx(B,{value:"scheduled",children:"Scheduled"}),e.jsx(B,{value:"enrollment_open",children:"Enrollment Open"}),e.jsx(B,{value:"enrollment_closed",children:"Enrollment Closed"}),e.jsx(B,{value:"in_progress",children:"In Progress"}),e.jsx(B,{value:"completed",children:"Completed"}),e.jsx(B,{value:"cancelled",children:"Cancelled"}),e.jsx(B,{value:"postponed",children:"Postponed"})]})]}),columns:Ds,data:(f==null?void 0:f.results)??[],isLoading:L,rowKey:F=>F.id,searchKeys:["batch_name","session_code","program_name","trainer_name"],searchPlaceholder:"Search sessions...",emptyMessage:"No training sessions found",emptyDescription:"Create your first training session to get started.",totalCount:(f==null?void 0:f.count)??0,pagination:Q,onPaginationChange:z,sorting:A,onSortingChange:G,globalFilter:K,onGlobalFilterChange:N}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Session":"New Session"}),e.jsx(me,{children:a?"Update session details.":"Schedule a new training session."})]}),e.jsxs("form",{onSubmit:b.handleSubmit(Te),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Program *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Le,{value:b.watch("program")??null,onValueChange:F=>b.setValue("program",F,{shouldValidate:!0}),onSearch:c,isLoading:M,selectedLabel:a==null?void 0:a.program_name,options:$e.map(F=>({value:F.id,label:F.name})),placeholder:"Select program",searchPlaceholder:"Search programs..."})}),b.formState.errors.program&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:b.formState.errors.program.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Session Code *"}),e.jsx($,{className:"mt-1.5",...b.register("session_code"),placeholder:"e.g. SES-001"}),b.formState.errors.session_code&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:b.formState.errors.session_code.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Batch Name *"}),e.jsx($,{className:"mt-1.5",...b.register("batch_name"),placeholder:"e.g. Batch A - Introduction"}),b.formState.errors.batch_name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:b.formState.errors.batch_name.message})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Start Date *"}),e.jsx($,{className:"mt-1.5",type:"date",...b.register("start_date"),max:b.watch("end_date")||void 0}),b.formState.errors.start_date&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:b.formState.errors.start_date.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"End Date *"}),e.jsx($,{className:"mt-1.5",type:"date",...b.register("end_date"),min:b.watch("start_date")||void 0}),b.formState.errors.end_date&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:b.formState.errors.end_date.message})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Start Time"}),e.jsx($,{className:"mt-1.5",type:"time",...b.register("start_time")})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"End Time"}),e.jsx($,{className:"mt-1.5",type:"time",...b.register("end_time")})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Venue"}),e.jsx($,{className:"mt-1.5",...b.register("venue"),placeholder:"e.g. Conference Room A / Zoom link"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Mode"}),e.jsxs(J,{value:b.watch("mode"),onValueChange:F=>b.setValue("mode",F),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{placeholder:"Select mode"})}),e.jsx(se,{children:Fa.map(F=>e.jsx(B,{value:F.value,children:F.label},F.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Max Participants"}),e.jsx($,{className:"mt-1.5",type:"number",...b.register("max_participants"),placeholder:"e.g. 25"})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Notes"}),e.jsx(Ke,{className:"mt-1.5",...b.register("notes"),rows:3,placeholder:"Any additional notes..."})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:b.handleSubmit(Te),disabled:d.isPending||V.isPending,children:d.isPending||V.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:F=>!F&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Session"}),e.jsxs(ve,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium text-slate-700",children:(l==null?void 0:l.batch_name)||(l==null?void 0:l.session_code)}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{T("training","session","delete")&&(l&&k.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Aa={enrolled:"default",waitlisted:"warning",confirmed:"success",attended:"success",completed:"success",no_show:"destructive",cancelled:"destructive",withdrawn:"secondary"},Da=ne({employee:q().min(1,"Employee is required"),session:q().min(1,"Session is required")});function Ei(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(""),{hasPermission:v,requirePermission:D}=ie(),E=v("training","enrollment","create"),T=v("training","enrollment","update"),O=v("training","enrollment","approve"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),N={...K,...l&&{status:l}},{data:S,isLoading:R}=ls(N),f=Xt(),L=ea(),d=sa(),V=ta(),[k,i]=C.useState(""),{data:H,isLoading:n}=rs({page_size:100,search:k||void 0}),j=(H==null?void 0:H.results)??[],c=te({resolver:ae(Da)});function r(){D("training","enrollment","create")&&(c.reset({employee:"",session:""}),s(!0))}function M(b){f.mutate(b,{onSuccess:()=>{s(!1),c.reset()}})}function $e(b){y(b==="__all__"?"":b),I(Ue=>({...Ue,pageIndex:0}))}const Ie=[{key:"employee_name",header:"Employee",render:b=>e.jsx("p",{className:"font-medium text-slate-900",children:b.employee_name})},{key:"session_code",header:"Session",render:b=>e.jsx("span",{className:"text-[12px] text-slate-600",children:b.session_code})},{key:"program_name",header:"Program",render:b=>e.jsx("span",{className:"text-[12px] text-slate-600",children:b.program_name})},{key:"enrollment_date",header:"Enrollment Date",className:"w-32",render:b=>e.jsx("span",{className:"text-[12px] text-slate-500",children:new Date(b.enrollment_date).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})})},{key:"status",header:"Status",className:"w-28",render:b=>e.jsx(Z,{variant:Aa[b.status],className:"text-[11px]",children:b.status.replace("_"," ")})},{key:"post_assessment_score",header:"Score",className:"w-20",render:b=>e.jsx("span",{className:"text-[12px] text-slate-600",children:b.post_assessment_score??"--"})},{key:"actions",header:"",className:"w-10",render:b=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[O&&b.manager_approval_status==="pending"&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>L.mutate({id:b.id,action:"approve"}),children:[e.jsx(Qs,{className:"h-3.5 w-3.5 text-slate-400"}),"Approve"]}),O&&b.manager_approval_status==="pending"&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>L.mutate({id:b.id,action:"reject"}),children:[e.jsx(Cs,{className:"h-3.5 w-3.5 text-slate-400"}),"Reject"]}),T&&(b.status==="attended"||b.status==="confirmed")&&e.jsxs(Y,{className:"gap-2 text-[13px]",onClick:()=>d.mutate(b.id),children:[e.jsx(bs,{className:"h-3.5 w-3.5 text-slate-400"}),"Complete"]}),T&&e.jsx(Pe,{}),T&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>p(b),children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsx(Ge,{title:"Enrollments",description:"Manage employee enrollments across training sessions.",actions:E&&e.jsxs(_,{size:"sm",onClick:r,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Enrollment"]})}),e.jsx(pe,{actions:e.jsxs(J,{value:l,onValueChange:$e,children:[e.jsx(X,{className:"w-[140px] h-9",children:e.jsx(ee,{placeholder:"All statuses"})}),e.jsxs(se,{children:[e.jsx(B,{value:"__all__",children:"All Statuses"}),e.jsx(B,{value:"enrolled",children:"Enrolled"}),e.jsx(B,{value:"waitlisted",children:"Waitlisted"}),e.jsx(B,{value:"confirmed",children:"Confirmed"}),e.jsx(B,{value:"attended",children:"Attended"}),e.jsx(B,{value:"completed",children:"Completed"}),e.jsx(B,{value:"no_show",children:"No Show"}),e.jsx(B,{value:"cancelled",children:"Cancelled"}),e.jsx(B,{value:"withdrawn",children:"Withdrawn"})]})]}),columns:Ie,data:(S==null?void 0:S.results)??[],isLoading:R,rowKey:b=>b.id,searchKeys:["employee_name","program_name","session_code"],searchPlaceholder:"Search enrollments...",emptyMessage:"No enrollments found",emptyDescription:"Create your first enrollment to get started.",totalCount:(S==null?void 0:S.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:"New Enrollment"}),e.jsx(me,{children:"Enroll an employee in a training session."})]}),e.jsxs("form",{onSubmit:c.handleSubmit(M),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Je,{value:c.watch("employee"),onValueChange:b=>c.setValue("employee",b,{shouldValidate:!0})})}),c.formState.errors.employee&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:c.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Session *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Le,{value:c.watch("session")??null,onValueChange:b=>c.setValue("session",b,{shouldValidate:!0}),onSearch:i,isLoading:n,options:j.map(b=>({value:b.id,label:b.batch_name||b.session_code,hint:b.session_code})),placeholder:"Select session",searchPlaceholder:"Search sessions..."})}),c.formState.errors.session&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:c.formState.errors.session.message})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:c.handleSubmit(M),disabled:f.isPending,children:f.isPending?"Saving...":"Create"})]})]})}),e.jsx(he,{open:!!a,onOpenChange:b=>!b&&p(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Enrollment"}),e.jsxs(ve,{children:["Are you sure you want to delete the enrollment for"," ",e.jsx("span",{className:"font-medium text-slate-700",children:a==null?void 0:a.employee_name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>p(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","enrollment","update")&&(a&&V.mutate(a.id),p(null))},children:"Delete"})]})]})})]})}const ms=[{value:"technical",label:"Technical"},{value:"functional",label:"Functional"},{value:"behavioral",label:"Behavioral"},{value:"leadership",label:"Leadership"},{value:"domain",label:"Domain"}],Ta=ne({name:q().min(1,"Name is required"),code:q().min(1,"Code is required"),category:De(["technical","functional","behavioral","leadership","domain"]),parent:q().optional(),description:q().optional(),is_active:Ae().default(!0)});function Ai(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),[v,D]=C.useState(""),{hasPermission:E,requirePermission:T}=ie(),O=E("training","skill","create"),U=E("training","skill","update"),I=E("training","skill","delete"),{pagination:Q,setPagination:z,sorting:A,setSorting:G,globalFilter:K,setGlobalFilter:N,queryParams:S}=xe(),R={...S,...v&&{category:v}},{data:f,isLoading:L}=ts(R),[d,V]=C.useState(""),{data:k,isLoading:i}=ts({page_size:100,search:d||void 0}),H=(k==null?void 0:k.results)??[],n=dt(),j=mt(),c=ut(),r=te({resolver:ae(Ta),defaultValues:{category:"technical",is_active:!0}});function M(){T("training","skill","create")&&(p(null),r.reset({name:"",code:"",category:"technical",parent:"",description:"",is_active:!0}),s(!0))}function $e(x){T("training","skill","update")&&(p(x),r.reset({name:x.name,code:x.code,category:x.category,parent:x.parent??"",description:x.description,is_active:x.is_active}),s(!0))}function Ie(x){const Te={...x,parent:x.parent||void 0};a?j.mutate({id:a.id,...Te},{onSuccess:()=>{s(!1),r.reset()}}):n.mutate(Te,{onSuccess:()=>{s(!1),r.reset()}})}function b(x){D(x==="__all__"?"":x),z(Te=>({...Te,pageIndex:0}))}const Ue=[{key:"name",header:"Skill",render:x=>e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:x.name}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:x.code})]})},{key:"category",header:"Category",className:"w-28",render:x=>e.jsx(Z,{variant:"outline",className:"text-[11px] capitalize",children:x.category.replace("_"," ")})},{key:"parent_name",header:"Parent",className:"w-36",render:x=>e.jsx("span",{className:"text-[12px] text-slate-600",children:x.parent_name??"--"})},{key:"is_active",header:"Status",className:"w-24",render:x=>e.jsx(Re,{status:x.is_active?"active":"inactive"})},{key:"children_count",header:"Children",className:"w-24",render:x=>e.jsx("span",{className:"text-[12px] text-slate-600",children:x.children_count})},{key:"actions",header:"",className:"w-10",render:x=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[U&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>$e(x),children:"Edit"}),U&&I&&e.jsx(Pe,{}),I&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(x),children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsx(Ge,{title:"Skill Taxonomy",description:"Define and organize skills used across your training programs.",actions:O&&e.jsxs(_,{size:"sm",onClick:M,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Skill"]})}),e.jsx(pe,{actions:e.jsxs(J,{value:v,onValueChange:b,children:[e.jsx(X,{className:"w-[140px] h-9",children:e.jsx(ee,{placeholder:"All categories"})}),e.jsxs(se,{children:[e.jsx(B,{value:"__all__",children:"All Categories"}),ms.map(x=>e.jsx(B,{value:x.value,children:x.label},x.value))]})]}),columns:Ue,data:(f==null?void 0:f.results)??[],isLoading:L,rowKey:x=>x.id,searchKeys:["name","code"],searchPlaceholder:"Search skills...",emptyMessage:"No skills found",emptyDescription:"Create your first skill to get started.",totalCount:(f==null?void 0:f.count)??0,pagination:Q,onPaginationChange:z,sorting:A,onSortingChange:G,globalFilter:K,onGlobalFilterChange:N}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Skill":"New Skill"}),e.jsx(me,{children:a?"Update skill details.":"Create a new skill in the taxonomy."})]}),e.jsxs("form",{onSubmit:r.handleSubmit(Ie),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...r.register("name"),placeholder:"e.g. React.js"}),r.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:r.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx($,{className:"mt-1.5",...r.register("code"),placeholder:"e.g. SKL-REACT"}),r.formState.errors.code&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:r.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Category *"}),e.jsxs(J,{value:r.watch("category"),onValueChange:x=>r.setValue("category",x),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:ms.map(x=>e.jsx(B,{value:x.value,children:x.label},x.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Parent Skill"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Le,{value:r.watch("parent")??"",onValueChange:x=>r.setValue("parent",x==="__none__"?"":x),onSearch:V,isLoading:i,selectedLabel:r.watch("parent")&&(a==null?void 0:a.parent_name)||void 0,options:[{value:"__none__",label:"None"},...H.filter(x=>x.id!==(a==null?void 0:a.id)).map(x=>({value:x.id,label:x.name,hint:x.code}))],placeholder:"Select parent skill",searchPlaceholder:"Search skills..."})})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Description"}),e.jsx(Ke,{className:"mt-1.5",...r.register("description"),rows:3,placeholder:"Skill description..."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ze,{checked:r.watch("is_active"),onCheckedChange:x=>r.setValue("is_active",x)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Active"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:r.handleSubmit(Ie),disabled:n.isPending||j.isPending,children:n.isPending||j.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:x=>!x&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Skill"}),e.jsxs(ve,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{T("training","skill","delete")&&(l&&c.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Va={1:"Beginner",2:"Basic",3:"Intermediate",4:"Advanced",5:"Expert"},Ka={1:"secondary",2:"secondary",3:"default",4:"warning",5:"success"},$a={technical:"default",functional:"secondary",behavioral:"warning",leadership:"warning",domain:"success"},La=[{value:1,label:"Beginner"},{value:2,label:"Basic"},{value:3,label:"Intermediate"},{value:4,label:"Advanced"},{value:5,label:"Expert"}],Oa=ne({employee:q().min(1,"Employee is required"),skill:q().min(1,"Skill is required"),proficiency_level:Ve.number().min(1),years_of_experience:q().optional()});function Di(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","employee_skill","create"),T=v("training","employee_skill","update"),{pagination:O,setPagination:U,sorting:I,setSorting:Q,globalFilter:z,setGlobalFilter:A,queryParams:G}=xe(),{data:K,isLoading:N}=xt(G),[S,R]=C.useState(""),{data:f}=ts({search:S||void 0}),L=pt(),d=ht(),V=gt(),k=te({resolver:ae(Oa),defaultValues:{proficiency_level:1}});function i(){D("training","employee_skill","create")&&(p(null),k.reset({employee:"",skill:"",proficiency_level:1,years_of_experience:void 0}),s(!0))}function H(c){D("training","employee_skill","update")&&(p(c),k.reset({employee:c.employee,skill:c.skill,proficiency_level:c.proficiency_level,years_of_experience:c.years_of_experience}),s(!0))}function n(c){a?d.mutate({id:a.id,...c},{onSuccess:()=>{s(!1),k.reset()}}):L.mutate(c,{onSuccess:()=>{s(!1),k.reset()}})}const j=[{key:"employee_name",header:"Employee",render:c=>e.jsx("p",{className:"font-medium text-slate-900",children:c.employee_name})},{key:"skill_name",header:"Skill",render:c=>e.jsx("span",{className:"text-[12px] text-slate-600",children:c.skill_name})},{key:"skill_category",header:"Category",className:"w-28",render:c=>e.jsx(Z,{variant:$a[c.skill_category]??"outline",className:"text-[11px] capitalize",children:c.skill_category})},{key:"proficiency_level",header:"Proficiency",className:"w-28",render:c=>e.jsx(Z,{variant:Ka[c.proficiency_level]??"secondary",className:"text-[11px] capitalize",children:Va[c.proficiency_level]??c.proficiency_level})},{key:"years_of_experience",header:"Years Exp",className:"w-24",render:c=>e.jsx("span",{className:"text-[12px] text-slate-600",children:c.years_of_experience})},{key:"endorsements_count",header:"Endorsements",className:"w-28",render:c=>e.jsx("span",{className:"text-[12px] text-slate-600",children:c.endorsements_count})},{key:"assessed_date",header:"Last Assessed",className:"w-28",render:c=>e.jsx("span",{className:"text-[12px] text-slate-400",children:c.assessed_date?new Date(c.assessed_date).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"--"})},{key:"actions",header:"",className:"w-10",render:c=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>H(c),children:"Edit"}),T&&e.jsx(Pe,{}),T&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(c),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(_s,{className:"h-5 w-5 text-primary"})," Employee Skills"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage employee skill assignments and proficiency levels"})]}),E&&e.jsxs(_,{size:"sm",onClick:i,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," Add Skill"]})]}),e.jsx(pe,{columns:j,data:(K==null?void 0:K.results)??[],isLoading:N,rowKey:c=>c.id,searchKeys:["employee_name","skill_name"],searchPlaceholder:"Search employee skills...",emptyMessage:"No employee skills found",emptyDescription:"Assign your first employee skill to get started.",totalCount:(K==null?void 0:K.count)??0,pagination:O,onPaginationChange:U,sorting:I,onSortingChange:Q,globalFilter:z,onGlobalFilterChange:A}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Employee Skill":"Add Employee Skill"}),e.jsx(me,{children:a?"Update skill assignment.":"Assign a skill to an employee."})]}),e.jsxs("form",{onSubmit:k.handleSubmit(n),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx(Je,{className:"mt-1.5",value:k.watch("employee")??"",onValueChange:c=>k.setValue("employee",c,{shouldValidate:!0}),placeholder:"Select employee"}),k.formState.errors.employee&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:k.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Skill *"}),e.jsx(Le,{className:"mt-1.5",value:k.watch("skill")??null,onValueChange:c=>k.setValue("skill",c,{shouldValidate:!0}),onSearch:R,selectedLabel:a==null?void 0:a.skill_name,options:((f==null?void 0:f.results)??[]).map(c=>({value:c.id,label:c.name,hint:c.code})),placeholder:"Select skill",searchPlaceholder:"Search skills..."}),k.formState.errors.skill&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:k.formState.errors.skill.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Proficiency Level *"}),e.jsxs(J,{value:String(k.watch("proficiency_level")),onValueChange:c=>k.setValue("proficiency_level",Number(c)),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:La.map(c=>e.jsx(B,{value:String(c.value),children:c.label},c.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Years of Experience"}),e.jsx($,{className:"mt-1.5",...k.register("years_of_experience"),placeholder:"e.g. 3"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:k.handleSubmit(n),disabled:L.isPending||d.isPending,children:L.isPending||d.isPending?"Saving...":a?"Update":"Add"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:c=>!c&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Remove Employee Skill"}),e.jsxs(ve,{children:["Are you sure you want to remove ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.skill_name})," from ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.employee_name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","employee_skill","update")&&(l&&V.mutate(l.id),y(null))},children:"Remove"})]})]})})]})}const Qa=ne({name:q().min(1,"Name is required"),code:q().min(1,"Code is required"),issuing_body:q().min(1,"Issuing body is required"),validity_months:Ve.number().int().positive().optional().or(Ze("")),is_mandatory:Ae(),is_active:Ae()});function Ti(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","certification","create"),T=v("training","certification","update"),O=v("training","certification","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=jt(K),R=yt(),f=ft(),L=vt(),d=te({resolver:ae(Qa),defaultValues:{is_mandatory:!1,is_active:!0}});function V(){D("training","certification","create")&&(p(null),d.reset({name:"",code:"",issuing_body:"",validity_months:"",is_mandatory:!1,is_active:!0}),s(!0))}function k(n){D("training","certification","update")&&(p(n),d.reset({name:n.name,code:n.code,issuing_body:n.issuing_body,validity_months:n.validity_months??"",is_mandatory:n.is_mandatory,is_active:n.is_active}),s(!0))}function i(n){const j={...n,validity_months:n.validity_months?Number(n.validity_months):void 0};a?f.mutate({id:a.id,...j},{onSuccess:()=>{s(!1),d.reset()}}):R.mutate(j,{onSuccess:()=>{s(!1),d.reset()}})}const H=[{key:"name",header:"Name",render:n=>e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:n.name}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:n.code})]})},{key:"issuing_body",header:"Issuing Body",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.issuing_body})},{key:"validity_months",header:"Validity (months)",className:"w-32",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.validity_months??"Lifetime"})},{key:"is_mandatory",header:"Mandatory",className:"w-28",render:n=>e.jsx(Z,{variant:n.is_mandatory?"warning":"secondary",children:n.is_mandatory?"Yes":"No"})},{key:"is_active",header:"Active",className:"w-24",render:n=>e.jsx(Re,{status:n.is_active?"active":"inactive"})},{key:"created_at",header:"Created",className:"w-28",render:n=>e.jsx("span",{className:"text-[12px] text-slate-400",children:new Date(n.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>k(n),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(n),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(ks,{className:"h-5 w-5 text-primary"})," Certifications"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Define and manage professional certifications"})]}),E&&e.jsxs(_,{size:"sm",onClick:V,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Certification"]})]}),e.jsx(pe,{columns:H,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:n=>n.id,searchKeys:["name","code","issuing_body"],searchPlaceholder:"Search certifications...",emptyMessage:"No certifications found",emptyDescription:"Define your first certification to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Certification":"New Certification"}),e.jsx(me,{children:a?"Update certification details.":"Define a new certification."})]}),e.jsxs("form",{onSubmit:d.handleSubmit(i),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...d.register("name"),placeholder:"Certification name"}),d.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx($,{className:"mt-1.5",...d.register("code"),placeholder:"e.g. CERT-001"}),d.formState.errors.code&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Issuing Body *"}),e.jsx($,{className:"mt-1.5",...d.register("issuing_body"),placeholder:"e.g. Microsoft, AWS"}),d.formState.errors.issuing_body&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.issuing_body.message})]}),e.jsxs("div",{children:[e.jsxs(u,{className:"text-[12px] font-medium text-slate-500",children:["Validity (months) ",e.jsx("span",{className:"font-normal text-slate-400",children:"(optional)"})]}),e.jsx($,{className:"mt-1.5",type:"number",...d.register("validity_months"),placeholder:"e.g. 24"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:d.watch("is_mandatory"),onCheckedChange:n=>d.setValue("is_mandatory",!!n)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Mandatory"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:d.watch("is_active"),onCheckedChange:n=>d.setValue("is_active",!!n)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Active"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:d.handleSubmit(i),disabled:R.isPending||f.isPending,children:R.isPending||f.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:n=>!n&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Certification"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","certification","delete")&&(l&&L.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Ma={identified:"secondary",approved:"success",scheduled:"warning",completed:"success",deferred:"default",cancelled:"destructive"},Ia={low:"secondary",medium:"default",high:"warning",critical:"destructive"},Ua=[{value:"performance_review",label:"Performance Review"},{value:"competency_gap",label:"Competency Gap"},{value:"manager_recommendation",label:"Manager Recommendation"},{value:"self_nomination",label:"Self Nomination"},{value:"compliance",label:"Compliance"},{value:"organizational_change",label:"Organizational Change"},{value:"new_technology",label:"New Technology"},{value:"incident",label:"Incident"}],za=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"critical",label:"Critical"}],Ra=ne({employee:q().min(1,"Employee is required"),skill_area:q().optional(),business_justification:q().optional(),source:De(["performance_review","competency_gap","manager_recommendation","self_nomination","compliance","organizational_change","new_technology","incident"]),priority:De(["low","medium","high","critical"])});function Vi(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","training_need","create"),T=v("training","training_need","update"),{pagination:O,setPagination:U,sorting:I,setSorting:Q,globalFilter:z,setGlobalFilter:A,queryParams:G}=xe(),{data:K,isLoading:N}=Nt(G),[S,R]=C.useState(""),{data:f}=ts({search:S||void 0}),L=_t(),d=St(),V=bt(),k=te({resolver:ae(Ra),defaultValues:{source:"performance_review",priority:"medium"}});function i(){D("training","training_need","create")&&(p(null),k.reset({employee:"",skill_area:"",business_justification:"",source:"performance_review",priority:"medium"}),s(!0))}function H(c){D("training","training_need","update")&&(p(c),k.reset({employee:c.employee,skill_area:c.skill_area??"",business_justification:c.business_justification,source:c.source,priority:c.priority}),s(!0))}function n(c){const r={employee:c.employee,source:c.source,priority:c.priority,skill_area:c.skill_area||void 0,business_justification:c.business_justification||void 0};a?d.mutate({id:a.id,...r},{onSuccess:()=>{s(!1),k.reset()}}):L.mutate(r,{onSuccess:()=>{s(!1),k.reset()}})}const j=[{key:"skill_area_name",header:"Training Need",render:c=>e.jsx("p",{className:"font-medium text-slate-900",children:c.skill_area_name||c.employee_name})},{key:"employee_name",header:"Employee",render:c=>e.jsx("span",{className:"text-[12px] text-slate-600",children:c.employee_name})},{key:"source",header:"Source",className:"w-28",render:c=>e.jsx("span",{className:"text-[12px] text-slate-600 capitalize",children:c.source.replace(/_/g," ")})},{key:"priority",header:"Priority",className:"w-24",render:c=>e.jsx(Z,{variant:Ia[c.priority],className:"text-[11px] capitalize",children:c.priority})},{key:"status",header:"Status",className:"w-32",render:c=>e.jsx(Z,{variant:Ma[c.status],className:"text-[11px] capitalize",children:c.status.replace(/_/g," ")})},{key:"financial_year",header:"Financial Year",className:"w-28",render:c=>e.jsx("span",{className:"text-[12px] text-slate-400",children:c.financial_year||"--"})},{key:"actions",header:"",className:"w-10",render:c=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>H(c),children:"Edit"}),T&&e.jsx(Pe,{}),T&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(c),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(xs,{className:"h-5 w-5 text-primary"})," Training Needs"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Identify, request, and approve training needs"})]}),E&&e.jsxs(_,{size:"sm",onClick:i,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Need"]})]}),e.jsx(pe,{columns:j,data:(K==null?void 0:K.results)??[],isLoading:N,rowKey:c=>c.id,searchKeys:["skill_area_name","employee_name"],searchPlaceholder:"Search training needs...",emptyMessage:"No training needs found",emptyDescription:"Submit your first training need to get started.",totalCount:(K==null?void 0:K.count)??0,pagination:O,onPaginationChange:U,sorting:I,onSortingChange:Q,globalFilter:z,onGlobalFilterChange:A}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Training Need":"New Training Need"}),e.jsx(me,{children:a?"Update training need details.":"Submit a new training need."})]}),e.jsxs("form",{onSubmit:k.handleSubmit(n),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx(Je,{className:"mt-1.5",value:k.watch("employee")??"",onValueChange:c=>k.setValue("employee",c,{shouldValidate:!0}),placeholder:"Select employee"}),k.formState.errors.employee&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:k.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsxs(u,{className:"text-[12px] font-medium text-slate-500",children:["Skill Area ",e.jsx("span",{className:"font-normal text-slate-400",children:"(optional)"})]}),e.jsx(Le,{className:"mt-1.5",value:k.watch("skill_area")??null,onValueChange:c=>k.setValue("skill_area",c,{shouldValidate:!0}),onSearch:R,selectedLabel:a==null?void 0:a.skill_area_name,options:((f==null?void 0:f.results)??[]).map(c=>({value:c.id,label:c.name,hint:c.code})),placeholder:"Select skill area (optional)",searchPlaceholder:"Search skills..."})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Business Justification"}),e.jsx(Ke,{className:"mt-1.5",...k.register("business_justification"),rows:3,placeholder:"Describe the business justification for this training need..."})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Source *"}),e.jsxs(J,{value:k.watch("source"),onValueChange:c=>k.setValue("source",c),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:Ua.map(c=>e.jsx(B,{value:c.value,children:c.label},c.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Priority *"}),e.jsxs(J,{value:k.watch("priority"),onValueChange:c=>k.setValue("priority",c),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:za.map(c=>e.jsx(B,{value:c.value,children:c.label},c.value))})]})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:k.handleSubmit(n),disabled:L.isPending||d.isPending,children:L.isPending||d.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:c=>!c&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Training Need"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:(l==null?void 0:l.skill_area_name)||(l==null?void 0:l.employee_name)}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","training_need","update")&&(l&&V.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Ba=ne({name:q().min(1,"Name is required"),code:q().min(1,"Code is required"),description:q().optional(),is_active:Ae()});function Ki(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","curriculum","create"),T=v("training","curriculum","update"),O=v("training","curriculum","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=ws(K),R=At(),f=Dt(),L=Tt(),d=te({resolver:ae(Ba),defaultValues:{is_active:!0}});function V(){D("training","curriculum","create")&&(p(null),d.reset({name:"",code:"",description:"",is_active:!0}),s(!0))}function k(n){D("training","curriculum","update")&&(p(n),d.reset({name:n.name,code:n.code,description:n.description,is_active:n.is_active}),s(!0))}function i(n){a?f.mutate({id:a.id,...n},{onSuccess:()=>{s(!1),d.reset()}}):R.mutate(n,{onSuccess:()=>{s(!1),d.reset()}})}const H=[{key:"name",header:"Name",render:n=>e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:n.name}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:n.code})]})},{key:"description",header:"Description",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600 line-clamp-1",children:n.description||"--"})},{key:"module_count",header:"Modules",className:"w-24",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.module_count})},{key:"total_hours",header:"Total Hours",className:"w-28",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.total_hours})},{key:"is_active",header:"Active",className:"w-24",render:n=>e.jsx(Re,{status:n.is_active?"active":"inactive"})},{key:"created_at",header:"Created",className:"w-28",render:n=>e.jsx("span",{className:"text-[12px] text-slate-400",children:new Date(n.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>k(n),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(n),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(He,{className:"h-5 w-5 text-primary"})," Curricula"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Design structured learning paths and curricula"})]}),E&&e.jsxs(_,{size:"sm",onClick:V,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Curriculum"]})]}),e.jsx(pe,{columns:H,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:n=>n.id,searchKeys:["name","code"],searchPlaceholder:"Search curricula...",emptyMessage:"No curricula found",emptyDescription:"Create your first curriculum to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Curriculum":"New Curriculum"}),e.jsx(me,{children:a?"Update curriculum details.":"Create a new curriculum."})]}),e.jsxs("form",{onSubmit:d.handleSubmit(i),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...d.register("name"),placeholder:"Curriculum name"}),d.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx($,{className:"mt-1.5",...d.register("code"),placeholder:"e.g. CUR-001"}),d.formState.errors.code&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Description"}),e.jsx(Ke,{className:"mt-1.5",...d.register("description"),rows:3,placeholder:"Curriculum overview..."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:d.watch("is_active"),onCheckedChange:n=>d.setValue("is_active",!!n)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Active"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:d.handleSubmit(i),disabled:R.isPending||f.isPending,children:R.isPending||f.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:n=>!n&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Curriculum"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","curriculum","delete")&&(l&&L.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Ga=ne({curriculum:q().min(1,"Curriculum is required"),name:q().min(1,"Name is required"),description:q().optional(),order:Ve.number().int().min(1).optional(),duration_hours:q().optional(),is_mandatory:Ae()});function $i(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","module","create"),T=v("training","module","update"),O=v("training","module","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=qs(K),[R,f]=C.useState(""),{data:L}=ws({search:R||void 0}),d=Vt(),V=Kt(),k=$t(),i=te({resolver:ae(Ga),defaultValues:{is_mandatory:!0}});function H(){D("training","module","create")&&(p(null),i.reset({curriculum:"",name:"",description:"",order:void 0,duration_hours:"",is_mandatory:!0}),s(!0))}function n(r){D("training","module","update")&&(p(r),i.reset({curriculum:r.curriculum,name:r.name,description:r.description,order:r.order,duration_hours:r.duration_hours,is_mandatory:r.is_mandatory}),s(!0))}function j(r){a?V.mutate({id:a.id,...r},{onSuccess:()=>{s(!1),i.reset()}}):d.mutate(r,{onSuccess:()=>{s(!1),i.reset()}})}const c=[{key:"name",header:"Name",render:r=>e.jsx("div",{children:e.jsx("p",{className:"font-medium text-slate-900",children:r.name})})},{key:"curriculum_name",header:"Curriculum",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.curriculum_name})},{key:"order",header:"Order",className:"w-24",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.order})},{key:"duration_hours",header:"Duration (hrs)",className:"w-32",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.duration_hours})},{key:"lesson_count",header:"Lessons",className:"w-24",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.lesson_count})},{key:"is_mandatory",header:"Mandatory",className:"w-28",render:r=>e.jsx(Z,{variant:r.is_mandatory?"success":"secondary",children:r.is_mandatory?"Yes":"No"})},{key:"created_at",header:"Created",className:"w-28",render:r=>e.jsx("span",{className:"text-[12px] text-slate-400",children:new Date(r.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})})},{key:"actions",header:"",className:"w-10",render:r=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>n(r),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(r),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(vs,{className:"h-5 w-5 text-primary"})," Modules"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Create and manage course modules within curricula"})]}),E&&e.jsxs(_,{size:"sm",onClick:H,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Module"]})]}),e.jsx(pe,{columns:c,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:r=>r.id,searchKeys:["name"],searchPlaceholder:"Search modules...",emptyMessage:"No modules found",emptyDescription:"Create your first module to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Module":"New Module"}),e.jsx(me,{children:a?"Update module details.":"Create a new curriculum module."})]}),e.jsxs("form",{onSubmit:i.handleSubmit(j),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Curriculum *"}),e.jsx(Le,{className:"mt-1.5",value:i.watch("curriculum")??null,onValueChange:r=>i.setValue("curriculum",r,{shouldValidate:!0}),onSearch:f,selectedLabel:a==null?void 0:a.curriculum_name,options:((L==null?void 0:L.results)??[]).map(r=>({value:r.id,label:r.name,hint:r.code})),placeholder:"Select curriculum",searchPlaceholder:"Search curricula..."}),i.formState.errors.curriculum&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.curriculum.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...i.register("name"),placeholder:"Module name"}),i.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Description"}),e.jsx(Ke,{className:"mt-1.5",...i.register("description"),rows:3,placeholder:"Module overview..."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Order"}),e.jsx($,{className:"mt-1.5",type:"number",...i.register("order"),placeholder:"1"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Duration (hours)"}),e.jsx($,{className:"mt-1.5",...i.register("duration_hours"),placeholder:"e.g. 8"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:i.watch("is_mandatory"),onCheckedChange:r=>i.setValue("is_mandatory",!!r)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Mandatory"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:i.handleSubmit(j),disabled:d.isPending||V.isPending,children:d.isPending||V.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:r=>!r&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Module"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","module","delete")&&(l&&k.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Ya=[{value:"lecture",label:"Lecture"},{value:"video",label:"Video"},{value:"reading",label:"Reading"},{value:"lab",label:"Lab"},{value:"assignment",label:"Assignment"},{value:"quiz",label:"Quiz"},{value:"discussion",label:"Discussion"}],Ha=ne({module:q().min(1,"Module is required"),name:q().min(1,"Name is required"),lesson_type:De(["lecture","video","reading","lab","assignment","quiz","discussion"]),description:q().optional(),order:Ve.number().int().min(1).optional(),duration_minutes:Ve.number().min(0).optional(),video_url:q().optional(),is_mandatory:Ae()});function Li(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","lesson","create"),T=v("training","lesson","update"),O=v("training","lesson","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=Lt(K),[R,f]=C.useState(""),{data:L}=qs({search:R||void 0}),d=Ot(),V=Qt(),k=Mt(),i=te({resolver:ae(Ha),defaultValues:{lesson_type:"video",is_mandatory:!0}});function H(){D("training","lesson","create")&&(p(null),i.reset({module:"",name:"",lesson_type:"video",description:"",order:void 0,duration_minutes:void 0,video_url:"",is_mandatory:!0}),s(!0))}function n(r){D("training","lesson","update")&&(p(r),i.reset({module:r.module,name:r.name,lesson_type:r.lesson_type,description:r.description,order:r.order,duration_minutes:r.duration_minutes,video_url:r.video_url,is_mandatory:r.is_mandatory}),s(!0))}function j(r){a?V.mutate({id:a.id,...r},{onSuccess:()=>{s(!1),i.reset()}}):d.mutate(r,{onSuccess:()=>{s(!1),i.reset()}})}const c=[{key:"name",header:"Name",render:r=>e.jsx("p",{className:"font-medium text-slate-900",children:r.name})},{key:"module_name",header:"Module",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.module_name})},{key:"lesson_type",header:"Type",className:"w-28",render:r=>e.jsx(Z,{variant:"outline",className:"text-[11px] capitalize",children:r.lesson_type.replace("_"," ")})},{key:"order",header:"Order",className:"w-24",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.order})},{key:"duration_minutes",header:"Duration (min)",className:"w-32",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.duration_minutes})},{key:"is_mandatory",header:"Mandatory",className:"w-28",render:r=>e.jsx(Z,{variant:r.is_mandatory?"success":"secondary",children:r.is_mandatory?"Yes":"No"})},{key:"created_at",header:"Created",className:"w-28",render:r=>e.jsx("span",{className:"text-[12px] text-slate-400",children:new Date(r.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})})},{key:"actions",header:"",className:"w-10",render:r=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>n(r),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(r),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Ns,{className:"h-5 w-5 text-primary"})," Lessons"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Build lesson content for training modules"})]}),E&&e.jsxs(_,{size:"sm",onClick:H,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Lesson"]})]}),e.jsx(pe,{columns:c,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:r=>r.id,searchKeys:["name"],searchPlaceholder:"Search lessons...",emptyMessage:"No lessons found",emptyDescription:"Create your first lesson to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Lesson":"New Lesson"}),e.jsx(me,{children:a?"Update lesson details.":"Create a new lesson."})]}),e.jsxs("form",{onSubmit:i.handleSubmit(j),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Module *"}),e.jsx(Le,{className:"mt-1.5",value:i.watch("module")??null,onValueChange:r=>i.setValue("module",r,{shouldValidate:!0}),onSearch:f,selectedLabel:a==null?void 0:a.module_name,options:((L==null?void 0:L.results)??[]).map(r=>({value:r.id,label:r.name})),placeholder:"Select module",searchPlaceholder:"Search modules..."}),i.formState.errors.module&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.module.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...i.register("name"),placeholder:"Lesson name"}),i.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Lesson Type *"}),e.jsxs(J,{value:i.watch("lesson_type"),onValueChange:r=>i.setValue("lesson_type",r),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:Ya.map(r=>e.jsx(B,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Description"}),e.jsx(Ke,{className:"mt-1.5",...i.register("description"),rows:3,placeholder:"Lesson details..."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Order"}),e.jsx($,{className:"mt-1.5",type:"number",...i.register("order"),placeholder:"1"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Duration (minutes)"}),e.jsx($,{className:"mt-1.5",type:"number",...i.register("duration_minutes"),placeholder:"e.g. 45"})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Video URL"}),e.jsx($,{className:"mt-1.5",...i.register("video_url"),placeholder:"https://..."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:i.watch("is_mandatory"),onCheckedChange:r=>i.setValue("is_mandatory",!!r)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Mandatory"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:i.handleSubmit(j),disabled:d.isPending||V.isPending,children:d.isPending||V.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:r=>!r&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Lesson"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","lesson","delete")&&(l&&k.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Wa=[{value:"pre",label:"Pre-Training"},{value:"post",label:"Post-Training"},{value:"quiz",label:"Quiz"},{value:"assignment",label:"Assignment"},{value:"practical",label:"Practical"},{value:"certification_exam",label:"Certification Exam"}],Za=ne({program:q().optional(),name:q().min(1,"Name is required"),code:q().min(1,"Code is required"),assessment_type:De(["pre","post","quiz","assignment","practical","certification_exam"]),passing_percentage:Ve.number().min(0,"Required"),total_points:Ve.number().min(0).optional(),time_limit_minutes:Ve.number().min(0).optional(),max_attempts:Ve.number().int().min(1).optional(),is_active:Ae()});function Oi(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","assessment","create"),T=v("training","assessment","update"),O=v("training","assessment","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=Fs(K),[R,f]=C.useState(""),{data:L}=is({search:R||void 0}),d=aa(),V=na(),k=ia(),i=te({resolver:ae(Za),defaultValues:{assessment_type:"post",is_active:!0}});function H(){D("training","assessment","create")&&(p(null),i.reset({program:"",name:"",code:"",assessment_type:"post",passing_percentage:0,total_points:void 0,time_limit_minutes:void 0,max_attempts:void 0,is_active:!0}),s(!0))}function n(r){D("training","assessment","update")&&(p(r),i.reset({program:r.program??"",name:r.name,code:r.code,assessment_type:r.assessment_type,passing_percentage:r.passing_percentage,total_points:r.total_points,time_limit_minutes:r.time_limit_minutes,max_attempts:r.max_attempts,is_active:r.is_active}),s(!0))}function j(r){const M={...r,program:r.program||null};a?V.mutate({id:a.id,...M},{onSuccess:()=>{s(!1),i.reset()}}):d.mutate(M,{onSuccess:()=>{s(!1),i.reset()}})}const c=[{key:"name",header:"Name",render:r=>e.jsx("p",{className:"font-medium text-slate-900",children:r.name})},{key:"program_name",header:"Program",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.program_name})},{key:"assessment_type",header:"Type",className:"w-32",render:r=>e.jsx(Z,{variant:"outline",className:"text-[11px] capitalize",children:r.assessment_type.replace(/_/g," ")})},{key:"passing_percentage",header:"Passing %",className:"w-24",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.passing_percentage})},{key:"total_points",header:"Total Points",className:"w-24",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.total_points})},{key:"time_limit_minutes",header:"Time Limit (min)",className:"w-32",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.time_limit_minutes})},{key:"max_attempts",header:"Max Attempts",className:"w-28",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.max_attempts})},{key:"is_active",header:"Active",className:"w-24",render:r=>e.jsx(Re,{status:r.is_active?"active":"inactive"})},{key:"actions",header:"",className:"w-10",render:r=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>n(r),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(r),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5 text-primary"})," Assessments"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Create tests and exams for training programs"})]}),E&&e.jsxs(_,{size:"sm",onClick:H,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Assessment"]})]}),e.jsx(pe,{columns:c,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:r=>r.id,searchKeys:["name"],searchPlaceholder:"Search assessments...",emptyMessage:"No assessments found",emptyDescription:"Create your first assessment to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Assessment":"New Assessment"}),e.jsx(me,{children:a?"Update assessment details.":"Create a new assessment."})]}),e.jsxs("form",{onSubmit:i.handleSubmit(j),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Program"}),e.jsx(Le,{className:"mt-1.5",value:i.watch("program")??null,onValueChange:r=>i.setValue("program",r,{shouldValidate:!0}),onSearch:f,selectedLabel:a==null?void 0:a.program_name,options:((L==null?void 0:L.results)??[]).map(r=>({value:r.id,label:r.name,hint:r.code})),placeholder:"Select program (optional)",searchPlaceholder:"Search programs..."}),i.formState.errors.program&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.program.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...i.register("name"),placeholder:"Assessment name"}),i.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx($,{className:"mt-1.5",...i.register("code"),placeholder:"Assessment code"}),i.formState.errors.code&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Assessment Type *"}),e.jsxs(J,{value:i.watch("assessment_type"),onValueChange:r=>i.setValue("assessment_type",r),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:Wa.map(r=>e.jsx(B,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Passing % *"}),e.jsx($,{className:"mt-1.5",type:"number",...i.register("passing_percentage"),placeholder:"e.g. 70"}),i.formState.errors.passing_percentage&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.passing_percentage.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Total Points"}),e.jsx($,{className:"mt-1.5",type:"number",...i.register("total_points"),placeholder:"e.g. 100"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Time Limit (minutes)"}),e.jsx($,{className:"mt-1.5",type:"number",...i.register("time_limit_minutes"),placeholder:"e.g. 60"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Max Attempts"}),e.jsx($,{className:"mt-1.5",type:"number",...i.register("max_attempts"),placeholder:"e.g. 3"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:i.watch("is_active"),onCheckedChange:r=>i.setValue("is_active",!!r)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Active"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:i.handleSubmit(j),disabled:d.isPending||V.isPending,children:d.isPending||V.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:r=>!r&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Assessment"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","assessment","delete")&&(l&&k.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const Ja=ne({assessment:q().min(1,"Assessment is required"),employee:q().min(1,"Employee is required")});function Qi(){const[t,s]=C.useState(!1),{pagination:a,setPagination:p,sorting:l,setSorting:y,globalFilter:v,setGlobalFilter:D,queryParams:E}=xe(),{data:T,isLoading:O}=ra(E),[U,I]=C.useState(""),{data:Q}=Fs({search:U||void 0}),z=la(),A=te({resolver:ae(Ja)});function G(){A.reset({assessment:"",employee:""}),s(!0)}function K(S){z.mutate(S,{onSuccess:()=>{s(!1),A.reset()}})}const N=[{key:"assessment_name",header:"Assessment",render:S=>e.jsx("p",{className:"font-medium text-slate-900",children:S.assessment_name})},{key:"employee_name",header:"Employee",render:S=>e.jsx("span",{className:"text-[12px] text-slate-600",children:S.employee_name})},{key:"attempt_number",header:"Attempt #",className:"w-24",render:S=>e.jsx("span",{className:"text-[12px] text-slate-600",children:S.attempt_number})},{key:"score",header:"Score",className:"w-20",render:S=>e.jsx("span",{className:"text-[12px] text-slate-600",children:S.score??"--"})},{key:"percentage",header:"Percentage",className:"w-24",render:S=>e.jsx("span",{className:"text-[12px] text-slate-600",children:S.percentage??"--"})},{key:"passed",header:"Result",className:"w-24",render:S=>e.jsx(Z,{variant:S.passed?"success":"destructive",className:"text-[11px] capitalize",children:S.passed?"Passed":"Failed"})},{key:"started_at",header:"Started At",className:"w-36",render:S=>e.jsx("span",{className:"text-[12px] text-slate-400",children:S.started_at?new Date(S.started_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"--"})},{key:"completed_at",header:"Completed At",className:"w-36",render:S=>e.jsx("span",{className:"text-[12px] text-slate-400",children:S.completed_at?new Date(S.completed_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"--"})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(it,{className:"h-5 w-5 text-primary"})," Assessment Attempts"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"View and manage assessment attempts"})]}),e.jsxs(_,{size:"sm",onClick:G,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Attempt"]})]}),e.jsx(pe,{columns:N,data:(T==null?void 0:T.results)??[],isLoading:O,rowKey:S=>S.id,searchKeys:["assessment_name","employee_name"],searchPlaceholder:"Search attempts...",emptyMessage:"No attempts found",emptyDescription:"No assessment attempts recorded yet.",totalCount:(T==null?void 0:T.count)??0,pagination:a,onPaginationChange:p,sorting:l,onSortingChange:y,globalFilter:v,onGlobalFilterChange:D}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:"New Attempt"}),e.jsx(me,{children:"Start a new assessment attempt for an employee."})]}),e.jsxs("form",{onSubmit:A.handleSubmit(K),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Assessment *"}),e.jsx(Le,{className:"mt-1.5",value:A.watch("assessment")??null,onValueChange:S=>A.setValue("assessment",S,{shouldValidate:!0}),onSearch:I,options:((Q==null?void 0:Q.results)??[]).map(S=>({value:S.id,label:S.name,hint:S.code})),placeholder:"Select assessment",searchPlaceholder:"Search assessments..."}),A.formState.errors.assessment&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:A.formState.errors.assessment.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx(Je,{className:"mt-1.5",value:A.watch("employee")??"",onValueChange:S=>A.setValue("employee",S,{shouldValidate:!0}),placeholder:"Select employee"}),A.formState.errors.employee&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:A.formState.errors.employee.message})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:A.handleSubmit(K),disabled:z.isPending,children:z.isPending?"Starting...":"Start Attempt"})]})]})})]})}const Xa=ne({enrollment:q().min(1,"Enrollment is required"),session:q().min(1,"Session is required"),overall_rating:Ve.number().min(1).max(5),improvement_suggestions:q().optional()});function Mi(){const[t,s]=C.useState(!1),{hasPermission:a,requirePermission:p}=ie(),l=a("training","feedback","create"),{pagination:y,setPagination:v,sorting:D,setSorting:E,globalFilter:T,setGlobalFilter:O,queryParams:U}=xe(),{data:I,isLoading:Q}=ca(U),z=oa(),A=te({resolver:ae(Xa)}),G=A.watch("session"),[K,N]=C.useState(""),{data:S}=ls({search:K||void 0,...G?{session:G}:{}}),[R,f]=C.useState(""),{data:L}=rs({search:R||void 0});function d(){p("training","feedback","create")&&(A.reset({enrollment:"",session:"",overall_rating:0,improvement_suggestions:""}),s(!0))}function V(i){z.mutate(i,{onSuccess:()=>{s(!1),A.reset()}})}const k=[{key:"employee_name",header:"Employee",render:i=>e.jsx("p",{className:"font-medium text-slate-900",children:i.employee_name})},{key:"program_name",header:"Program",render:i=>e.jsx("span",{className:"text-[12px] text-slate-600",children:i.program_name})},{key:"session_code",header:"Session",render:i=>e.jsx("span",{className:"text-[12px] text-slate-600",children:i.session_code||"--"})},{key:"overall_rating",header:"Overall Rating",className:"w-28",render:i=>e.jsxs("span",{className:"text-[12px] text-slate-600",children:[i.overall_rating," / 5"]})},{key:"submitted_at",header:"Submitted At",className:"w-36",render:i=>e.jsx("span",{className:"text-[12px] text-slate-400",children:i.submitted_at?new Date(i.submitted_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"--"})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Xs,{className:"h-5 w-5 text-primary"})," Training Feedback"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Collect and review participant training feedback"})]}),l&&e.jsxs(_,{size:"sm",onClick:d,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," Submit Feedback"]})]}),e.jsx(pe,{columns:k,data:(I==null?void 0:I.results)??[],isLoading:Q,rowKey:i=>i.id,searchKeys:["employee_name","program_name"],searchPlaceholder:"Search feedback...",emptyMessage:"No feedback found",emptyDescription:"No training feedback submitted yet.",totalCount:(I==null?void 0:I.count)??0,pagination:y,onPaginationChange:v,sorting:D,onSortingChange:E,globalFilter:T,onGlobalFilterChange:O}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:"Submit Feedback"}),e.jsx(me,{children:"Submit training feedback for an enrollment."})]}),e.jsxs("form",{onSubmit:A.handleSubmit(V),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Enrollment *"}),e.jsx(Le,{className:"mt-1.5",value:A.watch("enrollment")??null,onValueChange:i=>A.setValue("enrollment",i,{shouldValidate:!0}),onSearch:N,disabled:!G,options:((S==null?void 0:S.results)??[]).map(i=>({value:i.id,label:[i.employee_name,i.program_name].filter(Boolean).join(" — ")||i.id,hint:i.session_code})),placeholder:G?"Select enrollment":"Select a session first",searchPlaceholder:"Search enrollments..."}),A.formState.errors.enrollment&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:A.formState.errors.enrollment.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Session *"}),e.jsx(Le,{className:"mt-1.5",value:A.watch("session")??null,onValueChange:i=>{A.setValue("session",i,{shouldValidate:!0}),A.setValue("enrollment","",{shouldValidate:!0})},onSearch:f,options:((L==null?void 0:L.results)??[]).map(i=>({value:i.id,label:i.session_code||i.batch_name||i.program_name,hint:i.program_name})),placeholder:"Select session",searchPlaceholder:"Search sessions..."}),A.formState.errors.session&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:A.formState.errors.session.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Overall Rating (1-5) *"}),e.jsx($,{className:"mt-1.5",type:"number",min:1,max:5,...A.register("overall_rating"),placeholder:"e.g. 4"}),A.formState.errors.overall_rating&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:A.formState.errors.overall_rating.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Improvement Suggestions"}),e.jsx(Ke,{className:"mt-1.5",...A.register("improvement_suggestions"),rows:4,placeholder:"Your feedback..."})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:A.handleSubmit(V),disabled:z.isPending,children:z.isPending?"Submitting...":"Submit"})]})]})})]})}const en=[{value:"30_day",label:"30 Day"},{value:"60_day",label:"60 Day"},{value:"90_day",label:"90 Day"}],sn=[{value:"significant",label:"Significant"},{value:"moderate",label:"Moderate"},{value:"minimal",label:"Minimal"},{value:"none",label:"None"}],tn=ne({enrollment:q().min(1,"Enrollment is required"),assessment_period:De(["30_day","60_day","90_day"]),application_at_work:Ve.number().min(0),barriers:q().optional(),support_needed:q().optional(),overall_impact:De(["significant","moderate","minimal","none"]),assessed_at:q().optional()});function Ii(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","behavior_assessment","create"),T=v("training","behavior_assessment","update"),{pagination:O,setPagination:U,sorting:I,setSorting:Q,globalFilter:z,setGlobalFilter:A,queryParams:G}=xe(),{data:K,isLoading:N}=da(G),[S,R]=C.useState(""),{data:f}=ls({search:S||void 0}),L=ma(),d=ua(),V=te({resolver:ae(tn)});function k(){D("training","behavior_assessment","create")&&(p(null),V.reset({enrollment:"",assessment_period:"30_day",application_at_work:0,barriers:"",support_needed:"",overall_impact:"moderate",assessed_at:""}),s(!0))}function i(j){D("training","behavior_assessment","update")&&(p(j),V.reset({enrollment:j.enrollment,assessment_period:j.assessment_period,application_at_work:j.application_at_work,barriers:j.barriers,support_needed:j.support_needed,overall_impact:j.overall_impact,assessed_at:j.assessed_at??""}),s(!0))}function H(j){const c={enrollment:j.enrollment,assessment_period:j.assessment_period,application_at_work:j.application_at_work,barriers:j.barriers,support_needed:j.support_needed,overall_impact:j.overall_impact,assessed_at:j.assessed_at||null};a?d.mutate({id:a.id,...c},{onSuccess:()=>{s(!1),V.reset()}}):L.mutate(c,{onSuccess:()=>{s(!1),V.reset()}})}const n=[{key:"employee_name",header:"Employee",render:j=>e.jsx("p",{className:"font-medium text-slate-900",children:j.employee_name})},{key:"session_code",header:"Session",render:j=>e.jsx("span",{className:"text-[12px] text-slate-600",children:j.session_code})},{key:"assessed_by_name",header:"Assessed By",render:j=>e.jsx("span",{className:"text-[12px] text-slate-600",children:j.assessed_by_name})},{key:"assessment_period",header:"Period",className:"w-24",render:j=>e.jsx("span",{className:"text-[12px] text-slate-600",children:j.assessment_period.replace("_"," ")})},{key:"application_at_work",header:"Applied",className:"w-20",render:j=>e.jsx("span",{className:"text-[12px] text-slate-600",children:j.application_at_work})},{key:"overall_impact",header:"Impact",className:"w-24",render:j=>e.jsx("span",{className:"text-[12px] font-medium text-slate-700 capitalize",children:j.overall_impact})},{key:"assessed_at",header:"Date",className:"w-28",render:j=>e.jsx("span",{className:"text-[12px] text-slate-400",children:j.assessed_at?new Date(j.assessed_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"--"})},{key:"actions",header:"",className:"w-10",render:j=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>i(j),children:"Edit"}),T&&e.jsx(Pe,{}),T&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(j),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(gs,{className:"h-5 w-5 text-primary"})," Behavior Assessments"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Assess post-training behavioral impact"})]}),E&&e.jsxs(_,{size:"sm",onClick:k,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Assessment"]})]}),e.jsx(pe,{columns:n,data:(K==null?void 0:K.results)??[],isLoading:N,rowKey:j=>j.id,searchKeys:["employee_name","session_code"],searchPlaceholder:"Search assessments...",emptyMessage:"No behavior assessments found",emptyDescription:"Create your first behavior assessment to get started.",totalCount:(K==null?void 0:K.count)??0,pagination:O,onPaginationChange:U,sorting:I,onSortingChange:Q,globalFilter:z,onGlobalFilterChange:A}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Assessment":"New Behavior Assessment"}),e.jsx(me,{children:a?"Update assessment details.":"Evaluate post-training behavioral changes."})]}),e.jsxs("form",{onSubmit:V.handleSubmit(H),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Enrollment *"}),e.jsx(Le,{className:"mt-1.5",value:V.watch("enrollment")??null,onValueChange:j=>V.setValue("enrollment",j,{shouldValidate:!0}),onSearch:R,selectedLabel:a==null?void 0:a.employee_name,options:((f==null?void 0:f.results)??[]).map(j=>({value:j.id,label:[j.employee_name,j.program_name].filter(Boolean).join(" — ")||j.id,hint:j.session_code})),placeholder:"Select enrollment",searchPlaceholder:"Search enrollments..."}),V.formState.errors.enrollment&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:V.formState.errors.enrollment.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Assessment Period *"}),e.jsxs(J,{value:V.watch("assessment_period"),onValueChange:j=>V.setValue("assessment_period",j),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:en.map(j=>e.jsx(B,{value:j.value,children:j.label},j.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Application at Work"}),e.jsx($,{className:"mt-1.5",type:"number",min:0,...V.register("application_at_work")})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Overall Impact"}),e.jsxs(J,{value:V.watch("overall_impact"),onValueChange:j=>V.setValue("overall_impact",j),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:sn.map(j=>e.jsx(B,{value:j.value,children:j.label},j.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Assessed At"}),e.jsx($,{className:"mt-1.5",type:"date",...V.register("assessed_at")})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Barriers"}),e.jsx(Ke,{className:"mt-1.5",...V.register("barriers"),rows:3,placeholder:"Barriers to applying learning..."})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Support Needed"}),e.jsx(Ke,{className:"mt-1.5",...V.register("support_needed"),rows:3,placeholder:"Support required going forward..."})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:V.handleSubmit(H),disabled:L.isPending||d.isPending,children:L.isPending||d.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:j=>!j&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Behavior Assessment"}),e.jsxs(ve,{children:["Are you sure you want to delete this behavior assessment for ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.employee_name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{y(null)},children:"Delete"})]})]})})]})}const an={draft:"secondary",active:"success",in_review:"warning",completed:"default"},nn=ne({employee:q().min(1,"Employee is required"),plan_name:q().min(1,"Plan name is required"),financial_year:q().min(1,"Financial year is required"),career_goal_short_term:q().optional()});function Ui(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),[v,D]=C.useState(""),{hasPermission:E,requirePermission:T}=ie(),O=E("training","development_plan","create"),U=E("training","development_plan","update"),I=E("training","development_plan","delete"),{pagination:Q,setPagination:z,sorting:A,setSorting:G,globalFilter:K,setGlobalFilter:N,queryParams:S}=xe(),R={...S,...v&&{status:v}},{data:f,isLoading:L}=Es(R),d=xa(),V=pa(),k=ha(),i=te({resolver:ae(nn)});function H(){T("training","development_plan","create")&&(p(null),i.reset({employee:"",plan_name:"",financial_year:"",career_goal_short_term:""}),s(!0))}function n(M){T("training","development_plan","update")&&(p(M),i.reset({employee:M.employee,plan_name:M.plan_name,financial_year:M.financial_year,career_goal_short_term:M.career_goal_short_term}),s(!0))}function j(M){const $e={employee:M.employee,plan_name:M.plan_name,financial_year:M.financial_year,career_goal_short_term:M.career_goal_short_term};a?V.mutate({id:a.id,...$e},{onSuccess:()=>{s(!1),i.reset()}}):d.mutate($e,{onSuccess:()=>{s(!1),i.reset()}})}function c(M){D(M==="__all__"?"":M),z($e=>({...$e,pageIndex:0}))}const r=[{key:"employee_name",header:"Employee",render:M=>e.jsx("p",{className:"font-medium text-slate-900",children:M.employee_name})},{key:"plan_name",header:"Plan",render:M=>e.jsx("span",{className:"text-[13px] text-slate-700",children:M.plan_name})},{key:"financial_year",header:"FY",className:"w-28",render:M=>e.jsx("span",{className:"text-[12px] text-slate-500",children:M.financial_year})},{key:"status",header:"Status",className:"w-28",render:M=>e.jsx(Z,{variant:an[M.status],className:"text-[11px]",children:M.status.replace("_"," ")})},{key:"action_count",header:"Actions",className:"w-24",render:M=>e.jsx("span",{className:"text-[12px] text-slate-600",children:M.action_count??0})},{key:"progress_percentage",header:"Progress",className:"w-24",render:M=>e.jsxs("span",{className:"text-[12px] text-slate-600",children:[M.progress_percentage,"%"]})},{key:"actions",header:"",className:"w-10",render:M=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[U&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>n(M),children:"Edit"}),U&&I&&e.jsx(Pe,{}),I&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(M),children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsx(Ge,{title:"Development Plans",description:"Create and manage employee development plans and growth roadmaps.",actions:O&&e.jsxs(_,{size:"sm",onClick:H,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Plan"]})}),e.jsx(pe,{actions:e.jsxs(J,{value:v,onValueChange:c,children:[e.jsx(X,{className:"w-[140px] h-9",children:e.jsx(ee,{placeholder:"All statuses"})}),e.jsxs(se,{children:[e.jsx(B,{value:"__all__",children:"All Statuses"}),e.jsx(B,{value:"draft",children:"Draft"}),e.jsx(B,{value:"active",children:"Active"}),e.jsx(B,{value:"in_review",children:"In Review"}),e.jsx(B,{value:"completed",children:"Completed"})]})]}),columns:r,data:(f==null?void 0:f.results)??[],isLoading:L,rowKey:M=>M.id,searchKeys:["employee_name","plan_name"],searchPlaceholder:"Search plans...",emptyMessage:"No development plans found",emptyDescription:"Create your first development plan to get started.",totalCount:(f==null?void 0:f.count)??0,pagination:Q,onPaginationChange:z,sorting:A,onSortingChange:G,globalFilter:K,onGlobalFilterChange:N}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Development Plan":"New Development Plan"}),e.jsx(me,{children:a?"Update plan details.":"Create a new development plan for an employee."})]}),e.jsxs("form",{onSubmit:i.handleSubmit(j),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Je,{value:i.watch("employee"),onValueChange:M=>i.setValue("employee",M,{shouldValidate:!0})})}),i.formState.errors.employee&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Plan Name *"}),e.jsx($,{className:"mt-1.5",...i.register("plan_name"),placeholder:"e.g. Senior Engineer Development Path"}),i.formState.errors.plan_name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.plan_name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Financial Year *"}),e.jsx($,{className:"mt-1.5",...i.register("financial_year"),placeholder:"e.g. 2025-2026"}),i.formState.errors.financial_year&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:i.formState.errors.financial_year.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Short-term Career Goal"}),e.jsx(Ke,{className:"mt-1.5",...i.register("career_goal_short_term"),rows:3,placeholder:"Career objectives for this period..."})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:i.handleSubmit(j),disabled:d.isPending||V.isPending,children:d.isPending||V.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:M=>!M&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Development Plan"}),e.jsxs(ve,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.plan_name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{T("training","development_plan","delete")&&(l&&k.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const rn={planned:"secondary",in_progress:"warning",completed:"success",deferred:"default",cancelled:"destructive"},ln=[{value:"training",label:"Training"},{value:"assignment",label:"Assignment"},{value:"project",label:"Project"},{value:"mentoring",label:"Mentoring"},{value:"coaching",label:"Coaching"},{value:"self_study",label:"Self Study"},{value:"certification",label:"Certification"},{value:"rotation",label:"Rotation"},{value:"shadowing",label:"Shadowing"}],cn=ne({plan:q().min(1,"Plan is required"),title:q().min(1,"Title is required"),description:q().optional(),action_type:De(["training","assignment","project","mentoring","coaching","self_study","certification","rotation","shadowing"]),target_completion_date:Zs(),outcome_notes:q().optional()});function zi(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{pagination:v,setPagination:D,sorting:E,setSorting:T,globalFilter:O,setGlobalFilter:U,queryParams:I}=xe(),{data:Q,isLoading:z}=ga(I),[A,G]=C.useState(""),{data:K}=Es({search:A||void 0}),N=ja(),S=ya(),R=fa(),f=te({resolver:ae(cn),defaultValues:{action_type:"training"}});function L(){p(null),f.reset({plan:"",title:"",description:"",action_type:"training",target_completion_date:"",outcome_notes:""}),s(!0)}function d(i){p(i),f.reset({plan:i.plan,title:i.title,description:i.description,action_type:i.action_type,target_completion_date:i.target_completion_date??"",outcome_notes:i.outcome_notes}),s(!0)}function V(i){const H={plan:i.plan,title:i.title,description:i.description,action_type:i.action_type,target_completion_date:i.target_completion_date||null,outcome_notes:i.outcome_notes};a?S.mutate({id:a.id,...H},{onSuccess:()=>{s(!1),f.reset()}}):N.mutate(H,{onSuccess:()=>{s(!1),f.reset()}})}const k=[{key:"title",header:"Title",render:i=>e.jsx("p",{className:"font-medium text-slate-900",children:i.title})},{key:"plan_name",header:"Plan",render:i=>e.jsx("span",{className:"text-[12px] text-slate-600",children:i.plan_name})},{key:"action_type",header:"Type",className:"w-28",render:i=>e.jsx(Z,{variant:"outline",className:"text-[11px] capitalize",children:i.action_type.replace(/_/g," ")})},{key:"target_completion_date",header:"Target Date",className:"w-28",render:i=>e.jsx("span",{className:"text-[12px] text-slate-400",children:i.target_completion_date?new Date(i.target_completion_date).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"--"})},{key:"status",header:"Status",className:"w-28",render:i=>e.jsx(Z,{variant:rn[i.status],className:"text-[11px] capitalize",children:i.status.replace(/_/g," ")})},{key:"actions",header:"",className:"w-10",render:i=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>d(i),children:"Edit"}),e.jsx(Pe,{}),e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(i),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(et,{className:"h-5 w-5 text-primary"})," Development Actions"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Track development plan action items"})]}),e.jsxs(_,{size:"sm",onClick:L,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Action"]})]}),e.jsx(pe,{columns:k,data:(Q==null?void 0:Q.results)??[],isLoading:z,rowKey:i=>i.id,searchKeys:["title","plan_name"],searchPlaceholder:"Search actions...",emptyMessage:"No development actions found",emptyDescription:"Create your first development action to get started.",totalCount:(Q==null?void 0:Q.count)??0,pagination:v,onPaginationChange:D,sorting:E,onSortingChange:T,globalFilter:O,onGlobalFilterChange:U}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Action":"New Development Action"}),e.jsx(me,{children:a?"Update action details.":"Add a new development action."})]}),e.jsxs("form",{onSubmit:f.handleSubmit(V),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Plan *"}),e.jsx(Le,{className:"mt-1.5",value:f.watch("plan")??null,onValueChange:i=>f.setValue("plan",i,{shouldValidate:!0}),onSearch:G,selectedLabel:a==null?void 0:a.plan_name,options:((K==null?void 0:K.results)??[]).map(i=>({value:i.id,label:i.plan_name})),placeholder:"Select development plan",searchPlaceholder:"Search plans..."}),f.formState.errors.plan&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:f.formState.errors.plan.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Title *"}),e.jsx($,{className:"mt-1.5",...f.register("title"),placeholder:"Action title"}),f.formState.errors.title&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:f.formState.errors.title.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Description"}),e.jsx(Ke,{className:"mt-1.5",...f.register("description"),rows:3,placeholder:"Action details..."})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Action Type *"}),e.jsxs(J,{value:f.watch("action_type"),onValueChange:i=>f.setValue("action_type",i),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:ln.map(i=>e.jsx(B,{value:i.value,children:i.label},i.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Target Completion Date"}),e.jsx($,{className:"mt-1.5",type:"date",...f.register("target_completion_date")})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Outcome Notes"}),e.jsx(Ke,{className:"mt-1.5",...f.register("outcome_notes"),rows:3,placeholder:"Additional notes..."})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:f.handleSubmit(V),disabled:N.isPending||S.isPending,children:N.isPending||S.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:i=>!i&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Development Action"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.title}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{l&&R.mutate(l.id),y(null)},children:"Delete"})]})]})})]})}const on={internal:"success",external:"default",vendor:"default"},dn=[{value:"internal",label:"Internal"},{value:"external",label:"External"},{value:"vendor",label:"Vendor"}],mn=ne({name:q().min(1,"Name is required"),trainer_type:De(["internal","external","vendor"]),email:q().email("Valid email required").optional().or(Ze("")),phone:q().optional(),bio:q().optional(),hourly_rate:q().optional(),is_active:Ae()});function Ri(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","trainer","create"),T=v("training","trainer","update"),O=v("training","trainer","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=Ps(K),R=qt(),f=Ft(),L=Et(),d=te({resolver:ae(mn),defaultValues:{trainer_type:"internal",is_active:!0}});function V(){D("training","trainer","create")&&(p(null),d.reset({name:"",trainer_type:"internal",email:"",phone:"",bio:"",hourly_rate:"",is_active:!0}),s(!0))}function k(n){D("training","trainer","update")&&(p(n),d.reset({name:n.name,trainer_type:n.trainer_type,email:n.email,phone:n.phone,bio:n.bio,hourly_rate:n.hourly_rate??"",is_active:n.is_active}),s(!0))}function i(n){const j={...n,email:n.email||void 0,hourly_rate:n.hourly_rate||void 0};a?f.mutate({id:a.id,...j},{onSuccess:()=>{s(!1),d.reset()}}):R.mutate(j,{onSuccess:()=>{s(!1),d.reset()}})}const H=[{key:"name",header:"Name",render:n=>e.jsx("p",{className:"font-medium text-slate-900",children:n.name})},{key:"trainer_type",header:"Type",className:"w-28",render:n=>e.jsx(Z,{variant:on[n.trainer_type],className:"text-[11px] capitalize",children:n.trainer_type})},{key:"email",header:"Email",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.email||"--"})},{key:"phone",header:"Phone",className:"w-32",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.phone||"--"})},{key:"specializations",header:"Specializations",render:n=>{const j=Array.isArray(n.specializations)?n.specializations:[];return e.jsx("span",{className:"text-[12px] text-slate-600",children:j.length>0?j.join(", "):"--"})}},{key:"rating",header:"Rating",className:"w-20",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.rating??"--"})},{key:"is_active",header:"Active",className:"w-24",render:n=>e.jsx(Re,{status:n.is_active?"active":"inactive"})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>k(n),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(n),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(ps,{className:"h-5 w-5 text-primary"})," Trainers"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage internal and external trainers"})]}),E&&e.jsxs(_,{size:"sm",onClick:V,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Trainer"]})]}),e.jsx(pe,{columns:H,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:n=>n.id,searchKeys:["name","email"],searchPlaceholder:"Search trainers...",emptyMessage:"No trainers found",emptyDescription:"Add your first trainer to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Trainer":"New Trainer"}),e.jsx(me,{children:a?"Update trainer details.":"Add a new trainer."})]}),e.jsxs("form",{onSubmit:d.handleSubmit(i),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...d.register("name"),placeholder:"Trainer name"}),d.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Trainer Type *"}),e.jsxs(J,{value:d.watch("trainer_type"),onValueChange:n=>d.setValue("trainer_type",n),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:dn.map(n=>e.jsx(B,{value:n.value,children:n.label},n.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Email"}),e.jsx($,{className:"mt-1.5",type:"email",...d.register("email"),placeholder:"trainer@example.com"}),d.formState.errors.email&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.email.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Phone"}),e.jsx(hs,{className:"mt-1.5",...d.register("phone"),placeholder:"+91 98765 43210"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Bio"}),e.jsx(Ke,{className:"mt-1.5",...d.register("bio"),rows:3,placeholder:"Professional background..."})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Hourly Rate"}),e.jsx($,{className:"mt-1.5",...d.register("hourly_rate"),placeholder:"e.g. 2500.00"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:d.watch("is_active"),onCheckedChange:n=>d.setValue("is_active",!!n)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Active"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:d.handleSubmit(i),disabled:R.isPending||f.isPending,children:R.isPending||f.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:n=>!n&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Trainer"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","trainer","delete")&&(l&&L.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const un=ne({name:q().min(1,"Name is required"),code:q().min(1,"Code is required"),contact_person:q().optional(),email:q().email("Valid email required").optional().or(Ze("")),phone:q().optional(),website:q().optional(),is_active:Ae()});function Bi(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","vendor","create"),T=v("training","vendor","update"),O=v("training","vendor","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=Ct(K),R=kt(),f=Pt(),L=wt(),d=te({resolver:ae(un),defaultValues:{is_active:!0}});function V(){D("training","vendor","create")&&(p(null),d.reset({name:"",code:"",contact_person:"",email:"",phone:"",website:"",is_active:!0}),s(!0))}function k(n){D("training","vendor","update")&&(p(n),d.reset({name:n.name,code:n.code,contact_person:n.contact_person,email:n.email,phone:n.phone,website:n.website,is_active:n.is_active}),s(!0))}function i(n){const j={...n,email:n.email||void 0};a?f.mutate({id:a.id,...j},{onSuccess:()=>{s(!1),d.reset()}}):R.mutate(j,{onSuccess:()=>{s(!1),d.reset()}})}const H=[{key:"name",header:"Name",render:n=>e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:n.name}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:n.code})]})},{key:"contact_person",header:"Contact Person",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.contact_person||"--"})},{key:"email",header:"Email",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.email||"--"})},{key:"phone",header:"Phone",className:"w-32",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.phone||"--"})},{key:"rating",header:"Rating",className:"w-20",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.rating??"--"})},{key:"is_active",header:"Active",className:"w-24",render:n=>e.jsx(Re,{status:n.is_active?"active":"inactive"})},{key:"created_at",header:"Created",className:"w-28",render:n=>e.jsx("span",{className:"text-[12px] text-slate-400",children:new Date(n.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>k(n),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(n),children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Ss,{className:"h-5 w-5 text-primary"})," Vendors"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage training vendor partnerships"})]}),E&&e.jsxs(_,{size:"sm",onClick:V,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Vendor"]})]}),e.jsx(pe,{columns:H,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:n=>n.id,searchKeys:["name","code","contact_person"],searchPlaceholder:"Search vendors...",emptyMessage:"No vendors found",emptyDescription:"Add your first training vendor to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Vendor":"New Vendor"}),e.jsx(me,{children:a?"Update vendor details.":"Add a new training vendor."})]}),e.jsxs("form",{onSubmit:d.handleSubmit(i),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...d.register("name"),placeholder:"Vendor name"}),d.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx($,{className:"mt-1.5",...d.register("code"),placeholder:"e.g. VND-001"}),d.formState.errors.code&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Contact Person"}),e.jsx($,{className:"mt-1.5",...d.register("contact_person"),placeholder:"Full name"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Email"}),e.jsx($,{className:"mt-1.5",type:"email",...d.register("email"),placeholder:"vendor@example.com"}),d.formState.errors.email&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.email.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Phone"}),e.jsx(hs,{className:"mt-1.5",...d.register("phone"),placeholder:"+91 98765 43210"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Website"}),e.jsx($,{className:"mt-1.5",...d.register("website"),placeholder:"https://vendor.com"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{checked:d.watch("is_active"),onCheckedChange:n=>d.setValue("is_active",!!n)}),e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Active"})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:d.handleSubmit(i),disabled:R.isPending||f.isPending,children:R.isPending||f.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:n=>!n&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete Vendor"}),e.jsxs(ve,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","vendor","delete")&&(l&&L.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const xn=[{value:"scorm",label:"SCORM"},{value:"xapi",label:"xAPI"},{value:"lti",label:"LTI"},{value:"api",label:"API"},{value:"sso",label:"SSO"}],pn=[{value:"realtime",label:"Realtime"},{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"}],hn=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"error",label:"Error"}],gn=ne({name:q().min(1,"Name is required"),provider_type:De(["scorm","xapi","lti","api","sso"]),sync_frequency:De(["realtime","hourly","daily"]),status:De(["active","inactive","error"])});function Gi(){const[t,s]=C.useState(!1),[a,p]=C.useState(null),[l,y]=C.useState(null),{hasPermission:v,requirePermission:D}=ie(),E=v("training","lms","create"),T=v("training","lms","update"),O=v("training","lms","delete"),{pagination:U,setPagination:I,sorting:Q,setSorting:z,globalFilter:A,setGlobalFilter:G,queryParams:K}=xe(),{data:N,isLoading:S}=va(K),R=Na(),f=_a(),L=Sa(),d=te({resolver:ae(gn),defaultValues:{provider_type:"api",sync_frequency:"daily",status:"active"}});function V(){D("training","lms","create")&&(p(null),d.reset({name:"",provider_type:"api",sync_frequency:"daily",status:"active"}),s(!0))}function k(n){D("training","lms","update")&&(p(n),d.reset({name:n.name,provider_type:n.provider_type,sync_frequency:n.sync_frequency,status:n.status}),s(!0))}function i(n){a?f.mutate({id:a.id,...n},{onSuccess:()=>{s(!1),d.reset()}}):R.mutate(n,{onSuccess:()=>{s(!1),d.reset()}})}const H=[{key:"name",header:"Name",render:n=>e.jsx("p",{className:"font-medium text-slate-900",children:n.name})},{key:"provider_type",header:"Provider",className:"w-32",render:n=>e.jsx(Z,{variant:"outline",className:"text-[11px] uppercase",children:n.provider_type})},{key:"sync_frequency",header:"Sync",className:"w-24",render:n=>e.jsx(Z,{variant:"outline",className:"text-[11px] capitalize",children:n.sync_frequency})},{key:"last_synced_at",header:"Last Sync",className:"w-28",render:n=>e.jsx("span",{className:"text-[12px] text-slate-400",children:n.last_synced_at?new Date(n.last_synced_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"--"})},{key:"course_count",header:"Courses",className:"w-24",render:n=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.course_count})},{key:"status",header:"Status",className:"w-24",render:n=>e.jsx(Re,{status:n.status})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(be,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"icon-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ke,{align:"end",className:"w-44",children:[T&&e.jsx(Y,{className:"gap-2 text-[13px]",onClick:()=>k(n),children:"Edit"}),T&&O&&e.jsx(Pe,{}),O&&e.jsxs(Y,{className:"gap-2 text-[13px] text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>y(n),children:[e.jsx(we,{className:"h-3.5 w-3.5"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(nt,{className:"h-5 w-5 text-primary"})," LMS Integrations"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Configure external LMS integrations"})]}),E&&e.jsxs(_,{size:"sm",onClick:V,children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"})," New Integration"]})]}),e.jsx(pe,{columns:H,data:(N==null?void 0:N.results)??[],isLoading:S,rowKey:n=>n.id,searchKeys:["name"],searchPlaceholder:"Search integrations...",emptyMessage:"No LMS integrations found",emptyDescription:"Connect your first LMS to get started.",totalCount:(N==null?void 0:N.count)??0,pagination:U,onPaginationChange:I,sorting:Q,onSortingChange:z,globalFilter:A,onGlobalFilterChange:G}),e.jsx(le,{open:t,onOpenChange:s,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:a?"Edit Integration":"New LMS Integration"}),e.jsx(me,{children:a?"Update integration settings.":"Connect a new learning management system."})]}),e.jsxs("form",{onSubmit:d.handleSubmit(i),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx($,{className:"mt-1.5",...d.register("name"),placeholder:"Integration name"}),d.formState.errors.name&&e.jsx("p",{className:"text-[12px] text-red-600 mt-1",children:d.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Provider *"}),e.jsxs(J,{value:d.watch("provider_type"),onValueChange:n=>d.setValue("provider_type",n),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:xn.map(n=>e.jsx(B,{value:n.value,children:n.label},n.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Sync Frequency *"}),e.jsxs(J,{value:d.watch("sync_frequency"),onValueChange:n=>d.setValue("sync_frequency",n),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:pn.map(n=>e.jsx(B,{value:n.value,children:n.label},n.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-[12px] font-medium text-slate-500",children:"Status *"}),e.jsxs(J,{value:d.watch("status"),onValueChange:n=>d.setValue("status",n),children:[e.jsx(X,{className:"mt-1.5 h-9 text-[13px]",children:e.jsx(ee,{})}),e.jsx(se,{children:hn.map(n=>e.jsx(B,{value:n.value,children:n.label},n.value))})]})]})]}),e.jsxs(ue,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(_,{onClick:d.handleSubmit(i),disabled:R.isPending||f.isPending,children:R.isPending||f.isPending?"Saving...":a?"Update":"Create"})]})]})}),e.jsx(he,{open:!!l,onOpenChange:n=>!n&&y(null),children:e.jsxs(ge,{children:[e.jsx(je,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ye,{variant:"destructive"}),e.jsxs("div",{children:[e.jsx(fe,{children:"Delete LMS Integration"}),e.jsxs(ve,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium text-slate-700",children:l==null?void 0:l.name}),"? This action cannot be undone."]})]})]})}),e.jsxs(Ne,{children:[e.jsx(_e,{onClick:()=>y(null),children:"Cancel"}),e.jsx(Se,{variant:"destructive",onClick:()=>{D("training","lms","delete")&&(l&&L.mutate(l.id),y(null))},children:"Delete"})]})]})})]})}const jn=ne({self_enrollment_enabled:Ae(),manager_approval_for_enrollment:Ae(),feedback_mandatory:Ae(),min_attendance_pct_for_completion:Ve.number().min(0).max(100),notify_certification_expiry:Ae(),lms_integration_enabled:Ae(),training_bond_enabled:Ae()});function Yi(){const{data:t,isLoading:s}=ct(),a=ot(),{hasPermission:p,requirePermission:l}=ie(),y=p("training","settings","update"),v=te({resolver:ae(jn),defaultValues:{self_enrollment_enabled:!0,manager_approval_for_enrollment:!0,feedback_mandatory:!0,min_attendance_pct_for_completion:75,notify_certification_expiry:!0,lms_integration_enabled:!1,training_bond_enabled:!1}});C.useEffect(()=>{t&&v.reset({self_enrollment_enabled:t.self_enrollment_enabled,manager_approval_for_enrollment:t.manager_approval_for_enrollment,feedback_mandatory:t.feedback_mandatory,min_attendance_pct_for_completion:t.min_attendance_pct_for_completion,notify_certification_expiry:t.notify_certification_expiry,lms_integration_enabled:t.lms_integration_enabled,training_bond_enabled:t.training_bond_enabled})},[t,v]);function D(E){l("training","settings","update")&&a.mutate(E)}return s?e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(es,{className:"h-5 w-5 text-primary"})," Training Settings"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Configure training module settings"})]})}),e.jsx("div",{className:"space-y-4",children:[1,2,3,4,5].map(E=>e.jsx("div",{className:"h-32 rounded-lg skeleton-shimmer"},E))})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(es,{className:"h-5 w-5 text-primary"})," Training Settings"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Configure training module settings"})]}),y&&e.jsx(_,{size:"sm",disabled:!v.formState.isDirty||a.isPending,onClick:v.handleSubmit(D),children:a.isPending?"Saving...":"Save Changes"})]}),e.jsxs("form",{onSubmit:v.handleSubmit(D),className:"space-y-4",children:[e.jsxs(Fe,{children:[e.jsx(Oe,{children:e.jsxs(Qe,{className:"text-[14px] font-semibold flex items-center gap-2",children:[e.jsx(es,{className:"h-4 w-4 text-slate-400"})," General"]})}),e.jsxs(Ee,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[13px] font-medium text-slate-700",children:"Allow Self-enrollment"}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:"Employees can enroll themselves in training programs"})]}),e.jsx(Be,{name:"self_enrollment_enabled",control:v.control,render:({field:E})=>e.jsx(ze,{checked:E.value,onCheckedChange:E.onChange})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[13px] font-medium text-slate-700",children:"Manager Approval for Enrollment"}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:"Enrollments require manager approval before processing"})]}),e.jsx(Be,{name:"manager_approval_for_enrollment",control:v.control,render:({field:E})=>e.jsx(ze,{checked:E.value,onCheckedChange:E.onChange})})]})]})]}),e.jsxs(Fe,{children:[e.jsx(Oe,{children:e.jsxs(Qe,{className:"text-[14px] font-semibold flex items-center gap-2",children:[e.jsx(ss,{className:"h-4 w-4 text-slate-400"})," Training Quality"]})}),e.jsxs(Ee,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[13px] font-medium text-slate-700",children:"Feedback Mandatory"}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:"Require participants to submit feedback after training"})]}),e.jsx(Be,{name:"feedback_mandatory",control:v.control,render:({field:E})=>e.jsx(ze,{checked:E.value,onCheckedChange:E.onChange})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[13px] font-medium text-slate-700",children:"Min Attendance Percentage"}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:"Minimum attendance required for completion"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx($,{className:"w-20 text-center",type:"number",min:0,max:100,...v.register("min_attendance_pct_for_completion")}),e.jsx("span",{className:"text-[12px] text-slate-400",children:"%"})]})]})]})]}),e.jsxs(Fe,{children:[e.jsx(Oe,{children:e.jsxs(Qe,{className:"text-[14px] font-semibold flex items-center gap-2",children:[e.jsx(ks,{className:"h-4 w-4 text-slate-400"})," Certification"]})}),e.jsx(Ee,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[13px] font-medium text-slate-700",children:"Notify Certification Expiry"}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:"Send notifications before certifications expire"})]}),e.jsx(Be,{name:"notify_certification_expiry",control:v.control,render:({field:E})=>e.jsx(ze,{checked:E.value,onCheckedChange:E.onChange})})]})})]}),e.jsxs(Fe,{children:[e.jsx(Oe,{children:e.jsxs(Qe,{className:"text-[14px] font-semibold flex items-center gap-2",children:[e.jsx(st,{className:"h-4 w-4 text-slate-400"})," Budget & LMS"]})}),e.jsxs(Ee,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[13px] font-medium text-slate-700",children:"LMS Integration Enabled"}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:"Enable external LMS integration features"})]}),e.jsx(Be,{name:"lms_integration_enabled",control:v.control,render:({field:E})=>e.jsx(ze,{checked:E.value,onCheckedChange:E.onChange})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-[13px] font-medium text-slate-700",children:"Training Bond Enabled"}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:"Apply training bonds to eligible enrollments"})]}),e.jsx(Be,{name:"training_bond_enabled",control:v.control,render:({field:E})=>e.jsx(ze,{checked:E.value,onCheckedChange:E.onChange})})]})]})]})]})]})}function Hi(){return e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(as,{className:"h-5 w-5 text-primary"})," Training Reports"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"View training reports and completion metrics"})]})}),e.jsxs(Fe,{children:[e.jsx(Oe,{children:e.jsx(Qe,{className:"text-[14px] font-semibold",children:"Report Center"})}),e.jsx(Ee,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(as,{className:"h-10 w-10 text-slate-300 mb-3"}),e.jsx("p",{className:"text-[14px] font-medium text-slate-600",children:"Coming Soon"}),e.jsx("p",{className:"text-[13px] text-slate-400 mt-1 max-w-sm",children:"Generate training completion reports, compliance summaries, and department participation metrics."})]})})]})]})}function Wi(){return e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(ns,{className:"h-5 w-5 text-primary"})," Training Analytics"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Explore training trends and ROI analytics"})]})}),e.jsxs(Fe,{children:[e.jsx(Oe,{children:e.jsx(Qe,{className:"text-[14px] font-semibold",children:"Analytics Dashboard"})}),e.jsx(Ee,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ns,{className:"h-10 w-10 text-slate-300 mb-3"}),e.jsx("p",{className:"text-[14px] font-medium text-slate-600",children:"Coming Soon"}),e.jsx("p",{className:"text-[13px] text-slate-400 mt-1 max-w-sm",children:"Analyze enrollment trends, completion rates, budget utilization, and training ROI."})]})})]})]})}export{Oi as AssessmentsPage,Qi as AttemptsPage,Ii as BehaviorAssessmentsPage,Ti as CertificationsPage,Ki as CurriculaPage,zi as DevelopmentActionsPage,Ui as DevelopmentPlansPage,Di as EmployeeSkillsPage,Ei as EnrollmentsPage,Gi as LMSIntegrationsPage,Li as LessonsPage,qi as ProgramsPage,Fi as SessionsPage,Ai as SkillsPage,Ri as TrainersPage,Wi as TrainingAnalyticsPage,wi as TrainingDashboardPage,Mi as TrainingFeedbackPage,ci as TrainingLayout,$i as TrainingModulesPage,Vi as TrainingNeedsPage,Hi as TrainingReportsPage,Yi as TrainingSettingsPage,Bi as TrainingVendorsPage,ea as useApproveEnrollment,hi as useApproveTrainingNeed,Bt as useArchiveProgram,Fs as useAssessments,ra as useAttempts,da as useBehaviorAssessments,Jt as useCancelSession,jt as useCertifications,sa as useCompleteEnrollment,Zt as useCompleteSession,aa as useCreateAssessment,la as useCreateAttempt,ma as useCreateBehaviorAssessment,yt as useCreateCertification,At as useCreateCurriculum,Vt as useCreateCurriculumModule,ja as useCreateDevelopmentAction,xa as useCreateDevelopmentPlan,ui as useCreateEmployeeCertification,pt as useCreateEmployeeSkill,di as useCreateEndorsement,Xt as useCreateEnrollment,Ci as useCreateExternalCourse,Ni as useCreateFeedbackForm,Na as useCreateLMSIntegration,Ot as useCreateLesson,It as useCreateProgram,Gt as useCreateSession,dt as useCreateSkill,qt as useCreateTrainer,fi as useCreateTrainingAttendance,oa as useCreateTrainingFeedback,_t as useCreateTrainingNeed,kt as useCreateVendor,ws as useCurricula,qs as useCurriculumModules,ia as useDeleteAssessment,vt as useDeleteCertification,Tt as useDeleteCurriculum,$t as useDeleteCurriculumModule,fa as useDeleteDevelopmentAction,ha as useDeleteDevelopmentPlan,pi as useDeleteEmployeeCertification,gt as useDeleteEmployeeSkill,ta as useDeleteEnrollment,Pi as useDeleteExternalCourse,Si as useDeleteFeedbackForm,Sa as useDeleteLMSIntegration,Mt as useDeleteLesson,zt as useDeleteProgram,Ht as useDeleteSession,ut as useDeleteSkill,Et as useDeleteTrainer,bt as useDeleteTrainingNeed,wt as useDeleteVendor,ga as useDevelopmentActions,Es as useDevelopmentPlans,mi as useEmployeeCertifications,xt as useEmployeeSkills,ls as useEnrollments,bi as useExternalCourses,vi as useFeedbackForms,va as useLMSIntegrations,Lt as useLessons,gi as useProgramDetail,is as usePrograms,Rt as usePublishProgram,ji as useSessionDetail,rs as useSessions,oi as useSkillEndorsements,ts as useSkills,Wt as useStartSession,Ps as useTrainers,yi as useTrainingAttendance,ba as useTrainingDashboard,ca as useTrainingFeedback,Nt as useTrainingNeeds,ct as useTrainingSettings,na as useUpdateAssessment,ua as useUpdateBehaviorAssessment,ft as useUpdateCertification,Dt as useUpdateCurriculum,Kt as useUpdateCurriculumModule,ya as useUpdateDevelopmentAction,pa as useUpdateDevelopmentPlan,xi as useUpdateEmployeeCertification,ht as useUpdateEmployeeSkill,ki as useUpdateExternalCourse,_i as useUpdateFeedbackForm,_a as useUpdateLMSIntegration,Qt as useUpdateLesson,Ut as useUpdateProgram,Yt as useUpdateSession,mt as useUpdateSkill,Ft as useUpdateTrainer,St as useUpdateTrainingNeed,ot as useUpdateTrainingSettings,Pt as useUpdateVendor,Ct as useVendors};
