import{j as e,b as L,a as B,u as ee}from"./query-PJ0ZdjbV.js";import{f as Ot,a as h,O as Mt,k as Ut}from"./vendor-CWhr2lg4.js";import{a2 as rt,b0 as oe,U as it,b_ as gt,cz as vt,o as _t,cj as Gt,bz as bt,bf as Yt,ap as Ue,p as C,a4 as u,l as D,d as we,h as qe,e as Ge,f as Ye,B as b,P as xe,I as N,aa as te,ab as se,ac as ae,ad as ne,ae as re,q as i,s as ve,t as _e,v as be,w as Ne,x as Z,af as ie,ag as ue,ah as he,ai as fe,aj as J,y as Ae,C as Nt,aT as Ct,Q as Le,V as Be,W as De,Y as ze,Z as Ke,_ as $e,$ as Ie,a0 as Qe,ak as Oe,r as Ht,at as Ee,L as Wt}from"./index-BSPIaiZU.js";import{L as St}from"./layout-dashboard-pgzECxsO.js";import{F as st}from"./file-text-BeBoTfpI.js";import{L as Pt}from"./layers-DdTlMVfO.js";import{T as lt}from"./trending-up-Cognoqa9.js";import{C as Xt,a as ct}from"./credit-card-PomeIV5Q.js";import{D as Xe}from"./dollar-sign-yf9aN9ug.js";import{G as Jt}from"./gift-DT0Mx4Cc.js";import{F as wt}from"./file-check-CTWievMk.js";import{R as Je}from"./receipt-CEyVv6aR.js";import{A as qt}from"./award-BB4qCp8n.js";import{F as at}from"./file-chart-column-increasing-DonUpE5r.js";import{C as nt}from"./chart-column-DbfNf7gS.js";import{B as ce}from"./badge-C34iUAiA.js";import{u as me,t as de,o as pe,s as j,e as Pe,b as ge,a as ke,c as ht}from"./date-range-picker-BB0TgAn8.js";import{S as Re}from"./skeleton-CfUgaIb_.js";import{D as je}from"./data-table-D_-xOEqd.js";import{E as Te}from"./employee-select-DtUobKxP.js";import{A as le}from"./async-select-BUbwdJEZ.js";import{E as ye}from"./ellipsis-DaNBIBaV.js";import{R as Zt}from"./refresh-cw-DkxP9YPQ.js";import{u as Ve,F as es,a as ts,J as ss,B as as}from"./system-admin.api-BT5u-_A_.js";import{S as Me}from"./status-badge-DPaiL_rL.js";import{P as Fe}from"./pencil-Dl5fXQYl.js";import{i as He,w as Ze}from"./date-validation-D9gNvaP9.js";import{R as ns}from"./rocket-dddDjFyA.js";import{C as et}from"./circle-check-big-DY9NZlUS.js";import{L as rs}from"./lock-mVL2BhFn.js";import{u as Ce}from"./use-data-table-state-CKRg6qY2.js";import{E as Ft}from"./eye-DlIcvqP-.js";import{H as is}from"./heart-polFWSKf.js";import{A as ot}from"./approval-status-pill-FaqYhoSe.js";import{C as mt}from"./circle-x-C0sF-Oht.js";import{S as ls}from"./send-hExJQKXK.js";import{S as cs}from"./save-DGfbXnAg.js";import{S as os}from"./shield-7SCLx_iT.js";import"./ui-aO-W1bxx.js";import"./chevron-left-DLFf1YD2.js";import"./core-hr.api-MChaGqvv.js";import"./circle-alert-9pjtMKqA.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 ms=rt("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
 * @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 dt=rt("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);/**
 * @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 ds=rt("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]),ps=[{heading:"Overview",items:[{to:"/compensation",label:"Dashboard",description:"Compensation overview",icon:St,permission:["compensation","dashboard","read"]}]},{heading:"CTC",items:[{to:"/compensation/ctc-templates",label:"CTC Templates",description:"Salary structure templates",icon:st,permission:["compensation","ctc_template","read"]},{to:"/compensation/employee-ctc",label:"Employee CTC",description:"Employee compensation details",icon:it,permission:["compensation","employee_ctc","read"]},{to:"/compensation/bands",label:"Compensation Bands",description:"Grade-wise salary ranges",icon:Pt,permission:["compensation","band","read"]}]},{heading:"Increments",items:[{to:"/compensation/increment-cycles",label:"Increment Cycles",description:"Annual increment management",icon:lt,permission:["compensation","increment","read"]},{to:"/compensation/recommendations",label:"Recommendations",description:"Increment proposals",icon:gt,permission:["compensation","increment","read"]},{to:"/compensation/budgets",label:"Budgets",description:"Department-wise budgets",icon:Xt,permission:["compensation","increment","read"]}]},{heading:"Variable Pay",items:[{to:"/compensation/variable-pay-plans",label:"Variable Pay Plans",description:"Bonus & incentive plans",icon:vt,permission:["compensation","variable_pay","read"]},{to:"/compensation/variable-pay-calculations",label:"Calculations",description:"Payout calculations",icon:Xe,permission:["compensation","variable_pay","read"]}]},{heading:"Benefits",items:[{to:"/compensation/benefit-programs",label:"Benefit Programs",description:"Insurance & perks",icon:Jt,permission:["compensation","benefit","read"]},{to:"/compensation/benefit-enrollments",label:"Enrollments",description:"Employee enrollments",icon:_t,permission:["compensation","benefit","read"]},{to:"/compensation/benefit-claims",label:"Claims",description:"Benefit claim requests",icon:ct,permission:["compensation","benefit","read"]}]},{heading:"FBP",items:[{to:"/compensation/fbp-plans",label:"FBP Plans",description:"Flexible benefit plans",icon:dt,permission:["compensation","fbp","read"]},{to:"/compensation/fbp-declarations",label:"Declarations",description:"Employee declarations",icon:wt,permission:["compensation","fbp","read"]},{to:"/compensation/fbp-proofs",label:"Proofs",description:"Proof submissions",icon:Je,permission:["compensation","fbp","read"]}]},{heading:"Reimbursements",items:[{to:"/compensation/reimbursement-policies",label:"Policies",description:"Reimbursement rules",icon:st,permission:["compensation","reimbursement","read"]},{to:"/compensation/reimbursement-claims",label:"Claims",description:"Expense claims",icon:Gt,permission:["compensation","reimbursement","read"]}]},{heading:"Total Rewards",items:[{to:"/compensation/total-rewards",label:"Statements",description:"Total rewards overview",icon:qt,permission:["compensation","total_rewards","read"]}]},{heading:"Configuration",items:[{to:"/compensation/settings",label:"Settings",description:"Module configuration",icon:bt,permission:["compensation","settings","read"]}]},{heading:"Insights",items:[{to:"/compensation/reports",label:"Reports",description:"Compensation reports",icon:at,permission:["compensation","report","read"]},{to:"/compensation/analytics",label:"Analytics",description:"Trends & insights",icon:nt,permission:["compensation","analytics","read"]}]}];function xs({item:a,isActive:t}){const s=a.icon;return e.jsxs(Ut,{to:a.to,end:a.to==="/compensation",className:Ue("group relative flex items-center gap-3 rounded-lg px-3 py-2.5 transition-all duration-150",t?"bg-primary-subtle/70":"hover:bg-slate-50"),children:[t&&e.jsx("span",{className:"absolute left-0 top-2.5 bottom-2.5 w-[3px] rounded-r-full bg-primary"}),e.jsx("div",{className:Ue("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors duration-150",t?"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(s,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:Ue("block text-[13px] truncate leading-tight",t?"font-medium text-primary":"font-medium text-slate-700 group-hover:text-slate-900"),children:a.label}),e.jsx("span",{className:Ue("block text-[11px] truncate leading-tight mt-0.5",t?"text-primary/60":"text-slate-400"),children:a.description})]})]})}function On(){const a=Ot(),t=h.useRef(null),{hasPermission:s}=oe();h.useEffect(()=>{var v;(v=t.current)==null||v.scrollTo(0,0)},[a.pathname]);const p=h.useMemo(()=>ps.map(v=>({...v,items:v.items.filter(x=>s(x.permission[0],x.permission[1],x.permission[2]))})).filter(v=>v.items.length>0),[s]);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:"Compensation & Benefits"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-slate-400",children:"CTC, increments, benefits & rewards"})]}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-3 scrollbar-thin",children:p.map((v,x)=>e.jsxs("div",{className:Ue(x>0&&"mt-6"),children:[e.jsx("p",{className:"mb-2 px-3 text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400",children:v.heading}),e.jsx("div",{className:"space-y-0.5",children:v.items.map(y=>{const d=Yt(a.pathname,y.to,y.to==="/compensation");return e.jsx(xs,{item:y,isActive:d},y.to)})})]},v.heading))})]}),e.jsx("main",{ref:t,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(Mt,{})})})]})}const S="/compensation",P={settings:["compensation","settings"],bands:["compensation","bands"],band:a=>["compensation","bands",a],ctcTemplates:["compensation","ctc-templates"],ctcTemplate:a=>["compensation","ctc-templates",a],employeeCTCs:["compensation","employee-ctc"],employeeCTC:a=>["compensation","employee-ctc",a],incrementCycles:["compensation","increment-cycles"],incrementCycle:a=>["compensation","increment-cycles",a],incrementRecommendations:["compensation","increment-recommendations"],incrementBudgets:["compensation","increment-budgets"],variablePayPlans:["compensation","variable-pay-plans"],variablePayCalculations:["compensation","variable-pay-calculations"],fbpPlans:["compensation","fbp-plans"],fbpDeclarations:["compensation","fbp-declarations"],fbpProofs:["compensation","fbp-proofs"],benefitPrograms:["compensation","benefit-programs"],benefitEnrollments:["compensation","benefit-enrollments"],benefitClaims:["compensation","benefit-claims"],reimbursementPolicies:["compensation","reimbursement-policies"],reimbursementClaims:["compensation","reimbursement-claims"],totalRewards:["compensation","total-rewards"],dashboard:["compensation","dashboard"]};function us(){return ee({queryKey:P.settings,queryFn:()=>C.get(`${S}/settings/`).then(a=>a.data)})}function hs(){const a=L();return B({mutationFn:t=>C.patch(`${S}/settings/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.settings}),u.success("Settings updated")},onError:t=>u.error(D(t,"Failed to update settings"))})}function fs(a){return ee({queryKey:[...P.bands,a],queryFn:()=>C.get(`${S}/bands/`,{params:a}).then(t=>t.data)})}function Mn(a){return ee({queryKey:P.band(a),queryFn:()=>C.get(`${S}/bands/${a}/`).then(t=>t.data),enabled:!!a})}function js(){const a=L();return B({mutationFn:t=>C.post(`${S}/bands/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.bands}),u.success("Compensation band created")},onError:t=>u.error(D(t,"Failed to create compensation band"))})}function ys(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/bands/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.bands}),u.success("Compensation band updated")},onError:t=>u.error(D(t,"Failed to update compensation band"))})}function gs(){const a=L();return B({mutationFn:t=>C.delete(`${S}/bands/${t}/`),onSuccess:()=>{a.invalidateQueries({queryKey:P.bands}),u.success("Compensation band deleted")},onError:t=>u.error(D(t,"Failed to delete compensation band"))})}function kt(a){return ee({queryKey:[...P.ctcTemplates,a],queryFn:()=>C.get(`${S}/ctc-templates/`,{params:a}).then(t=>t.data)})}function Un(a){return ee({queryKey:P.ctcTemplate(a),queryFn:()=>C.get(`${S}/ctc-templates/${a}/`).then(t=>t.data),enabled:!!a})}function vs(){const a=L();return B({mutationFn:t=>C.post(`${S}/ctc-templates/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.ctcTemplates}),u.success("CTC template created")},onError:t=>u.error(D(t,"Failed to create CTC template"))})}function _s(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/ctc-templates/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.ctcTemplates}),u.success("CTC template updated")},onError:t=>u.error(D(t,"Failed to update CTC template"))})}function bs(){const a=L();return B({mutationFn:t=>C.delete(`${S}/ctc-templates/${t}/`),onSuccess:()=>{a.invalidateQueries({queryKey:P.ctcTemplates}),u.success("CTC template deleted")},onError:t=>u.error(D(t,"Failed to delete CTC template"))})}function Ns(a){return ee({queryKey:[...P.employeeCTCs,a],queryFn:()=>C.get(`${S}/employee-ctc/`,{params:a}).then(t=>t.data)})}function Gn(a){return ee({queryKey:P.employeeCTC(a),queryFn:()=>C.get(`${S}/employee-ctc/${a}/`).then(t=>t.data),enabled:!!a})}function Cs(){const a=L();return B({mutationFn:t=>C.post(`${S}/employee-ctc/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.employeeCTCs}),u.success("Employee CTC created")},onError:t=>u.error(D(t,"Failed to create employee CTC"))})}function Ss(){const a=L();return B({mutationFn:({id:t,revision_type:s})=>C.post(`${S}/employee-ctc/${t}/revise/`,{revision_type:s}).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.employeeCTCs}),u.success("CTC revised successfully")},onError:t=>u.error(D(t,"Failed to revise CTC"))})}function pt(a){return ee({queryKey:[...P.incrementCycles,a],queryFn:()=>C.get(`${S}/increment-cycles/`,{params:a}).then(t=>t.data)})}function Yn(a){return ee({queryKey:P.incrementCycle(a),queryFn:()=>C.get(`${S}/increment-cycles/${a}/`).then(t=>t.data),enabled:!!a})}function Ps(){const a=L();return B({mutationFn:t=>C.post(`${S}/increment-cycles/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementCycles}),u.success("Increment cycle created")},onError:t=>u.error(D(t,"Failed to create increment cycle"))})}function ws(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/increment-cycles/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementCycles}),u.success("Increment cycle updated")},onError:t=>u.error(D(t,"Failed to update increment cycle"))})}function qs(){const a=L();return B({mutationFn:t=>C.post(`${S}/increment-cycles/${t}/launch/`).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementCycles}),u.success("Increment cycle launched")},onError:t=>u.error(D(t,"Failed to launch increment cycle"))})}function Fs(){const a=L();return B({mutationFn:t=>C.post(`${S}/increment-cycles/${t}/finalize/`).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementCycles}),u.success("Increment cycle finalized")},onError:t=>u.error(D(t,"Failed to finalize increment cycle"))})}function ks(){const a=L();return B({mutationFn:t=>C.post(`${S}/increment-cycles/${t}/lock/`).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementCycles}),u.success("Increment cycle locked")},onError:t=>u.error(D(t,"Failed to lock increment cycle"))})}function Es(a){return ee({queryKey:[...P.incrementRecommendations,a],queryFn:()=>C.get(`${S}/increment-recommendations/`,{params:a}).then(t=>t.data)})}function Rs(){const a=L();return B({mutationFn:t=>C.post(`${S}/increment-recommendations/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementRecommendations}),u.success("Recommendation created")},onError:t=>u.error(D(t,"Failed to create recommendation"))})}function Ts(){const a=L();return B({mutationFn:({id:t,...s})=>C.post(`${S}/increment-recommendations/${t}/approve/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementRecommendations}),u.success("Recommendation approved")},onError:t=>u.error(D(t,"Failed to approve recommendation"))})}function Vs(){const a=L();return B({mutationFn:t=>C.post(`${S}/increment-recommendations/${t}/reject/`).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementRecommendations}),u.success("Recommendation rejected")},onError:t=>u.error(D(t,"Failed to reject recommendation"))})}function As(a){return ee({queryKey:[...P.incrementBudgets,a],queryFn:()=>C.get(`${S}/increment-budgets/`,{params:a}).then(t=>t.data)})}function Ls(){const a=L();return B({mutationFn:t=>C.post(`${S}/increment-budgets/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementBudgets}),u.success("Budget created")},onError:t=>u.error(D(t,"Failed to create budget"))})}function Bs(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/increment-budgets/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.incrementBudgets}),u.success("Budget updated")},onError:t=>u.error(D(t,"Failed to update budget"))})}function Et(a){return ee({queryKey:[...P.variablePayPlans,a],queryFn:()=>C.get(`${S}/variable-pay-plans/`,{params:a}).then(t=>t.data)})}function Ds(){const a=L();return B({mutationFn:t=>C.post(`${S}/variable-pay-plans/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.variablePayPlans}),u.success("Variable pay plan created")},onError:t=>u.error(D(t,"Failed to create variable pay plan"))})}function zs(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/variable-pay-plans/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.variablePayPlans}),u.success("Variable pay plan updated")},onError:t=>u.error(D(t,"Failed to update variable pay plan"))})}function Ks(){const a=L();return B({mutationFn:t=>C.delete(`${S}/variable-pay-plans/${t}/`),onSuccess:()=>{a.invalidateQueries({queryKey:P.variablePayPlans}),u.success("Variable pay plan deleted")},onError:t=>u.error(D(t,"Failed to delete variable pay plan"))})}function $s(a){return ee({queryKey:[...P.variablePayCalculations,a],queryFn:()=>C.get(`${S}/variable-pay-calculations/`,{params:a}).then(t=>t.data)})}function Is(){const a=L();return B({mutationFn:t=>C.post(`${S}/variable-pay-calculations/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.variablePayCalculations}),u.success("Calculation created")},onError:t=>u.error(D(t,"Failed to create calculation"))})}function Rt(a){return ee({queryKey:[...P.fbpPlans,a],queryFn:()=>C.get(`${S}/fbp-plans/`,{params:a}).then(t=>t.data)})}function Qs(){const a=L();return B({mutationFn:t=>C.post(`${S}/fbp-plans/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpPlans}),u.success("FBP plan created")},onError:t=>u.error(D(t,"Failed to create FBP plan"))})}function Os(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/fbp-plans/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpPlans}),u.success("FBP plan updated")},onError:t=>u.error(D(t,"Failed to update FBP plan"))})}function Ms(){const a=L();return B({mutationFn:t=>C.delete(`${S}/fbp-plans/${t}/`),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpPlans}),u.success("FBP plan deleted")},onError:t=>u.error(D(t,"Failed to delete FBP plan"))})}function Tt(a){return ee({queryKey:[...P.fbpDeclarations,a],queryFn:()=>C.get(`${S}/fbp-declarations/`,{params:a}).then(t=>t.data)})}function Us(){const a=L();return B({mutationFn:t=>C.post(`${S}/fbp-declarations/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpDeclarations}),u.success("FBP declaration created")},onError:t=>u.error(D(t,"Failed to create FBP declaration"))})}function Gs(){const a=L();return B({mutationFn:t=>C.post(`${S}/fbp-declarations/${t}/submit/`).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpDeclarations}),u.success("FBP declaration submitted")},onError:t=>u.error(D(t,"Failed to submit FBP declaration"))})}function Ys(){const a=L();return B({mutationFn:({id:t,...s})=>C.post(`${S}/fbp-declarations/${t}/approve/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpDeclarations}),u.success("FBP declaration approved")},onError:t=>u.error(D(t,"Failed to approve FBP declaration"))})}function Hs(){const a=L();return B({mutationFn:({id:t,comments:s})=>C.post(`${S}/fbp-declarations/${t}/reject/`,{comments:s}).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpDeclarations}),u.success("FBP declaration rejected")},onError:t=>u.error(D(t,"Failed to reject FBP declaration"))})}function Ws(a){return ee({queryKey:[...P.fbpProofs,a],queryFn:()=>C.get(`${S}/fbp-proofs/`,{params:a}).then(t=>t.data)})}function Xs(){const a=L();return B({mutationFn:t=>C.post(`${S}/fbp-proofs/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpProofs}),u.success("FBP proof uploaded")},onError:t=>u.error(D(t,"Failed to upload FBP proof"))})}function Js(){const a=L();return B({mutationFn:({id:t,...s})=>C.post(`${S}/fbp-proofs/${t}/verify/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpProofs}),u.success("FBP proof verified")},onError:t=>u.error(D(t,"Failed to verify FBP proof"))})}function Zs(){const a=L();return B({mutationFn:({id:t,review_comments:s})=>C.post(`${S}/fbp-proofs/${t}/reject/`,{review_comments:s}).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.fbpProofs}),u.success("FBP proof rejected")},onError:t=>u.error(D(t,"Failed to reject FBP proof"))})}function Vt(a){return ee({queryKey:[...P.benefitPrograms,a],queryFn:()=>C.get(`${S}/benefit-programs/`,{params:a}).then(t=>t.data)})}function ea(){const a=L();return B({mutationFn:t=>C.post(`${S}/benefit-programs/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitPrograms}),u.success("Benefit program created")},onError:t=>u.error(D(t,"Failed to create benefit program"))})}function ta(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/benefit-programs/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitPrograms}),u.success("Benefit program updated")},onError:t=>u.error(D(t,"Failed to update benefit program"))})}function sa(){const a=L();return B({mutationFn:t=>C.delete(`${S}/benefit-programs/${t}/`),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitPrograms}),u.success("Benefit program deleted")},onError:t=>u.error(D(t,"Failed to delete benefit program"))})}function At(a){return ee({queryKey:[...P.benefitEnrollments,a],queryFn:()=>C.get(`${S}/benefit-enrollments/`,{params:a}).then(t=>t.data)})}function aa(){const a=L();return B({mutationFn:t=>C.post(`${S}/benefit-enrollments/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitEnrollments}),u.success("Benefit enrollment created")},onError:t=>u.error(D(t,"Failed to create benefit enrollment"))})}function na(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/benefit-enrollments/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitEnrollments}),u.success("Benefit enrollment updated")},onError:t=>u.error(D(t,"Failed to update benefit enrollment"))})}function ra(a){return ee({queryKey:[...P.benefitClaims,a],queryFn:()=>C.get(`${S}/benefit-claims/`,{params:a}).then(t=>t.data)})}function ia(){const a=L();return B({mutationFn:t=>C.post(`${S}/benefit-claims/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitClaims}),u.success("Benefit claim created")},onError:t=>u.error(D(t,"Failed to create benefit claim"))})}function la(){const a=L();return B({mutationFn:({id:t,approved_amount:s})=>C.post(`${S}/benefit-claims/${t}/approve/`,{approved_amount:s}).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitClaims}),u.success("Benefit claim approved")},onError:t=>u.error(D(t,"Failed to approve benefit claim"))})}function ca(){const a=L();return B({mutationFn:({id:t,rejection_reason:s})=>C.post(`${S}/benefit-claims/${t}/reject/`,{rejection_reason:s}).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.benefitClaims}),u.success("Benefit claim rejected")},onError:t=>u.error(D(t,"Failed to reject benefit claim"))})}function Lt(a){return ee({queryKey:[...P.reimbursementPolicies,a],queryFn:()=>C.get(`${S}/reimbursement-policies/`,{params:a}).then(t=>t.data)})}function oa(){const a=L();return B({mutationFn:t=>C.post(`${S}/reimbursement-policies/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.reimbursementPolicies}),u.success("Reimbursement policy created")},onError:t=>u.error(D(t,"Failed to create reimbursement policy"))})}function ma(){const a=L();return B({mutationFn:({id:t,...s})=>C.patch(`${S}/reimbursement-policies/${t}/`,s).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.reimbursementPolicies}),u.success("Reimbursement policy updated")},onError:t=>u.error(D(t,"Failed to update reimbursement policy"))})}function da(){const a=L();return B({mutationFn:t=>C.delete(`${S}/reimbursement-policies/${t}/`),onSuccess:()=>{a.invalidateQueries({queryKey:P.reimbursementPolicies}),u.success("Reimbursement policy deleted")},onError:t=>u.error(D(t,"Failed to delete reimbursement policy"))})}function pa(a){return ee({queryKey:[...P.reimbursementClaims,a],queryFn:()=>C.get(`${S}/reimbursement-claims/`,{params:a}).then(t=>t.data)})}function xa(){const a=L();return B({mutationFn:t=>C.post(`${S}/reimbursement-claims/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.reimbursementClaims}),u.success("Reimbursement claim created")},onError:t=>u.error(D(t,"Failed to create reimbursement claim"))})}function ua(){const a=L();return B({mutationFn:({id:t,approved_amount:s})=>C.post(`${S}/reimbursement-claims/${t}/approve/`,{approved_amount:s}).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.reimbursementClaims}),u.success("Reimbursement claim approved")},onError:t=>u.error(D(t,"Failed to approve reimbursement claim"))})}function ha(){const a=L();return B({mutationFn:({id:t,rejection_reason:s})=>C.post(`${S}/reimbursement-claims/${t}/reject/`,{rejection_reason:s}).then(p=>p.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.reimbursementClaims}),u.success("Reimbursement claim rejected")},onError:t=>u.error(D(t,"Failed to reject reimbursement claim"))})}function fa(a){return ee({queryKey:[...P.totalRewards,a],queryFn:()=>C.get(`${S}/total-rewards/`,{params:a}).then(t=>t.data)})}function ja(){const a=L();return B({mutationFn:t=>C.post(`${S}/total-rewards/`,t).then(s=>s.data),onSuccess:()=>{a.invalidateQueries({queryKey:P.totalRewards}),u.success("Total rewards statement generated")},onError:t=>u.error(D(t,"Failed to generate total rewards statement"))})}function ya(){return ee({queryKey:P.dashboard,queryFn:()=>C.get(`${S}/dashboard/`).then(a=>a.data)})}function Hn(){const{data:a,isLoading:t}=ya(),s=a==null?void 0:a.summary,p=(a==null?void 0:a.ctc_distribution)??[],v=(a==null?void 0:a.recent_increments)??[],x=(a==null?void 0:a.reimbursement_trend)??[],y=[{label:"Total Employees",value:(s==null?void 0:s.total_employees)??0,icon:it,color:"text-slate-600"},{label:"Avg CTC",value:(s==null?void 0:s.avg_ctc)??"--",icon:Xe,color:"text-emerald-600"},{label:"Total Payroll Cost",value:(s==null?void 0:s.total_payroll_cost)??"--",icon:Xe,color:"text-blue-600"},{label:"Active Cycles",value:(s==null?void 0:s.active_increment_cycles)??0,icon:lt,color:"text-purple-600"},{label:"Pending Reimbursements",value:(s==null?void 0:s.pending_reimbursements)??0,icon:Je,color:"text-amber-500"},{label:"Pending Claims",value:(s==null?void 0:s.pending_benefit_claims)??0,icon:ct,color:"text-red-500"}];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(St,{className:"h-5 w-5 text-primary"})," Compensation Dashboard"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Overview of compensation, benefits & rewards"})]})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:y.map(d=>e.jsx(we,{children:e.jsxs(qe,{className:"pt-5 pb-4 px-4",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx(d.icon,{className:`h-4 w-4 ${d.color}`})}),e.jsx("p",{className:"text-2xl font-semibold text-slate-900",children:t?"--":d.value}),e.jsx("p",{className:"text-[12px] text-slate-400 mt-0.5",children:d.label})]})},d.label))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs(we,{children:[e.jsx(Ge,{className:"pb-3",children:e.jsx(Ye,{className:"text-[14px] font-semibold",children:"CTC Distribution by Band"})}),e.jsx(qe,{children:t?e.jsx("p",{className:"text-[13px] text-slate-400",children:"Loading..."}):p.length===0?e.jsx("p",{className:"text-[13px] text-slate-400",children:"No data available"}):e.jsx("div",{className:"space-y-3",children:p.map((d,V)=>e.jsxs("div",{className:"flex items-center justify-between text-[13px] py-1.5 border-b border-slate-50 last:border-0",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-slate-700",children:d.band_name}),e.jsxs("span",{className:"text-slate-400 text-[11px] ml-2",children:[d.employee_count," employees"]})]}),e.jsx("span",{className:"text-slate-600 font-medium",children:d.avg_ctc})]},V))})})]}),e.jsxs(we,{children:[e.jsx(Ge,{className:"pb-3",children:e.jsx(Ye,{className:"text-[14px] font-semibold",children:"Recent Increments"})}),e.jsx(qe,{children:t?e.jsx("p",{className:"text-[13px] text-slate-400",children:"Loading..."}):v.length===0?e.jsx("p",{className:"text-[13px] text-slate-400",children:"No recent increments"}):e.jsx("div",{className:"space-y-3",children:v.slice(0,10).map((d,V)=>e.jsxs("div",{className:"flex items-center justify-between text-[13px]",children:[e.jsx("span",{className:"font-medium text-slate-700",children:d.employee_name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ce,{variant:"success",className:"text-[10px]",children:["+",d.increment_percentage,"%"]}),e.jsx("span",{className:"text-slate-400 text-[11px]",children:d.effective_date})]})]},V))})})]}),e.jsxs(we,{children:[e.jsx(Ge,{className:"pb-3",children:e.jsx(Ye,{className:"text-[14px] font-semibold",children:"Reimbursement Trend"})}),e.jsx(qe,{children:t?e.jsx("p",{className:"text-[13px] text-slate-400",children:"Loading..."}):x.length===0?e.jsx("p",{className:"text-[13px] text-slate-400",children:"No reimbursement data"}):e.jsx("div",{className:"space-y-3",children:x.map((d,V)=>e.jsxs("div",{className:"flex items-center justify-between text-[13px] py-1.5 border-b border-slate-50 last:border-0",children:[e.jsx("span",{className:"text-slate-600 font-medium",children:d.month}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-slate-700 font-medium",children:d.total_amount}),e.jsxs(ce,{variant:"secondary",className:"text-[10px]",children:[d.claim_count," claims"]})]})]},V))})})]})]})]})}const ft=[{value:"new_hire",label:"New Hire"},{value:"annual_increment",label:"Annual Increment"},{value:"promotion",label:"Promotion"},{value:"correction",label:"Correction"},{value:"market_adjustment",label:"Market Adjustment"},{value:"retention",label:"Retention"}],ga=pe({employee:j().min(1,"Employee is required"),ctc_template:j().optional(),annual_ctc:j().min(1,"Annual CTC is required"),effective_from:j().min(1,"Effective date is required"),revision_type:Pe(["new_hire","annual_increment","promotion","correction","market_adjustment","retention"]),notes:j().optional()});function Wn(){const[a,t]=h.useState(1),[s,p]=h.useState(""),[v,x]=h.useState(!1),[y,d]=h.useState(!1),[V,A]=h.useState(null),[G,M]=h.useState("annual_increment"),{hasPermission:Y,requirePermission:Q}=oe(),T=Y("compensation","employee_ctc","create"),I=Y("compensation","employee_ctc","update"),X=h.useMemo(()=>({page:a,page_size:20,...s&&{search:s}}),[a,s]),{data:E,isLoading:z}=Ns(X),K=(E==null?void 0:E.results)??[],$=(E==null?void 0:E.count)??0,[W,F]=h.useState(""),{data:R,isLoading:U}=kt({is_active:!0,page_size:100,search:W||void 0}),k=(R==null?void 0:R.results)??[],O=Cs(),c=Ss(),o=me({resolver:de(ga),defaultValues:{employee:"",ctc_template:"",annual_ctc:"",effective_from:"",revision_type:"new_hire",notes:""}});function f(r){O.mutate({employee:r.employee,ctc_template:r.ctc_template||void 0,annual_ctc:r.annual_ctc,effective_from:r.effective_from,revision_type:r.revision_type,notes:r.notes},{onSuccess:()=>{x(!1),o.reset()}})}function m(){V&&c.mutate({id:V.id,revision_type:G},{onSuccess:()=>{d(!1),A(null)}})}function q(r){Q("compensation","employee_ctc","update")&&(A(r),M("annual_increment"),d(!0))}const l=[{accessorKey:"employee_name",header:"Employee",cell:({row:r})=>e.jsx("span",{className:"text-[13px] font-medium text-slate-800",children:r.original.employee_name??"--"})},{accessorKey:"annual_ctc",header:"Annual CTC",cell:({row:r})=>e.jsx("span",{className:"text-[13px] font-semibold text-slate-800",children:r.original.annual_ctc})},{accessorKey:"monthly_gross",header:"Monthly Gross",cell:({row:r})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.original.monthly_gross})},{accessorKey:"total_cost_to_company",header:"Total Cost",cell:({row:r})=>e.jsx("span",{className:"text-[12px] text-slate-500",children:r.original.total_cost_to_company})},{accessorKey:"template_name",header:"Template",cell:({row:r})=>r.original.template_name?e.jsx(ce,{variant:"secondary",className:"text-[10px]",children:r.original.template_name}):e.jsx("span",{className:"text-[11px] text-slate-400",children:"--"})},{accessorKey:"effective_from",header:"Effective From",cell:({row:r})=>e.jsx("span",{className:"text-[12px] text-slate-500",children:r.original.effective_from})},{accessorKey:"revision_type",header:"Type",cell:({row:r})=>e.jsx(ce,{variant:"outline",className:"text-[10px] capitalize",children:r.original.revision_type_display??r.original.revision_type})},{accessorKey:"status",header:"Status",cell:({row:r})=>e.jsx(ce,{variant:"secondary",className:"text-[10px] capitalize",children:r.original.status_display??r.original.status.replace(/_/g," ")})},{id:"actions",header:"",cell:({row:r})=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsx(fe,{align:"end",children:I&&r.original.status==="active"&&e.jsxs(J,{onClick:()=>q(r.original),children:[e.jsx(Zt,{className:"h-3.5 w-3.5 mr-2"})," Revise CTC"]})})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",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"})," Employee CTC"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage employee compensation details and revisions"})]}),T&&e.jsxs(b,{size:"sm",onClick:()=>x(!0),children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"})," Assign CTC"]})]}),e.jsx("div",{className:"flex items-center gap-3 mb-4",children:e.jsx(N,{placeholder:"Search employees...",value:s,onChange:r=>{p(r.target.value),t(1)},className:"w-[280px] h-9"})}),z?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((r,w)=>e.jsx(Re,{className:"h-12 w-full"},w))}):e.jsx(je,{columns:l,data:K,totalCount:$,pagination:{pageIndex:a-1,pageSize:20},onPaginationChange:r=>{const w=typeof r=="function"?r({pageIndex:a-1,pageSize:20}):r;t(w.pageIndex+1)}}),e.jsx(te,{open:v,onOpenChange:x,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Assign Employee CTC"}),e.jsx(re,{children:"Create a new CTC record for an employee."})]}),e.jsxs("form",{onSubmit:o.handleSubmit(f),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Te,{value:o.watch("employee"),onValueChange:r=>o.setValue("employee",r,{shouldValidate:!0})})}),o.formState.errors.employee&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"CTC Template"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:o.watch("ctc_template")??"",onValueChange:r=>o.setValue("ctc_template",r==="__none__"?"":r),onSearch:F,isLoading:U,options:[{value:"__none__",label:"No Template"},...k.map(r=>({value:r.id,label:r.name,hint:r.code}))],placeholder:"Select template (optional)"})})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Annual CTC *"}),e.jsx(N,{...o.register("annual_ctc"),placeholder:"e.g. 1200000",className:"mt-1.5"}),o.formState.errors.annual_ctc&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.annual_ctc.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective From *"}),e.jsx(N,{type:"date",...o.register("effective_from"),className:"mt-1.5"}),o.formState.errors.effective_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.effective_from.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Revision Type *"}),e.jsxs(ve,{value:o.watch("revision_type"),onValueChange:r=>o.setValue("revision_type",r),children:[e.jsx(_e,{className:"mt-1.5",children:e.jsx(be,{})}),e.jsx(Ne,{children:ft.map(r=>e.jsx(Z,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Notes"}),e.jsx(N,{...o.register("notes"),placeholder:"Optional notes",className:"mt-1.5"})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>x(!1),children:"Cancel"}),e.jsx(b,{onClick:o.handleSubmit(f),disabled:O.isPending,children:O.isPending?"Saving...":"Save"})]})]})}),e.jsx(te,{open:y,onOpenChange:d,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Revise CTC"}),e.jsxs(re,{children:["Revising CTC for ",(V==null?void 0:V.employee_name)??"employee",". Current: ",(V==null?void 0:V.annual_ctc)??"--"]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsx("p",{className:"text-[13px] text-slate-500",children:"This supersedes the current CTC and creates a new draft revision carrying over the existing amounts. Pick the reason for the revision."}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Revision Type *"}),e.jsxs(ve,{value:G,onValueChange:r=>M(r),children:[e.jsx(_e,{className:"mt-1.5",children:e.jsx(be,{})}),e.jsx(Ne,{children:ft.map(r=>e.jsx(Z,{value:r.value,children:r.label},r.value))})]})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(b,{onClick:m,disabled:c.isPending,children:c.isPending?"Revising...":"Revise CTC"})]})]})})]})}const va=pe({company:j().min(1,"Company is required"),name:j().min(1,"Name is required"),code:j().min(1,"Code is required"),effective_from:j().min(1,"Effective date is required"),is_active:ge()});function Xn(){const[a,t]=h.useState(1),[s,p]=h.useState(""),[v,x]=h.useState(!1),[y,d]=h.useState(null),{hasPermission:V,requirePermission:A}=oe(),G=V("compensation","ctc_template","create"),M=V("compensation","ctc_template","update"),Y=V("compensation","ctc_template","delete"),Q=h.useMemo(()=>({page:a,page_size:20,...s&&{search:s}}),[a,s]),{data:T,isLoading:I}=kt(Q),X=(T==null?void 0:T.results)??[],E=(T==null?void 0:T.count)??0,[z,K]=h.useState(""),{data:$,isLoading:W}=Ve({search:z||void 0}),F=($==null?void 0:$.results)??[],R=vs(),U=_s(),k=bs(),O=()=>{var l;return{company:((l=F[0])==null?void 0:l.id)??"",name:"",code:"",effective_from:"",is_active:!0}},c=me({resolver:de(va),defaultValues:O()});function o(){A("compensation","ctc_template","create")&&(d(null),c.reset(O()),x(!0))}function f(l){A("compensation","ctc_template","update")&&(d(l),c.reset({company:l.company,name:l.name,code:l.code,effective_from:l.effective_from,is_active:l.is_active}),x(!0))}function m(l){y?U.mutate({id:y.id,...l},{onSuccess:()=>{x(!1),d(null)}}):R.mutate(l,{onSuccess:()=>{x(!1),c.reset(O())}})}const q=[{accessorKey:"name",header:"Name",cell:({row:l})=>e.jsx("span",{className:"text-[13px] font-medium text-slate-800",children:l.original.name})},{accessorKey:"code",header:"Code",cell:({row:l})=>e.jsx("span",{className:"text-[12px] font-mono text-slate-500",children:l.original.code})},{accessorKey:"component_count",header:"Components",cell:({row:l})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:l.original.component_count??0})},{accessorKey:"is_active",header:"Status",cell:({row:l})=>e.jsx(Me,{status:l.original.is_active?"active":"inactive"})},{accessorKey:"created_at",header:"Created",cell:({row:l})=>{var r;return e.jsx("span",{className:"text-[12px] text-slate-500",children:(r=l.original.created_at)==null?void 0:r.slice(0,10)})}},{id:"actions",header:"",cell:({row:l})=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[M&&e.jsxs(J,{onClick:()=>f(l.original),children:[e.jsx(Fe,{className:"h-3.5 w-3.5 mr-2"})," Edit"]}),Y&&e.jsxs(J,{onClick:()=>k.mutate(l.original.id),className:"text-red-600",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 mr-2"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(ms,{className:"h-5 w-5 text-primary"})," CTC Templates"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage CTC structure templates for employee compensation"})]}),G&&e.jsxs(b,{size:"sm",onClick:o,children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"})," New Template"]})]}),e.jsx("div",{className:"flex items-center gap-3 mb-4",children:e.jsx(N,{placeholder:"Search templates...",value:s,onChange:l=>{p(l.target.value),t(1)},className:"w-[280px] h-9"})}),I?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((l,r)=>e.jsx(Re,{className:"h-12 w-full"},r))}):e.jsx(je,{columns:q,data:X,totalCount:E,pagination:{pageIndex:a-1,pageSize:20},onPaginationChange:l=>{const r=typeof l=="function"?l({pageIndex:a-1,pageSize:20}):l;t(r.pageIndex+1)}}),e.jsx(te,{open:v,onOpenChange:x,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:y?"Edit CTC Template":"New CTC Template"}),e.jsx(re,{children:y?"Update template details.":"Create a new CTC template for employee compensation."})]}),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(i,{className:"text-[12px] font-medium text-slate-500",children:"Company *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:c.watch("company")??null,onValueChange:l=>c.setValue("company",l,{shouldValidate:!0}),onSearch:K,isLoading:W,selectedLabel:y==null?void 0:y.company_name,options:F.map(l=>({value:l.id,label:l.name,hint:l.code})),placeholder:"Select company",searchPlaceholder:"Search companies..."})}),c.formState.errors.company&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.company.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Template Name *"}),e.jsx(N,{...c.register("name"),placeholder:"e.g. Standard CTC Structure",className:"mt-1.5"}),c.formState.errors.name&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx(N,{...c.register("code"),placeholder:"e.g. STD-CTC",className:"mt-1.5"}),c.formState.errors.code&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective From *"}),e.jsx(N,{type:"date",...c.register("effective_from"),className:"mt-1.5"}),c.formState.errors.effective_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.effective_from.message})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"is_active",...c.register("is_active"),className:"h-4 w-4 rounded border-slate-300"}),e.jsx(i,{htmlFor:"is_active",children:"Active"})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>x(!1),children:"Cancel"}),e.jsx(b,{onClick:c.handleSubmit(m),disabled:R.isPending||U.isPending,children:R.isPending||U.isPending?"Saving...":y?"Update":"Create"})]})]})})]})}const _a=[{value:"metro",label:"Metro"},{value:"tier1",label:"Tier 1"},{value:"tier2",label:"Tier 2"},{value:"tier3",label:"Tier 3"},{value:"remote",label:"Remote"}],ba=pe({company:j().min(1,"Company is required"),grade:j().min(1,"Grade is required"),designation:j().optional(),location_type:Pe(["metro","tier1","tier2","tier3","remote"]),min_ctc:j().min(1,"Min CTC is required"),mid_ctc:j().optional(),max_ctc:j().min(1,"Max CTC is required"),currency:j().nullable().optional(),effective_from:j().min(1,"Effective date is required")});function Jn(){var ut;const[a,t]=h.useState(1),[s,p]=h.useState(""),[v,x]=h.useState(!1),[y,d]=h.useState(null),{hasPermission:V,requirePermission:A}=oe(),G=V("compensation","band","create"),M=V("compensation","band","update"),Y=V("compensation","band","delete"),Q=h.useMemo(()=>({page:a,page_size:20,...s&&{search:s}}),[a,s]),{data:T,isLoading:I}=fs(Q),X=(T==null?void 0:T.results)??[],E=(T==null?void 0:T.count)??0,[z,K]=h.useState(""),{data:$,isLoading:W}=Ve({search:z||void 0}),F=($==null?void 0:$.results)??[],[R,U]=h.useState(""),{data:k,isLoading:O}=es({search:R||void 0}),c=(k==null?void 0:k.results)??[],[o,f]=h.useState(""),{data:m,isLoading:q}=ts({search:o||void 0}),l=(m==null?void 0:m.results)??[],r=js(),w=ys(),n=gs(),_=()=>{var g;return{company:((g=F[0])==null?void 0:g.id)??"",grade:"",designation:"",location_type:"metro",min_ctc:"",mid_ctc:"",max_ctc:"",currency:null,effective_from:""}},H=me({resolver:de(ba),defaultValues:_()}),[Bt,Dt]=h.useState(""),We=H.watch("grade"),{data:tt,isLoading:zt}=ss({search:Bt||void 0,...We?{grade:We}:{}}),Kt=(tt==null?void 0:tt.results)??[];function $t(){A("compensation","band","create")&&(d(null),H.reset(_()),x(!0))}function It(g){A("compensation","band","update")&&(d(g),H.reset({company:g.company,grade:g.grade,designation:g.designation??"",location_type:g.location_type,min_ctc:g.min_ctc,mid_ctc:g.mid_ctc,max_ctc:g.max_ctc,currency:g.currency??null,effective_from:g.effective_from}),x(!0))}function xt(g){const Se={company:g.company,grade:g.grade,designation:g.designation||null,location_type:g.location_type,min_ctc:g.min_ctc,mid_ctc:g.mid_ctc||void 0,max_ctc:g.max_ctc,currency:g.currency||null,effective_from:g.effective_from};y?w.mutate({id:y.id,...Se},{onSuccess:()=>{x(!1),d(null)}}):r.mutate(Se,{onSuccess:()=>{x(!1),H.reset(_())}})}const Qt=[{accessorKey:"grade_name",header:"Grade",cell:({row:g})=>e.jsx("span",{className:"text-[13px] font-medium text-slate-800",children:g.original.grade_name??"--"})},{accessorKey:"designation_name",header:"Designation",cell:({row:g})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:g.original.designation_name??"--"})},{accessorKey:"location_type",header:"Location",cell:({row:g})=>e.jsx(ce,{variant:"secondary",className:"text-[10px] capitalize",children:g.original.location_type_display??g.original.location_type})},{accessorKey:"min_ctc",header:"Band Min",cell:({row:g})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:g.original.min_ctc})},{accessorKey:"max_ctc",header:"Band Max",cell:({row:g})=>e.jsx("span",{className:"text-[13px] font-semibold text-slate-800",children:g.original.max_ctc})},{accessorKey:"currency",header:"Currency",cell:({row:g})=>{var Se;return e.jsx(ce,{variant:"secondary",className:"text-[10px]",children:((Se=g.original.currency_detail)==null?void 0:Se.code)??"--"})}},{accessorKey:"effective_from",header:"Effective From",cell:({row:g})=>e.jsx("span",{className:"text-[12px] text-slate-500",children:g.original.effective_from})},{id:"actions",header:"",cell:({row:g})=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[M&&e.jsxs(J,{onClick:()=>It(g.original),children:[e.jsx(Fe,{className:"h-3.5 w-3.5 mr-2"})," Edit"]}),Y&&e.jsxs(J,{onClick:()=>n.mutate(g.original.id),className:"text-red-600",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 mr-2"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Pt,{className:"h-5 w-5 text-primary"})," Compensation Bands"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Define salary bands by grade and designation"})]}),G&&e.jsxs(b,{size:"sm",onClick:$t,children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"})," New Band"]})]}),e.jsx("div",{className:"flex items-center gap-3 mb-4",children:e.jsx(N,{placeholder:"Search bands...",value:s,onChange:g=>{p(g.target.value),t(1)},className:"w-[280px] h-9"})}),I?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((g,Se)=>e.jsx(Re,{className:"h-12 w-full"},Se))}):e.jsx(je,{columns:Qt,data:X,totalCount:E,pagination:{pageIndex:a-1,pageSize:20},onPaginationChange:g=>{const Se=typeof g=="function"?g({pageIndex:a-1,pageSize:20}):g;t(Se.pageIndex+1)}}),e.jsx(te,{open:v,onOpenChange:x,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:y?"Edit Compensation Band":"New Compensation Band"}),e.jsx(re,{children:y?"Update band details.":"Create a new compensation band for grade/designation mapping."})]}),e.jsxs("form",{onSubmit:H.handleSubmit(xt),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Company *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:H.watch("company")??null,onValueChange:g=>H.setValue("company",g,{shouldValidate:!0}),onSearch:K,isLoading:W,selectedLabel:y==null?void 0:y.company_name,options:F.map(g=>({value:g.id,label:g.name,hint:g.code})),placeholder:"Select company",searchPlaceholder:"Search companies..."})}),H.formState.errors.company&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:H.formState.errors.company.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Grade *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:H.watch("grade")??"",onValueChange:g=>{H.setValue("grade",g,{shouldValidate:!0}),H.setValue("designation","")},onSearch:U,isLoading:O,options:c.map(g=>({value:g.id,label:g.name,hint:g.code})),placeholder:"Select grade",searchPlaceholder:"Search grades..."})}),H.formState.errors.grade&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:H.formState.errors.grade.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Designation"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:H.watch("designation")??"",onValueChange:g=>H.setValue("designation",g,{shouldValidate:!0}),onSearch:Dt,isLoading:zt,disabled:!We,options:Kt.map(g=>({value:g.id,label:g.name,hint:g.code})),placeholder:We?"Select designation (optional)":"Select a grade first",searchPlaceholder:"Search designations..."})})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Location Type *"}),e.jsxs(ve,{value:H.watch("location_type"),onValueChange:g=>H.setValue("location_type",g,{shouldValidate:!0}),children:[e.jsx(_e,{className:"mt-1.5 h-9",children:e.jsx(be,{})}),e.jsx(Ne,{children:_a.map(g=>e.jsx(Z,{value:g.value,children:g.label},g.value))})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Band Min *"}),e.jsx(N,{...H.register("min_ctc"),placeholder:"e.g. 800000",className:"mt-1.5"}),H.formState.errors.min_ctc&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:H.formState.errors.min_ctc.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Band Mid"}),e.jsx(N,{...H.register("mid_ctc"),placeholder:"e.g. 1150000",className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Band Max *"}),e.jsx(N,{...H.register("max_ctc"),placeholder:"e.g. 1500000",className:"mt-1.5"}),H.formState.errors.max_ctc&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:H.formState.errors.max_ctc.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Currency"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:H.watch("currency")??null,onValueChange:g=>H.setValue("currency",g,{shouldValidate:!0}),onSearch:f,isLoading:q,selectedLabel:(ut=y==null?void 0:y.currency_detail)==null?void 0:ut.code,options:l.map(g=>({value:g.id,label:g.code,hint:g.name})),placeholder:"Select currency",searchPlaceholder:"Search currencies..."})}),H.formState.errors.currency&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:H.formState.errors.currency.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective From *"}),e.jsx(N,{type:"date",...H.register("effective_from"),className:"mt-1.5"}),H.formState.errors.effective_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:H.formState.errors.effective_from.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>x(!1),children:"Cancel"}),e.jsx(b,{onClick:H.handleSubmit(xt),disabled:r.isPending||w.isPending,children:r.isPending||w.isPending?"Saving...":y?"Update":"Create"})]})]})})]})}const Na={planning:"secondary",manager_input:"warning",hr_review:"default",approval:"warning",processing:"default",completed:"success",cancelled:"destructive"},Ca=[{value:"annual",label:"Annual"},{value:"mid_year",label:"Mid Year"},{value:"promotion",label:"Promotion"},{value:"market_adjustment",label:"Market Adjustment"},{value:"retention",label:"Retention"}],Sa=pe({company:j().min(1,"Company is required"),name:j().min(1,"Name is required"),code:j().min(1,"Code is required"),cycle_type:Pe(["annual","mid_year","promotion","market_adjustment","retention"]),effective_date:He("Effective date is required"),budget_amount:j().min(1,"Budget is required")});function Zn(){const[a,t]=h.useState(1),[s,p]=h.useState(""),[v,x]=h.useState(!1),[y,d]=h.useState(null),{hasPermission:V,requirePermission:A}=oe(),G=V("compensation","increment","create"),M=V("compensation","increment","update"),Y=h.useMemo(()=>({page:a,page_size:20,...s&&{search:s}}),[a,s]),{data:Q,isLoading:T}=pt(Y),I=(Q==null?void 0:Q.results)??[],X=(Q==null?void 0:Q.count)??0,[E,z]=h.useState(""),{data:K,isLoading:$}=Ve({search:E||void 0}),W=(K==null?void 0:K.results)??[],F=Ps(),R=ws(),U=qs(),k=Fs(),O=ks(),c=()=>{var r;return{company:((r=W[0])==null?void 0:r.id)??"",name:"",code:"",cycle_type:"annual",effective_date:"",budget_amount:""}},o=me({resolver:de(Sa),defaultValues:c()});function f(){A("compensation","increment","create")&&(d(null),o.reset(c()),x(!0))}function m(r){A("compensation","increment","update")&&(d(r),o.reset({company:r.company,name:r.name,code:r.code,cycle_type:r.cycle_type,effective_date:r.effective_date,budget_amount:r.budget_amount}),x(!0))}function q(r){y?R.mutate({id:y.id,...r},{onSuccess:()=>{x(!1),d(null)}}):F.mutate(r,{onSuccess:()=>{x(!1),o.reset(c())}})}const l=[{accessorKey:"name",header:"Cycle Name",cell:({row:r})=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] font-medium text-slate-800",children:r.original.name}),e.jsx("span",{className:"block text-[11px] text-slate-400 font-mono",children:r.original.code})]})},{accessorKey:"cycle_type",header:"Type",cell:({row:r})=>e.jsx(ce,{variant:"secondary",className:"text-[10px] capitalize",children:r.original.cycle_type_display??r.original.cycle_type.replace(/_/g," ")})},{accessorKey:"effective_date",header:"Effective Date",cell:({row:r})=>e.jsx("span",{className:"text-[12px] text-slate-500",children:r.original.effective_date})},{accessorKey:"budget_amount",header:"Budget",cell:({row:r})=>e.jsx("span",{className:"text-[13px] font-semibold text-slate-800",children:r.original.budget_amount})},{accessorKey:"total_increment_amount",header:"Increment Total",cell:({row:r})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.original.total_increment_amount})},{accessorKey:"total_employees",header:"Employees",cell:({row:r})=>e.jsxs("div",{className:"text-[12px] text-slate-500",children:[r.original.total_employees," total",e.jsxs("span",{className:"text-slate-400 ml-1",children:["(",r.original.processed_count," processed)"]})]})},{accessorKey:"status",header:"Status",cell:({row:r})=>e.jsx(ce,{variant:Na[r.original.status]??"secondary",className:"text-[10px] capitalize",children:r.original.status_display??r.original.status.replace(/_/g," ")})},{id:"actions",header:"",cell:({row:r})=>{const w=r.original;return e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[M&&w.status==="planning"&&e.jsxs(e.Fragment,{children:[e.jsx(J,{onClick:()=>m(w),children:"Edit"}),e.jsxs(J,{onClick:()=>U.mutate(w.id),children:[e.jsx(ns,{className:"h-3.5 w-3.5 mr-2"})," Launch"]})]}),M&&(w.status==="hr_review"||w.status==="approval")&&e.jsxs(J,{onClick:()=>k.mutate(w.id),children:[e.jsx(et,{className:"h-3.5 w-3.5 mr-2"})," Finalize"]}),M&&w.status==="processing"&&e.jsxs(J,{onClick:()=>O.mutate(w.id),children:[e.jsx(rs,{className:"h-3.5 w-3.5 mr-2"})," Lock"]})]})]})}}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(lt,{className:"h-5 w-5 text-primary"})," Increment Cycles"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage annual increment cycles and budgets"})]}),G&&e.jsxs(b,{size:"sm",onClick:f,children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"})," New Cycle"]})]}),e.jsx("div",{className:"flex items-center gap-3 mb-4",children:e.jsx(N,{placeholder:"Search cycles...",value:s,onChange:r=>{p(r.target.value),t(1)},className:"w-[280px] h-9"})}),T?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((r,w)=>e.jsx(Re,{className:"h-12 w-full"},w))}):e.jsx(je,{columns:l,data:I,totalCount:X,pagination:{pageIndex:a-1,pageSize:20},onPaginationChange:r=>{const w=typeof r=="function"?r({pageIndex:a-1,pageSize:20}):r;t(w.pageIndex+1)}}),e.jsx(te,{open:v,onOpenChange:x,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:y?"Edit Increment Cycle":"New Increment Cycle"}),e.jsx(re,{children:y?"Update cycle details.":"Create a new increment cycle."})]}),e.jsxs("form",{onSubmit:o.handleSubmit(q),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Company *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:o.watch("company")??null,onValueChange:r=>o.setValue("company",r,{shouldValidate:!0}),onSearch:z,isLoading:$,selectedLabel:y==null?void 0:y.company_name,options:W.map(r=>({value:r.id,label:r.name,hint:r.code})),placeholder:"Select company",searchPlaceholder:"Search companies..."})}),o.formState.errors.company&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.company.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Cycle Name *"}),e.jsx(N,{...o.register("name"),placeholder:"e.g. FY 2026-27 Increment",className:"mt-1.5"}),o.formState.errors.name&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx(N,{...o.register("code"),placeholder:"e.g. INC-FY2627",className:"mt-1.5"}),o.formState.errors.code&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Cycle Type *"}),e.jsxs(ve,{value:o.watch("cycle_type"),onValueChange:r=>o.setValue("cycle_type",r),children:[e.jsx(_e,{className:"mt-1.5 h-9",children:e.jsx(be,{})}),e.jsx(Ne,{children:Ca.map(r=>e.jsx(Z,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective Date *"}),e.jsx(N,{type:"date",...o.register("effective_date"),className:"mt-1.5"}),o.formState.errors.effective_date&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.effective_date.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Budget Amount *"}),e.jsx(N,{...o.register("budget_amount"),placeholder:"e.g. 5000000",className:"mt-1.5"}),o.formState.errors.budget_amount&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.budget_amount.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>x(!1),children:"Cancel"}),e.jsx(b,{onClick:o.handleSubmit(q),disabled:F.isPending||R.isPending,children:F.isPending||R.isPending?"Saving...":y?"Update":"Create"})]})]})})]})}const Pa={pending_manager:"warning",pending_hr:"warning",pending_approval:"default",approved:"success",rejected:"destructive",processed:"success",skipped:"secondary"},wa=["pending_manager","pending_hr","pending_approval"],qa=pe({cycle:j().min(1,"Cycle is required"),employee:j().min(1,"Employee is required"),new_ctc:j().min(1,"Proposed CTC is required"),manager_comments:j().optional()});function er(){const[a,t]=h.useState(1),[s,p]=h.useState(""),[v,x]=h.useState(""),[y,d]=h.useState(!1),[V,A]=h.useState(!1),[G,M]=h.useState(""),[Y,Q]=h.useState(""),{hasPermission:T,requirePermission:I}=oe(),X=T("compensation","increment","create"),E=T("compensation","increment","approve"),z=h.useMemo(()=>({page:a,page_size:20,...s&&{search:s},...v&&{status:v}}),[a,s,v]),{data:K,isLoading:$}=Es(z),W=(K==null?void 0:K.results)??[],F=(K==null?void 0:K.count)??0,[R,U]=h.useState(""),{data:k,isLoading:O}=pt({page_size:50,search:R||void 0}),c=(k==null?void 0:k.results)??[],o=Rs(),f=Ts(),m=Vs(),q=me({resolver:de(qa),defaultValues:{cycle:"",employee:"",new_ctc:"",manager_comments:""}});function l(n){o.mutate(n,{onSuccess:()=>{d(!1),q.reset()}})}function r(){G&&I("compensation","increment","approve")&&m.mutate(G,{onSuccess:()=>{A(!1),M(""),Q("")}})}const w=[{accessorKey:"employee_name",header:"Employee",cell:({row:n})=>e.jsx("span",{className:"text-[13px] font-medium text-slate-800",children:n.original.employee_name??"--"})},{accessorKey:"current_designation_name",header:"Designation",cell:({row:n})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.original.current_designation_name??"--"})},{accessorKey:"current_ctc",header:"Current CTC",cell:({row:n})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.original.current_ctc})},{accessorKey:"new_ctc",header:"Proposed CTC",cell:({row:n})=>e.jsx("span",{className:"text-[13px] font-semibold text-slate-800",children:n.original.new_ctc})},{accessorKey:"final_approved_amount",header:"Increment",cell:({row:n})=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[12px] text-emerald-600 font-medium",children:n.original.final_approved_amount}),e.jsxs("span",{className:"block text-[11px] text-emerald-500",children:["+",n.original.final_approved_pct,"%"]})]})},{accessorKey:"cycle_name",header:"Cycle",cell:({row:n})=>e.jsx("span",{className:"text-[12px] text-slate-500",children:n.original.cycle_name??"--"})},{accessorKey:"status",header:"Status",cell:({row:n})=>e.jsx(ce,{variant:Pa[n.original.status]??"secondary",className:"text-[10px] capitalize",children:n.original.status_display??n.original.status.replace(/_/g," ")})},{id:"actions",header:"",cell:({row:n})=>{const _=n.original;return!wa.includes(_.status)||!E?null:e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[e.jsxs(J,{onClick:()=>f.mutate({id:_.id}),children:[e.jsx(Nt,{className:"h-3.5 w-3.5 mr-2 text-emerald-600"})," Approve"]}),e.jsxs(J,{onClick:()=>{M(_.id),Q(""),A(!0)},className:"text-red-600",children:[e.jsx(Ct,{className:"h-3.5 w-3.5 mr-2"})," Reject"]})]})]})}}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(gt,{className:"h-5 w-5 text-primary"})," Increment Recommendations"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Review and approve increment proposals"})]}),X&&e.jsxs(b,{size:"sm",onClick:()=>{q.reset(),d(!0)},children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"})," Add Recommendation"]})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(N,{placeholder:"Search employees...",value:s,onChange:n=>{p(n.target.value),t(1)},className:"w-[280px] h-9"}),e.jsxs(ve,{value:v||"__all__",onValueChange:n=>{x(n==="__all__"?"":n),t(1)},children:[e.jsx(_e,{className:"w-[170px] h-9",children:e.jsx(be,{placeholder:"All statuses"})}),e.jsxs(Ne,{children:[e.jsx(Z,{value:"__all__",children:"All Statuses"}),e.jsx(Z,{value:"pending_manager",children:"Pending Manager"}),e.jsx(Z,{value:"pending_hr",children:"Pending HR"}),e.jsx(Z,{value:"pending_approval",children:"Pending Approval"}),e.jsx(Z,{value:"approved",children:"Approved"}),e.jsx(Z,{value:"rejected",children:"Rejected"}),e.jsx(Z,{value:"processed",children:"Processed"}),e.jsx(Z,{value:"skipped",children:"Skipped"})]})]})]}),$?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((n,_)=>e.jsx(Re,{className:"h-12 w-full"},_))}):e.jsx(je,{columns:w,data:W,totalCount:F,pagination:{pageIndex:a-1,pageSize:20},onPaginationChange:n=>{const _=typeof n=="function"?n({pageIndex:a-1,pageSize:20}):n;t(_.pageIndex+1)}}),e.jsx(te,{open:y,onOpenChange:d,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"New Recommendation"}),e.jsx(re,{children:"Propose an increment for an employee."})]}),e.jsxs("form",{onSubmit:q.handleSubmit(l),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Increment Cycle *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:q.watch("cycle"),onValueChange:n=>q.setValue("cycle",n,{shouldValidate:!0}),onSearch:U,isLoading:O,options:c.map(n=>({value:n.id,label:n.name,hint:n.code})),placeholder:"Select cycle"})}),q.formState.errors.cycle&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.cycle.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Te,{value:q.watch("employee"),onValueChange:n=>q.setValue("employee",n,{shouldValidate:!0})})}),q.formState.errors.employee&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Proposed CTC *"}),e.jsx(N,{...q.register("new_ctc"),placeholder:"e.g. 1500000",className:"mt-1.5"}),q.formState.errors.new_ctc&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.new_ctc.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Manager Comments"}),e.jsx(N,{...q.register("manager_comments"),placeholder:"Performance rating, market adjustment...",className:"mt-1.5"})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(b,{onClick:q.handleSubmit(l),disabled:o.isPending,children:o.isPending?"Saving...":"Submit"})]})]})}),e.jsx(te,{open:V,onOpenChange:A,children:e.jsxs(se,{size:"sm",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Reject Recommendation"}),e.jsx(re,{children:"Optionally note a reason before rejecting."})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Rejection Reason"}),e.jsx(N,{value:Y,onChange:n=>Q(n.target.value),placeholder:"Reason for rejection",className:"mt-1.5"})]})}),e.jsxs(ie,{children:[e.jsx(b,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),e.jsx(b,{variant:"destructive",disabled:m.isPending,onClick:r,children:m.isPending?"Rejecting...":"Reject"})]})]})})]})}const Fa=pe({cycle:j().min(1,"Cycle is required"),department:j().min(1,"Department is required"),allocated_amount:j().min(1,"Allocated amount is required")});function tr(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),{hasPermission:v,requirePermission:x}=oe(),y=v("compensation","budget","create"),d=v("compensation","budget","update"),{pagination:V,setPagination:A,sorting:G,setSorting:M,globalFilter:Y,setGlobalFilter:Q,queryParams:T}=Ce(),{data:I,isLoading:X}=As(T),E=(I==null?void 0:I.results)??[],[z,K]=h.useState(""),{data:$,isLoading:W}=pt({page_size:100,search:z||void 0}),F=($==null?void 0:$.results)??[],[R,U]=h.useState(""),{data:k,isLoading:O}=as({page_size:200,search:R||void 0}),c=(k==null?void 0:k.results)??[],o=Ls(),f=Bs(),m=me({resolver:de(Fa),defaultValues:{cycle:"",department:"",allocated_amount:""}});function q(){x("compensation","budget","create")&&(p(null),m.reset({cycle:"",department:"",allocated_amount:""}),t(!0))}function l(n){x("compensation","budget","update")&&(p(n),m.reset({cycle:n.cycle,department:n.department,allocated_amount:n.allocated_amount}),t(!0))}function r(n){const _={...n};s?f.mutate({id:s.id,..._},{onSuccess:()=>t(!1)}):o.mutate(_,{onSuccess:()=>t(!1)})}const w=[{key:"cycle_name",header:"Cycle Name",render:n=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:n.cycle_name||"-"})},{key:"department_name",header:"Department",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:n.department_name||"All"})},{key:"allocated_amount",header:"Allocated Amount",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(n.allocated_amount).toLocaleString()})},{key:"utilized_amount",header:"Utilized Amount",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(n.utilized_amount).toLocaleString()})},{key:"remaining_amount",header:"Remaining Amount",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(n.remaining_amount??0).toLocaleString()})},{key:"utilization_pct",header:"Utilization %",render:n=>{const _=Number(n.utilization_pct??0),H=_>90?"text-red-600":_>70?"text-amber-600":"text-emerald-600";return e.jsxs("span",{className:`text-[13px] font-medium ${H}`,children:[_,"%"]})}},{key:"employee_count",header:"Employee Count",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:n.employee_count})},{key:"created_at",header:"Created",render:n=>e.jsx("span",{className:"text-[13px] text-slate-500",children:new Date(n.created_at).toLocaleDateString()})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsx(fe,{align:"end",children:d&&e.jsxs(J,{onClick:()=>l(n),children:[e.jsx(Fe,{className:"mr-2 h-3.5 w-3.5"})," Edit"]})})]})}];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(dt,{className:"h-5 w-5 text-primary"})," Increment Budgets"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Department-wise increment budget allocation and tracking"})]}),y&&e.jsxs(b,{size:"sm",onClick:q,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," Add Budget"]})]}),e.jsx(je,{columns:w,data:E,isLoading:X,searchPlaceholder:"Search budgets...",emptyMessage:"No budgets",emptyDescription:"Allocate increment budgets by department.",totalCount:(I==null?void 0:I.count)??0,pagination:V,onPaginationChange:A,sorting:G,onSortingChange:M,globalFilter:Y,onGlobalFilterChange:Q}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:s?"Edit Budget":"Add Increment Budget"}),e.jsx(re,{children:s?"Update budget allocation.":"Allocate budget for a department in an increment cycle."})]}),e.jsxs("form",{onSubmit:m.handleSubmit(r),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Increment Cycle *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:m.watch("cycle")??null,onValueChange:n=>m.setValue("cycle",n,{shouldDirty:!0,shouldValidate:!0}),onSearch:K,isLoading:W,selectedLabel:s==null?void 0:s.cycle_name,options:F.map(n=>({value:n.id,label:n.name,hint:n.code})),placeholder:"Select cycle",searchPlaceholder:"Search cycles..."})}),m.formState.errors.cycle&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:m.formState.errors.cycle.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Department *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:m.watch("department")??null,onValueChange:n=>m.setValue("department",n,{shouldDirty:!0,shouldValidate:!0}),onSearch:U,isLoading:O,selectedLabel:s==null?void 0:s.department_name,options:c.map(n=>({value:n.id,label:n.name,hint:n.code})),placeholder:"Select department",searchPlaceholder:"Search departments..."})}),m.formState.errors.department&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:m.formState.errors.department.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Allocated Amount *"}),e.jsx(N,{...m.register("allocated_amount"),className:"mt-1.5",placeholder:"1000000",type:"number",step:"0.01"}),m.formState.errors.allocated_amount&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:m.formState.errors.allocated_amount.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:m.handleSubmit(r),disabled:o.isPending||f.isPending,children:s?"Update":"Create"})]})]})})]})}const ka={monthly:"default",quarterly:"secondary",semi_annual:"warning",annual:"success",one_time:"secondary"},Ea=[{value:"monthly",label:"Monthly"},{value:"quarterly",label:"Quarterly"},{value:"semi_annual",label:"Semi Annual"},{value:"annual",label:"Annual"},{value:"one_time",label:"One Time"}],Ra=pe({company:j().min(1,"Company is required"),name:j().min(1,"Name is required"),code:j().min(1,"Code is required"),payout_frequency:Pe(["annual","semi_annual","quarterly","monthly","one_time"]),target_pct_of_ctc:j().min(1,"Target percentage is required"),effective_from:j().min(1,"Effective from date is required"),is_active:ge().optional()});function sr(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),[v,x]=h.useState(null),{hasPermission:y,requirePermission:d}=oe(),V=y("compensation","variable_pay","create"),A=y("compensation","variable_pay","update"),{pagination:G,setPagination:M,sorting:Y,setSorting:Q,globalFilter:T,setGlobalFilter:I,queryParams:X}=Ce(),{data:E,isLoading:z}=Et(X),K=(E==null?void 0:E.results)??[],[$,W]=h.useState(""),{data:F,isLoading:R}=Ve({search:$||void 0}),U=(F==null?void 0:F.results)??[],k=Ds(),O=zs(),c=Ks(),o=()=>{var n;return{company:((n=U[0])==null?void 0:n.id)??"",name:"",code:"",payout_frequency:"quarterly",target_pct_of_ctc:"",effective_from:"",is_active:!0}},f=me({resolver:de(Ra),defaultValues:o()});function m(){d("compensation","variable_pay","create")&&(p(null),f.reset(o()),t(!0))}function q(n){d("compensation","variable_pay","update")&&(p(n),f.reset({company:n.company,name:n.name,code:n.code,payout_frequency:n.payout_frequency,target_pct_of_ctc:n.target_pct_of_ctc,effective_from:n.effective_from,is_active:n.is_active}),t(!0))}function l(n){s?O.mutate({id:s.id,...n},{onSuccess:()=>t(!1)}):k.mutate(n,{onSuccess:()=>t(!1)})}function r(){d("compensation","variable_pay","update")&&v&&c.mutate(v.id,{onSuccess:()=>x(null)})}const w=[{key:"name",header:"Name",render:n=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:n.name})},{key:"code",header:"Code",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:n.code})},{key:"payout_frequency",header:"Frequency",render:n=>e.jsx(ce,{variant:ka[n.payout_frequency]??"secondary",className:"capitalize text-[11px]",children:n.payout_frequency_display??n.payout_frequency.replace(/_/g," ")})},{key:"target_pct_of_ctc",header:"Target % of CTC",render:n=>e.jsxs("span",{className:"text-[13px] text-slate-600",children:[n.target_pct_of_ctc,"%"]})},{key:"is_active",header:"Status",render:n=>e.jsx(Me,{status:n.is_active?"active":"inactive"})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[A&&e.jsxs(J,{onClick:()=>q(n),children:[e.jsx(Fe,{className:"mr-2 h-3.5 w-3.5"})," Edit"]}),A&&e.jsx(Oe,{}),A&&e.jsxs(J,{className:"text-red-600",onClick:()=>x(n),children:[e.jsx(Ae,{className:"mr-2 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(vt,{className:"h-5 w-5 text-primary"})," Variable Pay Plans"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Configure bonus and incentive plan structures"})]}),V&&e.jsxs(b,{size:"sm",onClick:m,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," Add Plan"]})]}),e.jsx(je,{columns:w,data:K,isLoading:z,searchPlaceholder:"Search plans...",emptyMessage:"No variable pay plans",emptyDescription:"Add your first variable pay plan to configure bonus structures.",totalCount:(E==null?void 0:E.count)??0,pagination:G,onPaginationChange:M,sorting:Y,onSortingChange:Q,globalFilter:T,onGlobalFilterChange:I}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:s?"Edit Variable Pay Plan":"Add Variable Pay Plan"}),e.jsx(re,{children:s?"Update plan configuration.":"Create a new variable pay plan."})]}),e.jsxs("form",{onSubmit:f.handleSubmit(l),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Company *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:f.watch("company")??null,onValueChange:n=>f.setValue("company",n,{shouldValidate:!0}),onSearch:W,isLoading:R,selectedLabel:s==null?void 0:s.company_name,options:U.map(n=>({value:n.id,label:n.name,hint:n.code})),placeholder:"Select company",searchPlaceholder:"Search companies..."})}),f.formState.errors.company&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.company.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx(N,{...f.register("name"),className:"mt-1.5",placeholder:"Plan name"}),f.formState.errors.name&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx(N,{...f.register("code"),className:"mt-1.5",placeholder:"PLAN-001"}),f.formState.errors.code&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.code.message})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Payout Frequency *"}),e.jsxs(ve,{value:f.watch("payout_frequency"),onValueChange:n=>f.setValue("payout_frequency",n),children:[e.jsx(_e,{className:"mt-1.5 h-9",children:e.jsx(be,{})}),e.jsx(Ne,{children:Ea.map(n=>e.jsx(Z,{value:n.value,children:n.label},n.value))})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Target % of CTC *"}),e.jsx(N,{...f.register("target_pct_of_ctc"),className:"mt-1.5",placeholder:"10",type:"number",step:"0.01"}),f.formState.errors.target_pct_of_ctc&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.target_pct_of_ctc.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective From *"}),e.jsx(N,{...f.register("effective_from"),className:"mt-1.5",type:"date"}),f.formState.errors.effective_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.effective_from.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:f.handleSubmit(l),disabled:k.isPending||O.isPending,children:s?"Update":"Create"})]})]})}),e.jsx(Le,{open:!!v,onOpenChange:n=>!n&&x(null),children:e.jsxs(Be,{children:[e.jsxs(De,{children:[e.jsx(ze,{children:"Delete variable pay plan?"}),e.jsxs(Ke,{children:["This will permanently delete ",e.jsx("strong",{children:v==null?void 0:v.name})," and all associated data."]})]}),e.jsxs($e,{children:[e.jsx(Ie,{children:"Cancel"}),e.jsx(Qe,{variant:"destructive",onClick:r,children:"Delete"})]})]})})]})}const jt={calculated:"default",manager_review:"warning",hr_review:"warning",approved:"success",paid:"success",held:"destructive"},Ta=Ze(pe({employee:j().min(1,"Employee is required"),plan:j().min(1,"Plan is required"),period_from:j().min(1,"Period start is required"),period_to:j().min(1,"Period end is required"),individual_achievement_pct:j().min(1,"Achievement percentage is required")}),"period_from","period_to");function ar(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),{hasPermission:v,requirePermission:x}=oe(),y=v("compensation","variable_pay_calculation","create"),{pagination:d,setPagination:V,sorting:A,setSorting:G,globalFilter:M,setGlobalFilter:Y,queryParams:Q}=Ce(),{data:T,isLoading:I}=$s(Q),X=(T==null?void 0:T.results)??[],[E,z]=h.useState(""),{data:K,isLoading:$}=Et({page_size:100,search:E||void 0}),W=(K==null?void 0:K.results)??[],F=Is(),R=me({resolver:de(Ta),defaultValues:{employee:"",plan:"",period_from:"",period_to:"",individual_achievement_pct:""}});function U(){x("compensation","variable_pay_calculation","create")&&(R.reset({employee:"",plan:"",period_from:"",period_to:"",individual_achievement_pct:""}),t(!0))}function k(c){F.mutate(c,{onSuccess:()=>t(!1)})}const O=[{key:"employee_name",header:"Employee",render:c=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:c.employee_name||"-"})},{key:"plan_name",header:"Plan",render:c=>e.jsx("span",{className:"text-[13px] text-slate-600",children:c.plan_name||"-"})},{key:"period_from",header:"Period",render:c=>e.jsxs("span",{className:"text-[12px] text-slate-600",children:[new Date(c.period_from).toLocaleDateString()," - ",new Date(c.period_to).toLocaleDateString()]})},{key:"base_amount",header:"Base Amount",render:c=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(c.base_amount).toLocaleString()})},{key:"individual_achievement_pct",header:"Achievement %",render:c=>e.jsxs("span",{className:"text-[13px] text-slate-600",children:[c.individual_achievement_pct,"%"]})},{key:"final_amount",header:"Final Amount",render:c=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:Number(c.final_amount).toLocaleString()})},{key:"status",header:"Status",render:c=>e.jsx(ce,{variant:jt[c.status]??"default",className:"capitalize text-[11px]",children:c.status.replace(/_/g," ")})},{key:"actions",header:"",className:"w-10",render:c=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsx(fe,{align:"end",children:e.jsxs(J,{onClick:()=>p(c),children:[e.jsx(Ft,{className:"mr-2 h-3.5 w-3.5"})," View Details"]})})]})}];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(Xe,{className:"h-5 w-5 text-primary"})," Variable Pay Calculations"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Calculate and manage variable pay payouts"})]}),y&&e.jsxs(b,{size:"sm",onClick:U,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," New Calculation"]})]}),e.jsx(je,{columns:O,data:X,isLoading:I,searchPlaceholder:"Search calculations...",emptyMessage:"No calculations",emptyDescription:"Create a new variable pay calculation to get started.",totalCount:(T==null?void 0:T.count)??0,pagination:d,onPaginationChange:V,sorting:A,onSortingChange:G,globalFilter:M,onGlobalFilterChange:Y}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"New Variable Pay Calculation"}),e.jsx(re,{children:"Calculate variable pay payout for an employee."})]}),e.jsxs("form",{onSubmit:R.handleSubmit(k),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Te,{value:R.watch("employee"),onValueChange:c=>R.setValue("employee",c)})}),R.formState.errors.employee&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:R.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Plan *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:R.watch("plan"),onValueChange:c=>R.setValue("plan",c),onSearch:z,isLoading:$,options:W.map(c=>({value:c.id,label:c.name,hint:c.code})),placeholder:"Select plan"})}),R.formState.errors.plan&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:R.formState.errors.plan.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Period Start *"}),e.jsx(N,{...R.register("period_from"),className:"mt-1.5",type:"date",max:R.watch("period_to")||void 0}),R.formState.errors.period_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:R.formState.errors.period_from.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Period End *"}),e.jsx(N,{...R.register("period_to"),className:"mt-1.5",type:"date",min:R.watch("period_from")||void 0}),R.formState.errors.period_to&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:R.formState.errors.period_to.message})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Individual Achievement % *"}),e.jsx(N,{...R.register("individual_achievement_pct"),className:"mt-1.5",placeholder:"85",type:"number",step:"0.01"}),R.formState.errors.individual_achievement_pct&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:R.formState.errors.individual_achievement_pct.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:R.handleSubmit(k),disabled:F.isPending,children:"Calculate"})]})]})}),e.jsx(te,{open:!!s,onOpenChange:c=>!c&&p(null),children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Calculation Details"}),e.jsx(re,{children:"Variable pay calculation breakdown."})]}),s&&e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:s.employee_name})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Plan"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:s.plan_name})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Period"}),e.jsxs("p",{className:"text-[13px] text-slate-900 mt-1",children:[new Date(s.period_from).toLocaleDateString()," - ",new Date(s.period_to).toLocaleDateString()]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Status"}),e.jsx("div",{className:"mt-1",children:e.jsx(ce,{variant:jt[s.status]??"default",className:"capitalize text-[11px]",children:s.status.replace(/_/g," ")})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Base Amount"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:Number(s.base_amount).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Target Payout"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:Number(s.target_payout).toLocaleString()})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Achievement %"}),e.jsxs("p",{className:"text-[13px] text-slate-900 mt-1",children:[s.individual_achievement_pct,"%"]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Calculated Amount"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:Number(s.calculated_amount).toLocaleString()})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Final Amount"}),e.jsx("p",{className:"text-[15px] font-semibold text-slate-900 mt-1",children:Number(s.final_amount).toLocaleString()})]})]}),e.jsx(ie,{children:e.jsx(b,{type:"button",variant:"outline",onClick:()=>p(null),children:"Close"})})]})})]})}const Va=[{value:"health_insurance",label:"Health Insurance"},{value:"life_insurance",label:"Life Insurance"},{value:"retirement",label:"Retirement"},{value:"wellness",label:"Wellness"},{value:"food",label:"Food"},{value:"transport",label:"Transport"},{value:"childcare",label:"Childcare"},{value:"education",label:"Education"},{value:"housing",label:"Housing"},{value:"other",label:"Other"}],Aa={health_insurance:"default",life_insurance:"default",retirement:"success",wellness:"warning",food:"secondary",transport:"secondary",childcare:"secondary",education:"secondary",housing:"secondary",other:"secondary"},La=pe({company:j().min(1,"Company is required"),name:j().min(1,"Name is required"),code:j().min(1,"Code is required"),category:Pe(["health_insurance","life_insurance","retirement","wellness","food","transport","childcare","education","housing","other"]),provider_name:j().optional(),employer_contribution_amount:j().optional(),employee_contribution_amount:j().optional(),effective_from:j().min(1,"Effective date is required"),is_active:ge()});function nr(){const[a,t]=h.useState(1),[s,p]=h.useState(""),[v,x]=h.useState(!1),[y,d]=h.useState(null),{hasPermission:V,requirePermission:A}=oe(),G=V("compensation","benefit","create"),M=V("compensation","benefit","update"),Y=V("compensation","benefit","delete"),Q=h.useMemo(()=>({page:a,page_size:20,...s&&{search:s}}),[a,s]),{data:T,isLoading:I}=Vt(Q),X=(T==null?void 0:T.results)??[],E=(T==null?void 0:T.count)??0,[z,K]=h.useState(""),{data:$,isLoading:W}=Ve({search:z||void 0}),F=($==null?void 0:$.results)??[],R=ea(),U=ta(),k=sa(),O=()=>{var l;return{company:((l=F[0])==null?void 0:l.id)??"",name:"",code:"",category:"health_insurance",provider_name:"",employer_contribution_amount:"",employee_contribution_amount:"",effective_from:"",is_active:!0}},c=me({resolver:de(La),defaultValues:O()});function o(){A("compensation","benefit","create")&&(d(null),c.reset(O()),x(!0))}function f(l){A("compensation","benefit","update")&&(d(l),c.reset({company:l.company,name:l.name,code:l.code,category:l.category,provider_name:l.provider_name,employer_contribution_amount:l.employer_contribution_amount,employee_contribution_amount:l.employee_contribution_amount,effective_from:l.effective_from,is_active:l.is_active}),x(!0))}function m(l){y?U.mutate({id:y.id,...l},{onSuccess:()=>{x(!1),d(null)}}):R.mutate(l,{onSuccess:()=>{x(!1),c.reset(O())}})}const q=[{accessorKey:"name",header:"Program Name",cell:({row:l})=>e.jsx("span",{className:"text-[13px] font-medium text-slate-800",children:l.original.name})},{accessorKey:"category",header:"Category",cell:({row:l})=>e.jsx(ce,{variant:Aa[l.original.category]??"secondary",className:"text-[10px] capitalize",children:l.original.category_display??l.original.category.replace(/_/g," ")})},{accessorKey:"provider_name",header:"Provider",cell:({row:l})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:l.original.provider_name||"--"})},{accessorKey:"employer_contribution_amount",header:"Employer Contrib.",cell:({row:l})=>e.jsx("span",{className:"text-[13px] font-semibold text-slate-800",children:l.original.employer_contribution_amount||"--"})},{accessorKey:"is_active",header:"Status",cell:({row:l})=>e.jsx(Me,{status:l.original.is_active?"active":"inactive",className:"text-[10px]"})},{id:"actions",header:"",cell:({row:l})=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[M&&e.jsxs(J,{onClick:()=>f(l.original),children:[e.jsx(Fe,{className:"h-3.5 w-3.5 mr-2"})," Edit"]}),Y&&e.jsxs(J,{onClick:()=>k.mutate(l.original.id),className:"text-red-600",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 mr-2"})," Delete"]})]})]})}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(is,{className:"h-5 w-5 text-primary"})," Benefit Programs"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage employee benefit programs and coverage"})]}),G&&e.jsxs(b,{size:"sm",onClick:o,children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"})," New Program"]})]}),e.jsx("div",{className:"flex items-center gap-3 mb-4",children:e.jsx(N,{placeholder:"Search programs...",value:s,onChange:l=>{p(l.target.value),t(1)},className:"w-[280px] h-9"})}),I?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((l,r)=>e.jsx(Re,{className:"h-12 w-full"},r))}):e.jsx(je,{columns:q,data:X,totalCount:E,pagination:{pageIndex:a-1,pageSize:20},onPaginationChange:l=>{const r=typeof l=="function"?l({pageIndex:a-1,pageSize:20}):l;t(r.pageIndex+1)}}),e.jsx(te,{open:v,onOpenChange:x,children:e.jsxs(se,{size:"lg",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:y?"Edit Benefit Program":"New Benefit Program"}),e.jsx(re,{children:y?"Update program details.":"Create a new benefit program for employees."})]}),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(i,{className:"text-[12px] font-medium text-slate-500",children:"Company *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:c.watch("company")??null,onValueChange:l=>c.setValue("company",l,{shouldValidate:!0}),onSearch:K,isLoading:W,selectedLabel:y==null?void 0:y.company_name,options:F.map(l=>({value:l.id,label:l.name,hint:l.code})),placeholder:"Select company",searchPlaceholder:"Search companies..."})}),c.formState.errors.company&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.company.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Program Name *"}),e.jsx(N,{...c.register("name"),placeholder:"e.g. Group Health Insurance",className:"mt-1.5"}),c.formState.errors.name&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx(N,{...c.register("code"),placeholder:"e.g. GHI-01",className:"mt-1.5"}),c.formState.errors.code&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.code.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Category *"}),e.jsxs(ve,{value:c.watch("category"),onValueChange:l=>c.setValue("category",l,{shouldValidate:!0}),children:[e.jsx(_e,{className:"mt-1.5",children:e.jsx(be,{placeholder:"Select category"})}),e.jsx(Ne,{children:Va.map(l=>e.jsx(Z,{value:l.value,children:l.label},l.value))})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Provider"}),e.jsx(N,{...c.register("provider_name"),placeholder:"e.g. ICICI Lombard",className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employer Contribution Amount"}),e.jsx(N,{...c.register("employer_contribution_amount"),placeholder:"e.g. 15000",className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee Contribution Amount"}),e.jsx(N,{...c.register("employee_contribution_amount"),placeholder:"e.g. 5000",className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective From *"}),e.jsx(N,{type:"date",...c.register("effective_from"),className:"mt-1.5"}),c.formState.errors.effective_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:c.formState.errors.effective_from.message})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"bp_is_active",...c.register("is_active"),className:"h-4 w-4 rounded border-slate-300"}),e.jsx(i,{htmlFor:"bp_is_active",children:"Active"})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>x(!1),children:"Cancel"}),e.jsx(b,{onClick:c.handleSubmit(m),disabled:R.isPending||U.isPending,children:R.isPending||U.isPending?"Saving...":y?"Update":"Create"})]})]})})]})}const Ba=Ze(pe({employee:j().min(1,"Employee is required"),program:j().min(1,"Program is required"),enrollment_date:He("Enrollment date is required"),effective_from:j().min(1,"Effective from is required"),effective_to:j().optional(),coverage_option:j().optional(),employee_premium_monthly:j().optional()}),"effective_from","effective_to");function rr(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),{hasPermission:v,requirePermission:x}=oe(),y=v("compensation","benefit_enrollment","create"),d=v("compensation","benefit_enrollment","update"),{pagination:V,setPagination:A,sorting:G,setSorting:M,globalFilter:Y,setGlobalFilter:Q,queryParams:T}=Ce(),{data:I,isLoading:X}=At(T),E=(I==null?void 0:I.results)??[],[z,K]=h.useState(""),{data:$,isLoading:W}=Vt({page_size:100,search:z||void 0}),F=($==null?void 0:$.results)??[],R=aa(),U=na(),k=me({resolver:de(Ba),defaultValues:{employee:"",program:"",enrollment_date:"",effective_from:"",effective_to:"",coverage_option:"",employee_premium_monthly:""}});function O(){x("compensation","benefit_enrollment","create")&&(p(null),k.reset({employee:"",program:"",enrollment_date:"",effective_from:"",effective_to:"",coverage_option:"",employee_premium_monthly:""}),t(!0))}function c(m){x("compensation","benefit_enrollment","update")&&(p(m),k.reset({employee:m.employee,program:m.program,enrollment_date:m.enrollment_date,effective_from:m.effective_from,effective_to:m.effective_to??"",coverage_option:m.coverage_option,employee_premium_monthly:m.employee_premium_monthly}),t(!0))}function o(m){const q={...m,effective_to:m.effective_to||void 0};s?U.mutate({id:s.id,...q},{onSuccess:()=>t(!1)}):R.mutate(q,{onSuccess:()=>t(!1)})}const f=[{key:"employee_name",header:"Employee",render:m=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:m.employee_name||"-"})},{key:"program_name",header:"Program",render:m=>e.jsx("span",{className:"text-[13px] text-slate-600",children:m.program_name||"-"})},{key:"enrollment_date",header:"Enrolled",render:m=>e.jsx("span",{className:"text-[12px] text-slate-600",children:new Date(m.enrollment_date).toLocaleDateString()})},{key:"employee_premium_monthly",header:"Employee Premium",render:m=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(m.employee_premium_monthly).toLocaleString()})},{key:"employer_premium_monthly",header:"Employer Premium",render:m=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(m.employer_premium_monthly).toLocaleString()})},{key:"status",header:"Status",render:m=>e.jsx(Me,{status:m.status==="enrolled"?"active":"inactive",className:"text-[11px]"})},{key:"actions",header:"",className:"w-10",render:m=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsx(fe,{align:"end",children:d&&e.jsxs(J,{onClick:()=>c(m),children:[e.jsx(Fe,{className:"mr-2 h-3.5 w-3.5"})," Edit"]})})]})}];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(_t,{className:"h-5 w-5 text-primary"})," Benefit Enrollments"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Manage employee benefit program enrollments"})]}),y&&e.jsxs(b,{size:"sm",onClick:O,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," New Enrollment"]})]}),e.jsx(je,{columns:f,data:E,isLoading:X,searchPlaceholder:"Search enrollments...",emptyMessage:"No enrollments",emptyDescription:"Enroll employees in benefit programs to get started.",totalCount:(I==null?void 0:I.count)??0,pagination:V,onPaginationChange:A,sorting:G,onSortingChange:M,globalFilter:Y,onGlobalFilterChange:Q}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:s?"Edit Enrollment":"New Enrollment"}),e.jsx(re,{children:s?"Update enrollment details.":"Enroll an employee in a benefit program."})]}),e.jsxs("form",{onSubmit:k.handleSubmit(o),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Te,{value:k.watch("employee"),onValueChange:m=>k.setValue("employee",m),disabled:!!s})}),k.formState.errors.employee&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:k.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Program *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:k.watch("program"),onValueChange:m=>k.setValue("program",m),onSearch:K,isLoading:W,selectedLabel:s==null?void 0:s.program_name,options:F.map(m=>({value:m.id,label:m.name,hint:m.code})),placeholder:"Select program"})}),k.formState.errors.program&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:k.formState.errors.program.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Enrollment Date *"}),e.jsx(N,{...k.register("enrollment_date"),className:"mt-1.5",type:"date"}),k.formState.errors.enrollment_date&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:k.formState.errors.enrollment_date.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective From *"}),e.jsx(N,{...k.register("effective_from"),className:"mt-1.5",type:"date",max:k.watch("effective_to")||void 0}),k.formState.errors.effective_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:k.formState.errors.effective_from.message})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Effective To"}),e.jsx(N,{...k.register("effective_to"),className:"mt-1.5",type:"date",min:k.watch("effective_from")||void 0})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Coverage Option"}),e.jsx(N,{...k.register("coverage_option"),className:"mt-1.5",placeholder:"e.g. family"})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee Premium (monthly)"}),e.jsx(N,{...k.register("employee_premium_monthly"),className:"mt-1.5",placeholder:"5000",type:"number",step:"0.01"})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:k.handleSubmit(o),disabled:R.isPending||U.isPending,children:s?"Update":"Enroll"})]})]})})]})}function Da(a){switch(a){case"approved":case"settled":return"approved";case"partial":return"in_progress";case"rejected":return"rejected";case"submitted":case"under_review":default:return"pending"}}const za=["submitted","under_review"],Ka=pe({enrollment:j().min(1,"Enrollment is required"),claim_type:j().optional(),claim_date:He("Claim date is required"),claim_amount:j().min(1,"Claim amount is required"),description:j().optional()});function ir(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),[v,x]=h.useState(""),{hasPermission:y,requirePermission:d}=oe(),V=y("compensation","benefit_claim","create"),A=y("compensation","benefit_claim","approve"),{pagination:G,setPagination:M,sorting:Y,setSorting:Q,globalFilter:T,setGlobalFilter:I,queryParams:X}=Ce(),{data:E,isLoading:z}=ra(X),K=(E==null?void 0:E.results)??[],[$,W]=h.useState(""),{data:F,isLoading:R}=At({page_size:200,search:$||void 0}),U=(F==null?void 0:F.results)??[],k=ia(),O=la(),c=ca(),o=me({resolver:de(Ka),defaultValues:{enrollment:"",claim_type:"",claim_date:"",claim_amount:"",description:""}});function f(){d("compensation","benefit_claim","create")&&(o.reset({enrollment:"",claim_type:"",claim_date:"",claim_amount:"",description:""}),t(!0))}function m(r){k.mutate(r,{onSuccess:()=>t(!1)})}function q(){if(!s||!d("compensation","benefit_claim","approve"))return;const{claim:r,action:w}=s;w==="approve"?O.mutate({id:r.id},{onSuccess:()=>p(null)}):c.mutate({id:r.id,rejection_reason:v},{onSuccess:()=>{p(null),x("")}})}const l=[{key:"employee_name",header:"Employee",render:r=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:r.employee_name||"-"})},{key:"program_name",header:"Program",render:r=>e.jsx("span",{className:"text-[13px] text-slate-600",children:r.program_name||"-"})},{key:"claim_amount",header:"Claim Amount",render:r=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(r.claim_amount).toLocaleString()})},{key:"claim_date",header:"Claim Date",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:new Date(r.claim_date).toLocaleDateString()})},{key:"status",header:"Status",render:r=>e.jsx(ot,{status:Da(r.status)})},{key:"actions",header:"",className:"w-10",render:r=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsx(fe,{align:"end",children:A&&za.includes(r.status)&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{onClick:()=>p({claim:r,action:"approve"}),children:[e.jsx(et,{className:"mr-2 h-3.5 w-3.5"})," Approve"]}),e.jsx(Oe,{}),e.jsxs(J,{className:"text-red-600",onClick:()=>p({claim:r,action:"reject"}),children:[e.jsx(mt,{className:"mr-2 h-3.5 w-3.5"})," Reject"]})]})})]})}];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(ct,{className:"h-5 w-5 text-primary"})," Benefit Claims"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Process and track benefit claim requests"})]}),V&&e.jsxs(b,{size:"sm",onClick:f,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," New Claim"]})]}),e.jsx(je,{columns:l,data:K,isLoading:z,searchPlaceholder:"Search claims...",emptyMessage:"No benefit claims",emptyDescription:"Submit a new benefit claim to get started.",totalCount:(E==null?void 0:E.count)??0,pagination:G,onPaginationChange:M,sorting:Y,onSortingChange:Q,globalFilter:T,onGlobalFilterChange:I}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"New Benefit Claim"}),e.jsx(re,{children:"Submit a new benefit claim for processing."})]}),e.jsxs("form",{onSubmit:o.handleSubmit(m),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Enrollment *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:o.watch("enrollment"),onValueChange:r=>o.setValue("enrollment",r),onSearch:W,isLoading:R,options:U.map(r=>({value:r.id,label:r.employee_name??"-",hint:r.program_name})),placeholder:"Select enrollment"})}),o.formState.errors.enrollment&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.enrollment.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Claim Date *"}),e.jsx(N,{...o.register("claim_date"),className:"mt-1.5",type:"date"}),o.formState.errors.claim_date&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.claim_date.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Claim Amount *"}),e.jsx(N,{...o.register("claim_amount"),className:"mt-1.5",placeholder:"10000",type:"number",step:"0.01"}),o.formState.errors.claim_amount&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.claim_amount.message})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Claim Type"}),e.jsx(N,{...o.register("claim_type"),className:"mt-1.5",placeholder:"e.g. hospitalization"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Description"}),e.jsx(Ht,{...o.register("description"),className:"mt-1.5",placeholder:"Claim description",rows:3})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:o.handleSubmit(m),disabled:k.isPending,children:"Submit Claim"})]})]})}),e.jsx(Le,{open:!!s,onOpenChange:r=>{r||(p(null),x(""))},children:e.jsxs(Be,{children:[e.jsxs(De,{children:[e.jsx(ze,{children:(s==null?void 0:s.action)==="approve"?"Approve claim?":"Reject claim?"}),e.jsx(Ke,{children:(s==null?void 0:s.action)==="approve"?e.jsxs(e.Fragment,{children:["This will approve the claim of ",e.jsx("strong",{children:Number(s.claim.claim_amount).toLocaleString()})," from ",e.jsx("strong",{children:s.claim.employee_name}),"."]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("span",{children:["This will reject the claim from ",e.jsx("strong",{children:s==null?void 0:s.claim.employee_name}),"."]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Rejection Reason"}),e.jsx(N,{className:"mt-1.5",value:v,onChange:r=>x(r.target.value),placeholder:"Provide a reason..."})]})]})})]}),e.jsxs($e,{children:[e.jsx(Ie,{children:"Cancel"}),e.jsx(Qe,{variant:(s==null?void 0:s.action)==="reject"?"destructive":"default",onClick:q,disabled:(s==null?void 0:s.action)==="reject"&&!v,children:(s==null?void 0:s.action)==="approve"?"Approve":"Reject"})]})]})})]})}const $a=[{value:"percentage_of_ctc",label:"Percentage of CTC"},{value:"fixed",label:"Fixed Amount"},{value:"component_based",label:"Component Based"}],Ia=Ze(pe({company:j().min(1,"Company is required"),name:j().min(1,"Name is required"),code:j().min(1,"Code is required"),financial_year:j().min(1,"Financial year is required"),total_flex_source:Pe(["percentage_of_ctc","fixed","component_based"]),source_percentage:j().optional(),declaration_start_date:He("Start date is required"),declaration_end_date:He("End date is required"),is_active:ge().optional()}),"declaration_start_date","declaration_end_date");function lr(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),[v,x]=h.useState(null),{hasPermission:y,requirePermission:d}=oe(),V=y("compensation","fbp","create"),A=y("compensation","fbp","update"),{pagination:G,setPagination:M,sorting:Y,setSorting:Q,globalFilter:T,setGlobalFilter:I,queryParams:X}=Ce(),{data:E,isLoading:z}=Rt(X),K=(E==null?void 0:E.results)??[],[$,W]=h.useState(""),{data:F,isLoading:R}=Ve({search:$||void 0}),U=(F==null?void 0:F.results)??[],k=Qs(),O=Os(),c=Ms(),o=()=>{var n;return{company:((n=U[0])==null?void 0:n.id)??"",name:"",code:"",financial_year:"",total_flex_source:"percentage_of_ctc",source_percentage:"",declaration_start_date:"",declaration_end_date:"",is_active:!0}},f=me({resolver:de(Ia),defaultValues:o()});function m(){d("compensation","fbp","create")&&(p(null),f.reset(o()),t(!0))}function q(n){d("compensation","fbp","update")&&(p(n),f.reset({company:n.company,name:n.name,code:n.code,financial_year:n.financial_year,total_flex_source:n.total_flex_source,source_percentage:n.source_percentage,declaration_start_date:n.declaration_start_date,declaration_end_date:n.declaration_end_date,is_active:n.is_active}),t(!0))}function l(n){s?O.mutate({id:s.id,...n},{onSuccess:()=>t(!1)}):k.mutate(n,{onSuccess:()=>t(!1)})}function r(){d("compensation","fbp","update")&&v&&c.mutate(v.id,{onSuccess:()=>x(null)})}const w=[{key:"name",header:"Name",render:n=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:n.name})},{key:"code",header:"Code",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:n.code})},{key:"financial_year",header:"Financial Year",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:n.financial_year})},{key:"component_count",header:"Components",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600",children:n.component_count??0})},{key:"total_flex_source",header:"Flex Source",render:n=>e.jsx("span",{className:"text-[13px] text-slate-600 capitalize",children:n.total_flex_source_display??n.total_flex_source.replace(/_/g," ")})},{key:"is_active",header:"Status",render:n=>e.jsx(Me,{status:n.is_active?"active":"inactive"})},{key:"actions",header:"",className:"w-10",render:n=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[A&&e.jsxs(J,{onClick:()=>q(n),children:[e.jsx(Fe,{className:"mr-2 h-3.5 w-3.5"})," Edit"]}),A&&e.jsx(Oe,{}),A&&e.jsxs(J,{className:"text-red-600",onClick:()=>x(n),children:[e.jsx(Ae,{className:"mr-2 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(dt,{className:"h-5 w-5 text-primary"})," FBP Plans"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Design flexible benefit plan structures"})]}),V&&e.jsxs(b,{size:"sm",onClick:m,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," Add Plan"]})]}),e.jsx(je,{columns:w,data:K,isLoading:z,searchPlaceholder:"Search FBP plans...",emptyMessage:"No FBP plans",emptyDescription:"Add your first flexible benefit plan to get started.",totalCount:(E==null?void 0:E.count)??0,pagination:G,onPaginationChange:M,sorting:Y,onSortingChange:Q,globalFilter:T,onGlobalFilterChange:I}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:s?"Edit FBP Plan":"Add FBP Plan"}),e.jsx(re,{children:s?"Update FBP plan details.":"Create a new flexible benefit plan."})]}),e.jsxs("form",{onSubmit:f.handleSubmit(l),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Company *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:f.watch("company")??null,onValueChange:n=>f.setValue("company",n,{shouldValidate:!0}),onSearch:W,isLoading:R,selectedLabel:s==null?void 0:s.company_name,options:U.map(n=>({value:n.id,label:n.name,hint:n.code})),placeholder:"Select company",searchPlaceholder:"Search companies..."})}),f.formState.errors.company&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.company.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx(N,{...f.register("name"),className:"mt-1.5",placeholder:"Plan name"}),f.formState.errors.name&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx(N,{...f.register("code"),className:"mt-1.5",placeholder:"FBP-2025"}),f.formState.errors.code&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.code.message})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Financial Year *"}),e.jsx(N,{...f.register("financial_year"),className:"mt-1.5",placeholder:"2025-26"}),f.formState.errors.financial_year&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.financial_year.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Source %"}),e.jsx(N,{...f.register("source_percentage"),className:"mt-1.5",placeholder:"40",type:"number",step:"0.01"})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Total Flex Source *"}),e.jsxs(ve,{value:f.watch("total_flex_source"),onValueChange:n=>f.setValue("total_flex_source",n),children:[e.jsx(_e,{className:"mt-1.5 h-9",children:e.jsx(be,{})}),e.jsx(Ne,{children:$a.map(n=>e.jsx(Z,{value:n.value,children:n.label},n.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Declaration Start *"}),e.jsx(N,{...f.register("declaration_start_date"),className:"mt-1.5",type:"date",max:f.watch("declaration_end_date")||void 0}),f.formState.errors.declaration_start_date&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.declaration_start_date.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Declaration End *"}),e.jsx(N,{...f.register("declaration_end_date"),className:"mt-1.5",type:"date",min:f.watch("declaration_start_date")||void 0}),f.formState.errors.declaration_end_date&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.declaration_end_date.message})]})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:f.handleSubmit(l),disabled:k.isPending||O.isPending,children:s?"Update":"Create"})]})]})}),e.jsx(Le,{open:!!v,onOpenChange:n=>!n&&x(null),children:e.jsxs(Be,{children:[e.jsxs(De,{children:[e.jsx(ze,{children:"Delete FBP plan?"}),e.jsxs(Ke,{children:["This will permanently delete ",e.jsx("strong",{children:v==null?void 0:v.name})," and all associated declarations."]})]}),e.jsxs($e,{children:[e.jsx(Ie,{children:"Cancel"}),e.jsx(Qe,{variant:"destructive",onClick:r,children:"Delete"})]})]})})]})}function Qa(a){switch(a){case"approved":case"active":return"approved";case"revised":return"in_progress";case"draft":case"submitted":default:return"pending"}}const Oa=pe({employee:j().min(1,"Employee is required"),plan:j().min(1,"Plan is required")});function cr(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),[v,x]=h.useState(""),{hasPermission:y,requirePermission:d}=oe(),V=y("compensation","fbp_declaration","create"),A=y("compensation","fbp_declaration","update"),{pagination:G,setPagination:M,sorting:Y,setSorting:Q,globalFilter:T,setGlobalFilter:I,queryParams:X}=Ce(),{data:E,isLoading:z}=Tt(X),K=(E==null?void 0:E.results)??[],[$,W]=h.useState(""),{data:F,isLoading:R}=Rt({page_size:100,search:$||void 0}),U=(F==null?void 0:F.results)??[],k=Us(),O=Gs(),c=Ys(),o=Hs(),f=me({resolver:de(Oa),defaultValues:{employee:"",plan:""}});function m(){d("compensation","fbp_declaration","create")&&(f.reset({employee:"",plan:""}),t(!0))}function q(w){k.mutate(w,{onSuccess:()=>t(!1)})}function l(){if(!s||!d("compensation","fbp_declaration","update"))return;const{declaration:w,action:n}=s;n==="submit"?O.mutate(w.id,{onSuccess:()=>p(null)}):n==="approve"?c.mutate({id:w.id},{onSuccess:()=>p(null)}):n==="reject"&&o.mutate({id:w.id,comments:v},{onSuccess:()=>{p(null),x("")}})}const r=[{key:"employee_name",header:"Employee",render:w=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:w.employee_name||"-"})},{key:"plan_name",header:"Plan",render:w=>e.jsx("span",{className:"text-[13px] text-slate-600",children:w.plan_name||"-"})},{key:"financial_year",header:"Financial Year",render:w=>e.jsx("span",{className:"text-[13px] text-slate-600",children:w.financial_year})},{key:"total_flex_amount",header:"Flex Amount",render:w=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(w.total_flex_amount).toLocaleString()})},{key:"status",header:"Status",render:w=>e.jsx(ot,{status:Qa(w.status)})},{key:"actions",header:"",className:"w-10",render:w=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[A&&w.status==="draft"&&e.jsxs(J,{onClick:()=>p({declaration:w,action:"submit"}),children:[e.jsx(ls,{className:"mr-2 h-3.5 w-3.5"})," Submit"]}),A&&w.status==="submitted"&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{onClick:()=>p({declaration:w,action:"approve"}),children:[e.jsx(et,{className:"mr-2 h-3.5 w-3.5"})," Approve"]}),e.jsx(Oe,{}),e.jsxs(J,{className:"text-red-600",onClick:()=>p({declaration:w,action:"reject"}),children:[e.jsx(mt,{className:"mr-2 h-3.5 w-3.5"})," Reject"]})]})]})]})}];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(wt,{className:"h-5 w-5 text-primary"})," FBP Declarations"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Review and manage employee FBP declarations"})]}),V&&e.jsxs(b,{size:"sm",onClick:m,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," New Declaration"]})]}),e.jsx(je,{columns:r,data:K,isLoading:z,searchPlaceholder:"Search declarations...",emptyMessage:"No FBP declarations",emptyDescription:"Create a new FBP declaration to get started.",totalCount:(E==null?void 0:E.count)??0,pagination:G,onPaginationChange:M,sorting:Y,onSortingChange:Q,globalFilter:T,onGlobalFilterChange:I}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"New FBP Declaration"}),e.jsx(re,{children:"Create a new flexible benefit declaration for an employee."})]}),e.jsxs("form",{onSubmit:f.handleSubmit(q),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Te,{value:f.watch("employee"),onValueChange:w=>f.setValue("employee",w)})}),f.formState.errors.employee&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"FBP Plan *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:f.watch("plan"),onValueChange:w=>f.setValue("plan",w),onSearch:W,isLoading:R,options:U.map(w=>({value:w.id,label:w.name,hint:w.financial_year})),placeholder:"Select plan"})}),f.formState.errors.plan&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:f.formState.errors.plan.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:f.handleSubmit(q),disabled:k.isPending,children:"Create"})]})]})}),e.jsx(Le,{open:!!s,onOpenChange:w=>{w||(p(null),x(""))},children:e.jsxs(Be,{children:[e.jsxs(De,{children:[e.jsxs(ze,{children:[(s==null?void 0:s.action)==="submit"&&"Submit declaration?",(s==null?void 0:s.action)==="approve"&&"Approve declaration?",(s==null?void 0:s.action)==="reject"&&"Reject declaration?"]}),e.jsxs(Ke,{children:[(s==null?void 0:s.action)==="submit"&&e.jsxs(e.Fragment,{children:["This will submit the declaration for ",e.jsx("strong",{children:s.declaration.employee_name})," for review."]}),(s==null?void 0:s.action)==="approve"&&e.jsxs(e.Fragment,{children:["This will approve the declaration for ",e.jsx("strong",{children:s.declaration.employee_name}),"."]}),(s==null?void 0:s.action)==="reject"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("span",{children:["This will send the declaration for ",e.jsx("strong",{children:s.declaration.employee_name})," back to draft for revision."]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Comments"}),e.jsx(N,{className:"mt-1.5",value:v,onChange:w=>x(w.target.value),placeholder:"Provide a reason..."})]})]})]})]}),e.jsxs($e,{children:[e.jsx(Ie,{children:"Cancel"}),e.jsxs(Qe,{variant:(s==null?void 0:s.action)==="reject"?"destructive":"default",onClick:l,disabled:O.isPending||c.isPending||o.isPending,children:[(s==null?void 0:s.action)==="submit"&&"Submit",(s==null?void 0:s.action)==="approve"&&"Approve",(s==null?void 0:s.action)==="reject"&&"Reject"]})]})]})})]})}const Ma={pending:"warning",approved:"success",rejected:"destructive",partial:"secondary"},Ua=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"},{value:"annual",label:"Annual"}],Ga=pe({declaration:j().min(1,"Declaration is required"),component_id:j().min(1,"Component is required"),proof_type:j().optional(),document:j().optional(),amount_claimed:j().min(1,"Amount is required"),quarter:Pe(["Q1","Q2","Q3","Q4","annual"])});function or(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),[v,x]=h.useState(""),{hasPermission:y,requirePermission:d}=oe(),V=y("compensation","fbp_proof","create"),A=y("compensation","fbp_proof","approve"),{pagination:G,setPagination:M,sorting:Y,setSorting:Q,globalFilter:T,setGlobalFilter:I,queryParams:X}=Ce(),{data:E,isLoading:z}=Ws(X),K=(E==null?void 0:E.results)??[],[$,W]=h.useState(""),{data:F,isLoading:R}=Tt({page_size:100,search:$||void 0}),U=(F==null?void 0:F.results)??[],k=Xs(),O=Js(),c=Zs(),o=me({resolver:de(Ga),defaultValues:{declaration:"",component_id:"",proof_type:"",document:"",amount_claimed:"",quarter:"annual"}});function f(){d("compensation","fbp_proof","create")&&(o.reset({declaration:"",component_id:"",proof_type:"",document:"",amount_claimed:"",quarter:"annual"}),t(!0))}function m(r){k.mutate(r,{onSuccess:()=>t(!1)})}function q(){if(!s||!d("compensation","fbp_proof","approve"))return;const{proof:r,action:w}=s;w==="verify"?O.mutate({id:r.id},{onSuccess:()=>p(null)}):c.mutate({id:r.id,review_comments:v},{onSuccess:()=>{p(null),x("")}})}const l=[{key:"component_id",header:"Component",render:r=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:r.component_id||"-"})},{key:"proof_type",header:"Proof Type",render:r=>e.jsx("span",{className:"text-[13px] text-slate-600",children:r.proof_type||"-"})},{key:"quarter",header:"Quarter",render:r=>e.jsx("span",{className:"text-[12px] text-slate-600",children:r.quarter})},{key:"amount_claimed",header:"Amount Claimed",render:r=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(r.amount_claimed).toLocaleString()})},{key:"status",header:"Status",render:r=>e.jsx(ce,{variant:Ma[r.status]??"secondary",className:"capitalize text-[11px]",children:r.status_display??r.status})},{key:"actions",header:"",className:"w-10",render:r=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsx(fe,{align:"end",children:A&&r.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{onClick:()=>p({proof:r,action:"verify"}),children:[e.jsx(et,{className:"mr-2 h-3.5 w-3.5"})," Verify"]}),e.jsx(Oe,{}),e.jsxs(J,{className:"text-red-600",onClick:()=>p({proof:r,action:"reject"}),children:[e.jsx(mt,{className:"mr-2 h-3.5 w-3.5"})," Reject"]})]})})]})}];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(Je,{className:"h-5 w-5 text-primary"})," FBP Proofs"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Verify employee proof submissions for FBP claims"})]}),V&&e.jsxs(b,{size:"sm",onClick:f,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," Upload Proof"]})]}),e.jsx(je,{columns:l,data:K,isLoading:z,searchPlaceholder:"Search proofs...",emptyMessage:"No FBP proofs",emptyDescription:"Upload proof documents for FBP declarations.",totalCount:(E==null?void 0:E.count)??0,pagination:G,onPaginationChange:M,sorting:Y,onSortingChange:Q,globalFilter:T,onGlobalFilterChange:I}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Upload FBP Proof"}),e.jsx(re,{children:"Submit a proof document for an FBP declaration."})]}),e.jsxs("form",{onSubmit:o.handleSubmit(m),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Declaration *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:o.watch("declaration"),onValueChange:r=>o.setValue("declaration",r),onSearch:W,isLoading:R,options:U.map(r=>({value:r.id,label:r.employee_name??"-",hint:r.financial_year})),placeholder:"Select declaration"})}),o.formState.errors.declaration&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.declaration.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Component ID *"}),e.jsx(N,{...o.register("component_id"),className:"mt-1.5",placeholder:"Component ID from the plan"}),o.formState.errors.component_id&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.component_id.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Proof Type"}),e.jsx(N,{...o.register("proof_type"),className:"mt-1.5",placeholder:"e.g. Rent receipt"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Document URL"}),e.jsx(N,{...o.register("document"),className:"mt-1.5",placeholder:"https://..."})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Amount Claimed *"}),e.jsx(N,{...o.register("amount_claimed"),className:"mt-1.5",placeholder:"50000",type:"number",step:"0.01"}),o.formState.errors.amount_claimed&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:o.formState.errors.amount_claimed.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Quarter *"}),e.jsxs(ve,{value:o.watch("quarter"),onValueChange:r=>o.setValue("quarter",r),children:[e.jsx(_e,{className:"mt-1.5 h-9",children:e.jsx(be,{})}),e.jsx(Ne,{children:Ua.map(r=>e.jsx(Z,{value:r.value,children:r.label},r.value))})]})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:o.handleSubmit(m),disabled:k.isPending,children:"Upload"})]})]})}),e.jsx(Le,{open:!!s,onOpenChange:r=>{r||(p(null),x(""))},children:e.jsxs(Be,{children:[e.jsxs(De,{children:[e.jsx(ze,{children:(s==null?void 0:s.action)==="verify"?"Verify proof?":"Reject proof?"}),e.jsx(Ke,{children:(s==null?void 0:s.action)==="verify"?e.jsxs(e.Fragment,{children:["This will verify the proof for component ",e.jsx("strong",{children:s.proof.component_id}),"."]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("span",{children:["This will reject the proof for component ",e.jsx("strong",{children:s==null?void 0:s.proof.component_id}),"."]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Review Comments"}),e.jsx(N,{className:"mt-1.5",value:v,onChange:r=>x(r.target.value),placeholder:"Provide a reason..."})]})]})})]}),e.jsxs($e,{children:[e.jsx(Ie,{children:"Cancel"}),e.jsx(Qe,{variant:(s==null?void 0:s.action)==="reject"?"destructive":"default",onClick:q,disabled:O.isPending||c.isPending,children:(s==null?void 0:s.action)==="verify"?"Verify":"Reject"})]})]})})]})}const Ya=[{value:"medical",label:"Medical"},{value:"telephone",label:"Telephone"},{value:"internet",label:"Internet"},{value:"fuel",label:"Fuel"},{value:"books",label:"Books"},{value:"meal",label:"Meal"},{value:"relocation",label:"Relocation"},{value:"other",label:"Other"}],Ha={medical:"success",telephone:"warning",internet:"default",fuel:"warning",books:"secondary",meal:"secondary",relocation:"default",other:"secondary"},Wa=pe({company:j().min(1,"Company is required"),name:j().min(1,"Name is required"),code:j().min(1,"Code is required"),category:Pe(["medical","telephone","internet","fuel","books","meal","relocation","other"]),annual_limit:j().optional(),monthly_limit:j().optional(),auto_approve_up_to:j().optional(),proof_required:ge().optional(),is_active:ge().optional()});function mr(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),[v,x]=h.useState(null),{hasPermission:y,requirePermission:d}=oe(),V=y("compensation","reimbursement_policy","create"),A=y("compensation","reimbursement_policy","update"),G=y("compensation","reimbursement_policy","delete"),{pagination:M,setPagination:Y,sorting:Q,setSorting:T,globalFilter:I,setGlobalFilter:X,queryParams:E}=Ce(),{data:z,isLoading:K}=Lt(E),$=(z==null?void 0:z.results)??[],[W,F]=h.useState(""),{data:R,isLoading:U}=Ve({search:W||void 0}),k=(R==null?void 0:R.results)??[],O=oa(),c=ma(),o=da(),f=()=>{var _;return{company:((_=k[0])==null?void 0:_.id)??"",name:"",code:"",category:"medical",annual_limit:"",monthly_limit:"",auto_approve_up_to:"",proof_required:!0,is_active:!0}},m=me({resolver:de(Wa),defaultValues:f()});function q(){d("compensation","reimbursement_policy","create")&&(p(null),m.reset(f()),t(!0))}function l(_){d("compensation","reimbursement_policy","update")&&(p(_),m.reset({company:_.company,name:_.name,code:_.code,category:_.category,annual_limit:_.annual_limit,monthly_limit:_.monthly_limit,auto_approve_up_to:_.auto_approve_up_to,proof_required:_.proof_required,is_active:_.is_active}),t(!0))}function r(_){s?c.mutate({id:s.id,..._},{onSuccess:()=>t(!1)}):O.mutate(_,{onSuccess:()=>t(!1)})}function w(){d("compensation","reimbursement_policy","delete")&&v&&o.mutate(v.id,{onSuccess:()=>x(null)})}const n=[{key:"name",header:"Name",render:_=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:_.name})},{key:"category",header:"Category",render:_=>e.jsx(ce,{variant:Ha[_.category]??"secondary",className:"capitalize text-[11px]",children:_.category_display??_.category})},{key:"monthly_limit",header:"Max/Month",render:_=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(_.monthly_limit).toLocaleString()})},{key:"annual_limit",header:"Max/Year",render:_=>e.jsx("span",{className:"text-[13px] text-slate-600",children:Number(_.annual_limit).toLocaleString()})},{key:"proof_required",header:"Receipt",render:_=>e.jsx(ce,{variant:_.proof_required?"warning":"secondary",className:"text-[11px]",children:_.proof_required?"Required":"Optional"})},{key:"is_active",header:"Status",render:_=>e.jsx(Me,{status:_.is_active?"active":"inactive"})},{key:"actions",header:"",className:"w-10",render:_=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[A&&e.jsxs(J,{onClick:()=>l(_),children:[e.jsx(Fe,{className:"mr-2 h-3.5 w-3.5"})," Edit"]}),A&&G&&e.jsx(Oe,{}),G&&e.jsxs(J,{className:"text-red-600",onClick:()=>x(_),children:[e.jsx(Ae,{className:"mr-2 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(st,{className:"h-5 w-5 text-primary"})," Reimbursement Policies"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Define reimbursement policies and limits"})]}),V&&e.jsxs(b,{size:"sm",onClick:q,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," Add Policy"]})]}),e.jsx(je,{columns:n,data:$,isLoading:K,searchPlaceholder:"Search policies...",emptyMessage:"No reimbursement policies",emptyDescription:"Add your first reimbursement policy to get started.",totalCount:(z==null?void 0:z.count)??0,pagination:M,onPaginationChange:Y,sorting:Q,onSortingChange:T,globalFilter:I,onGlobalFilterChange:X}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:s?"Edit Policy":"Add Reimbursement Policy"}),e.jsx(re,{children:s?"Update policy details.":"Create a new reimbursement policy."})]}),e.jsxs("form",{onSubmit:m.handleSubmit(r),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Company *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:m.watch("company")??null,onValueChange:_=>m.setValue("company",_,{shouldValidate:!0}),onSearch:F,isLoading:U,selectedLabel:s==null?void 0:s.company_name,options:k.map(_=>({value:_.id,label:_.name,hint:_.code})),placeholder:"Select company",searchPlaceholder:"Search companies..."})}),m.formState.errors.company&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:m.formState.errors.company.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Name *"}),e.jsx(N,{...m.register("name"),className:"mt-1.5",placeholder:"Policy name"}),m.formState.errors.name&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:m.formState.errors.name.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Code *"}),e.jsx(N,{...m.register("code"),className:"mt-1.5",placeholder:"REIMB-MED"}),m.formState.errors.code&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:m.formState.errors.code.message})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Category *"}),e.jsxs(ve,{value:m.watch("category"),onValueChange:_=>m.setValue("category",_),children:[e.jsx(_e,{className:"mt-1.5 h-9",children:e.jsx(be,{})}),e.jsx(Ne,{children:Ya.map(_=>e.jsx(Z,{value:_.value,children:_.label},_.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Max/Month"}),e.jsx(N,{...m.register("monthly_limit"),className:"mt-1.5",placeholder:"15000",type:"number",step:"0.01"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Max/Year"}),e.jsx(N,{...m.register("annual_limit"),className:"mt-1.5",placeholder:"100000",type:"number",step:"0.01"})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Auto-Approve Up To"}),e.jsx(N,{...m.register("auto_approve_up_to"),className:"mt-1.5",placeholder:"2000",type:"number",step:"0.01"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Proof Required"}),e.jsx(Ee,{checked:m.watch("proof_required"),onCheckedChange:_=>m.setValue("proof_required",_)})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:m.handleSubmit(r),disabled:O.isPending||c.isPending,children:s?"Update":"Create"})]})]})}),e.jsx(Le,{open:!!v,onOpenChange:_=>!_&&x(null),children:e.jsxs(Be,{children:[e.jsxs(De,{children:[e.jsx(ze,{children:"Delete reimbursement policy?"}),e.jsxs(Ke,{children:["This will permanently delete ",e.jsx("strong",{children:v==null?void 0:v.name})," and all associated data."]})]}),e.jsxs($e,{children:[e.jsx(Ie,{children:"Cancel"}),e.jsx(Qe,{variant:"destructive",onClick:w,children:"Delete"})]})]})})]})}function Xa(a){switch(a){case"paid":return"approved";case"manager_approved":case"hr_approved":case"finance_approved":return"in_progress";case"rejected":return"rejected";case"draft":case"submitted":default:return"pending"}}const Ja=Ze(pe({employee:j().min(1,"Employee is required"),policy:j().min(1,"Policy is required"),claim_period_from:j().min(1,"Period start is required"),claim_period_to:j().min(1,"Period end is required"),total_amount:j().min(1,"Amount is required")}),"claim_period_from","claim_period_to");function dr(){const[a,t]=h.useState(1),[s,p]=h.useState(""),[v,x]=h.useState(""),[y,d]=h.useState(!1),[V,A]=h.useState(!1),[G,M]=h.useState(""),[Y,Q]=h.useState(""),{hasPermission:T,requirePermission:I}=oe(),X=T("compensation","reimbursement","create"),E=T("compensation","reimbursement","approve"),z=h.useMemo(()=>({page:a,page_size:20,...s&&{search:s},...v&&{status:v}}),[a,s,v]),{data:K,isLoading:$}=pa(z),W=(K==null?void 0:K.results)??[],F=(K==null?void 0:K.count)??0,[R,U]=h.useState(""),{data:k,isLoading:O}=Lt({is_active:!0,page_size:100,search:R||void 0}),c=(k==null?void 0:k.results)??[],o=xa(),f=ua(),m=ha(),q=me({resolver:de(Ja),defaultValues:{employee:"",policy:"",claim_period_from:"",claim_period_to:"",total_amount:""}});function l(n){o.mutate({employee:n.employee,policy:n.policy,claim_period_from:n.claim_period_from,claim_period_to:n.claim_period_to,total_amount:n.total_amount},{onSuccess:()=>{d(!1),q.reset()}})}function r(){G&&I("compensation","reimbursement","approve")&&m.mutate({id:G,rejection_reason:Y},{onSuccess:()=>{A(!1),M(""),Q("")}})}const w=[{accessorKey:"claim_number",header:"Claim #",cell:({row:n})=>e.jsx("span",{className:"text-[12px] font-mono text-slate-500",children:n.original.claim_number||"--"})},{accessorKey:"employee_name",header:"Employee",cell:({row:n})=>e.jsx("span",{className:"text-[13px] font-medium text-slate-800",children:n.original.employee_name??"--"})},{accessorKey:"policy_name",header:"Policy",cell:({row:n})=>e.jsx("span",{className:"text-[12px] text-slate-600",children:n.original.policy_name??"--"})},{accessorKey:"total_amount",header:"Amount",cell:({row:n})=>e.jsx("span",{className:"text-[13px] font-semibold text-slate-800",children:n.original.total_amount})},{accessorKey:"status",header:"Status",cell:({row:n})=>e.jsx(ot,{status:Xa(n.original.status)})},{accessorKey:"claim_period_from",header:"Period From",cell:({row:n})=>e.jsx("span",{className:"text-[12px] text-slate-500",children:n.original.claim_period_from})},{id:"actions",header:"",cell:({row:n})=>{const _=n.original;return _.status!=="submitted"||!E?null:e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(fe,{align:"end",children:[e.jsxs(J,{onClick:()=>f.mutate({id:_.id}),children:[e.jsx(Nt,{className:"h-3.5 w-3.5 mr-2 text-emerald-600"})," Approve"]}),e.jsxs(J,{onClick:()=>{M(_.id),Q(""),A(!0)},className:"text-red-600",children:[e.jsx(Ct,{className:"h-3.5 w-3.5 mr-2"})," Reject"]})]})]})}}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-[16px] font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Je,{className:"h-5 w-5 text-primary"})," Reimbursement Claims"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Submit and manage reimbursement claims"})]}),X&&e.jsxs(b,{size:"sm",onClick:()=>{q.reset(),d(!0)},children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"})," New Claim"]})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(N,{placeholder:"Search claims...",value:s,onChange:n=>{p(n.target.value),t(1)},className:"w-[280px] h-9"}),e.jsxs(ve,{value:v||"__all__",onValueChange:n=>{x(n==="__all__"?"":n),t(1)},children:[e.jsx(_e,{className:"w-[160px] h-9",children:e.jsx(be,{placeholder:"All statuses"})}),e.jsxs(Ne,{children:[e.jsx(Z,{value:"__all__",children:"All Statuses"}),e.jsx(Z,{value:"submitted",children:"Submitted"}),e.jsx(Z,{value:"approved",children:"Approved"}),e.jsx(Z,{value:"rejected",children:"Rejected"}),e.jsx(Z,{value:"paid",children:"Paid"})]})]})]}),$?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((n,_)=>e.jsx(Re,{className:"h-12 w-full"},_))}):e.jsx(je,{columns:w,data:W,totalCount:F,pagination:{pageIndex:a-1,pageSize:20},onPaginationChange:n=>{const _=typeof n=="function"?n({pageIndex:a-1,pageSize:20}):n;t(_.pageIndex+1)}}),e.jsx(te,{open:y,onOpenChange:d,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"New Reimbursement Claim"}),e.jsx(re,{children:"Submit a new reimbursement claim for approval."})]}),e.jsxs("form",{onSubmit:q.handleSubmit(l),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Te,{value:q.watch("employee"),onValueChange:n=>q.setValue("employee",n,{shouldValidate:!0})})}),q.formState.errors.employee&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Reimbursement Policy *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(le,{value:q.watch("policy"),onValueChange:n=>q.setValue("policy",n,{shouldValidate:!0}),onSearch:U,isLoading:O,options:c.map(n=>({value:n.id,label:n.name,hint:n.code})),placeholder:"Select policy"})}),q.formState.errors.policy&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.policy.message})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Period From *"}),e.jsx(N,{type:"date",...q.register("claim_period_from"),className:"mt-1.5",max:q.watch("claim_period_to")||void 0}),q.formState.errors.claim_period_from&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.claim_period_from.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Period To *"}),e.jsx(N,{type:"date",...q.register("claim_period_to"),className:"mt-1.5",min:q.watch("claim_period_from")||void 0}),q.formState.errors.claim_period_to&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.claim_period_to.message})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Total Amount *"}),e.jsx(N,{...q.register("total_amount"),placeholder:"e.g. 5000",className:"mt-1.5"}),q.formState.errors.total_amount&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:q.formState.errors.total_amount.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(b,{onClick:q.handleSubmit(l),disabled:o.isPending,children:o.isPending?"Submitting...":"Submit Claim"})]})]})}),e.jsx(te,{open:V,onOpenChange:A,children:e.jsxs(se,{size:"sm",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Reject Claim"}),e.jsx(re,{children:"Please provide a reason for rejection."})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Rejection Reason *"}),e.jsx(N,{value:Y,onChange:n=>Q(n.target.value),placeholder:"Reason for rejection",className:"mt-1.5"})]})}),e.jsxs(ie,{children:[e.jsx(b,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),e.jsx(b,{variant:"destructive",disabled:!Y||m.isPending,onClick:r,children:m.isPending?"Rejecting...":"Reject"})]})]})})]})}const yt={draft:"secondary",generated:"default",sent:"success"},Za=pe({employee:j().min(1,"Employee is required"),financial_year:j().min(1,"Financial year is required")});function pr(){const[a,t]=h.useState(!1),[s,p]=h.useState(null),{hasPermission:v,requirePermission:x}=oe(),y=v("compensation","total_rewards","create"),{pagination:d,setPagination:V,sorting:A,setSorting:G,globalFilter:M,setGlobalFilter:Y,queryParams:Q}=Ce(),{data:T,isLoading:I}=fa(Q),X=(T==null?void 0:T.results)??[],E=ja(),z=me({resolver:de(Za),defaultValues:{employee:"",financial_year:""}});function K(){x("compensation","total_rewards","create")&&(z.reset({employee:"",financial_year:""}),t(!0))}function $(F){E.mutate(F,{onSuccess:()=>t(!1)})}const W=[{key:"employee_name",header:"Employee",render:F=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:F.employee_name||"-"})},{key:"financial_year",header:"Financial Year",render:F=>e.jsx("span",{className:"text-[13px] text-slate-600",children:F.financial_year})},{key:"total_value",header:"Total Rewards",render:F=>e.jsx("span",{className:"font-medium text-slate-900 text-[13px]",children:Number(F.total_value??0).toLocaleString()})},{key:"status",header:"Status",render:F=>e.jsx(ce,{variant:yt[F.status]??"secondary",className:"capitalize text-[11px]",children:F.status_display??F.status})},{key:"generated_date",header:"Generated",render:F=>e.jsx("span",{className:"text-[12px] text-slate-500",children:F.generated_date?new Date(F.generated_date).toLocaleDateString():"--"})},{key:"actions",header:"",className:"w-10",render:F=>e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon-sm",children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsx(fe,{align:"end",children:e.jsxs(J,{onClick:()=>p(F),children:[e.jsx(Ft,{className:"mr-2 h-3.5 w-3.5"})," View Statement"]})})]})}];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(qt,{className:"h-5 w-5 text-primary"})," Total Rewards"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Generate and view total rewards statements"})]}),y&&e.jsxs(b,{size:"sm",onClick:K,children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"})," Generate Statement"]})]}),e.jsx(je,{columns:W,data:X,isLoading:I,searchPlaceholder:"Search statements...",emptyMessage:"No statements",emptyDescription:"Generate a total rewards statement for an employee.",totalCount:(T==null?void 0:T.count)??0,pagination:d,onPaginationChange:V,sorting:A,onSortingChange:G,globalFilter:M,onGlobalFilterChange:Y}),e.jsx(te,{open:a,onOpenChange:t,children:e.jsxs(se,{size:"md",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Generate Total Rewards Statement"}),e.jsx(re,{children:"Generate a comprehensive rewards statement for an employee."})]}),e.jsxs("form",{onSubmit:z.handleSubmit($),className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee *"}),e.jsx("div",{className:"mt-1.5",children:e.jsx(Te,{value:z.watch("employee"),onValueChange:F=>z.setValue("employee",F)})}),z.formState.errors.employee&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:z.formState.errors.employee.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Financial Year *"}),e.jsx(N,{...z.register("financial_year"),className:"mt-1.5",placeholder:"2025-26"}),z.formState.errors.financial_year&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:z.formState.errors.financial_year.message})]})]}),e.jsxs(ie,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(b,{onClick:z.handleSubmit($),disabled:E.isPending,children:"Generate"})]})]})}),e.jsx(te,{open:!!s,onOpenChange:F=>!F&&p(null),children:e.jsxs(se,{size:"lg",children:[e.jsxs(ae,{children:[e.jsx(ne,{children:"Total Rewards Statement"}),e.jsxs(re,{children:[s==null?void 0:s.employee_name," - FY ",s==null?void 0:s.financial_year]})]}),s&&e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Employee"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:s.employee_name})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Financial Year"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:s.financial_year})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Status"}),e.jsx("div",{className:"mt-1",children:e.jsx(ce,{variant:yt[s.status]??"secondary",className:"capitalize text-[11px]",children:s.status_display??s.status})})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Total Rewards Value"}),e.jsx("p",{className:"text-[15px] font-semibold text-slate-900 mt-1",children:Number(s.total_value??0).toLocaleString()})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Generated Date"}),e.jsx("p",{className:"text-[13px] text-slate-900 mt-1",children:s.generated_date?new Date(s.generated_date).toLocaleDateString():"--"})]})]}),e.jsx(ie,{children:e.jsx(b,{type:"button",variant:"outline",onClick:()=>p(null),children:"Close"})})]})})]})}const en=pe({variable_pay_enabled:ge(),fbp_enabled:ge(),total_rewards_statement_enabled:ge(),pay_equity_analysis_enabled:ge(),ctc_revision_approval_required:ge(),increment_performance_linkage:ge(),increment_budget_enforcement:Pe(["none","soft","hard"]),fbp_declaration_window_days:ht.number().min(1,"Must be at least 1 day"),benefits_enrollment_window_days:ht.number().min(1,"Must be at least 1 day"),reimbursement_auto_approve_limit:j()});function xr(){const{data:a,isLoading:t}=us(),s=hs(),{hasPermission:p}=oe(),v=p("compensation","settings","update"),x=me({resolver:de(en),defaultValues:{variable_pay_enabled:!0,fbp_enabled:!0,total_rewards_statement_enabled:!0,pay_equity_analysis_enabled:!1,ctc_revision_approval_required:!0,increment_performance_linkage:!0,increment_budget_enforcement:"soft",fbp_declaration_window_days:30,benefits_enrollment_window_days:30,reimbursement_auto_approve_limit:"0"}});h.useEffect(()=>{a&&x.reset({variable_pay_enabled:a.variable_pay_enabled,fbp_enabled:a.fbp_enabled,total_rewards_statement_enabled:a.total_rewards_statement_enabled,pay_equity_analysis_enabled:a.pay_equity_analysis_enabled,ctc_revision_approval_required:a.ctc_revision_approval_required,increment_performance_linkage:a.increment_performance_linkage,increment_budget_enforcement:a.increment_budget_enforcement,fbp_declaration_window_days:a.fbp_declaration_window_days,benefits_enrollment_window_days:a.benefits_enrollment_window_days,reimbursement_auto_approve_limit:a.reimbursement_auto_approve_limit})},[a,x]);function y(d){const V={company:(a==null?void 0:a.company)??"",...d};s.mutate(V)}return t?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(Wt,{className:"h-6 w-6 animate-spin text-slate-400"})}):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(bt,{className:"h-5 w-5 text-primary"})," Compensation Settings"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Configure compensation module preferences and feature toggles"})]}),v&&e.jsxs(b,{size:"sm",onClick:x.handleSubmit(y),disabled:!x.formState.isDirty||s.isPending,children:[e.jsx(cs,{className:"mr-1.5 h-3.5 w-3.5"})," Save Changes"]})]}),e.jsxs("div",{className:"space-y-6 max-w-3xl",children:[e.jsx(we,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(ds,{className:"h-4 w-4 text-primary"}),e.jsx("h3",{className:"text-[14px] font-semibold text-slate-800",children:"Features"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[13px] font-medium text-slate-700",children:"Variable Pay"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Enable bonus and incentive plan management"})]}),e.jsx(ke,{name:"variable_pay_enabled",control:x.control,render:({field:d})=>e.jsx(Ee,{checked:d.value,onCheckedChange:d.onChange})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[13px] font-medium text-slate-700",children:"Flexible Benefits (FBP)"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Enable flexible benefit plan declarations and proof submissions"})]}),e.jsx(ke,{name:"fbp_enabled",control:x.control,render:({field:d})=>e.jsx(Ee,{checked:d.value,onCheckedChange:d.onChange})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[13px] font-medium text-slate-700",children:"Total Rewards Statements"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Enable total rewards statement generation for employees"})]}),e.jsx(ke,{name:"total_rewards_statement_enabled",control:x.control,render:({field:d})=>e.jsx(Ee,{checked:d.value,onCheckedChange:d.onChange})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[13px] font-medium text-slate-700",children:"Pay Equity Analysis"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Enable compa-ratio and pay equity analytics"})]}),e.jsx(ke,{name:"pay_equity_analysis_enabled",control:x.control,render:({field:d})=>e.jsx(Ee,{checked:d.value,onCheckedChange:d.onChange})})]})]})]})}),e.jsx(we,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(os,{className:"h-4 w-4 text-primary"}),e.jsx("h3",{className:"text-[14px] font-semibold text-slate-800",children:"Approvals & Limits"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[13px] font-medium text-slate-700",children:"CTC Revision Approval Required"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Require approval before a CTC revision goes active"})]}),e.jsx(ke,{name:"ctc_revision_approval_required",control:x.control,render:({field:d})=>e.jsx(Ee,{checked:d.value,onCheckedChange:d.onChange})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[13px] font-medium text-slate-700",children:"Increment Performance Linkage"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Tie increment recommendations to performance ratings"})]}),e.jsx(ke,{name:"increment_performance_linkage",control:x.control,render:({field:d})=>e.jsx(Ee,{checked:d.value,onCheckedChange:d.onChange})})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Increment Budget Enforcement"}),e.jsx(ke,{name:"increment_budget_enforcement",control:x.control,render:({field:d})=>e.jsxs(ve,{value:d.value,onValueChange:V=>d.onChange(V),children:[e.jsx(_e,{className:"mt-1.5 h-9 w-[200px]",children:e.jsx(be,{})}),e.jsxs(Ne,{children:[e.jsx(Z,{value:"none",children:"None"}),e.jsx(Z,{value:"soft",children:"Soft (warn)"}),e.jsx(Z,{value:"hard",children:"Hard (block)"})]})]})})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"FBP Declaration Window (days)"}),e.jsx(N,{...x.register("fbp_declaration_window_days"),className:"mt-1.5 w-[200px]",type:"number",min:"1"}),x.formState.errors.fbp_declaration_window_days&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:x.formState.errors.fbp_declaration_window_days.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Benefits Enrollment Window (days)"}),e.jsx(N,{...x.register("benefits_enrollment_window_days"),className:"mt-1.5 w-[200px]",type:"number",min:"1"}),x.formState.errors.benefits_enrollment_window_days&&e.jsx("p",{className:"text-[11px] text-red-500 mt-1",children:x.formState.errors.benefits_enrollment_window_days.message})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[12px] font-medium text-slate-500",children:"Reimbursement Auto-Approve Limit"}),e.jsx(N,{...x.register("reimbursement_auto_approve_limit"),className:"mt-1.5 w-[200px]",type:"number",step:"0.01",placeholder:"0"})]})]})]})})]})]})}function ur(){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(at,{className:"h-5 w-5 text-primary"})," Compensation Reports"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"View compensation reports and metrics"})]})}),e.jsxs(we,{children:[e.jsx(Ge,{children:e.jsx(Ye,{className:"text-[14px] font-semibold",children:"Report Center"})}),e.jsx(qe,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(at,{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:"View compensation reports, cost analysis, and exportable metrics."})]})})]})]})}function hr(){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(nt,{className:"h-5 w-5 text-primary"})," Compensation Analytics"]}),e.jsx("p",{className:"mt-0.5 text-[13px] text-slate-400",children:"Explore compensation trends and pay equity analytics"})]})}),e.jsxs(we,{children:[e.jsx(Ge,{children:e.jsx(Ye,{className:"text-[14px] font-semibold",children:"Analytics Dashboard"})}),e.jsx(qe,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(nt,{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:"Explore compensation trends, pay equity analytics, and workforce cost insights."})]})})]})]})}export{ir as BenefitClaimsPage,rr as BenefitEnrollmentsPage,nr as BenefitProgramsPage,tr as BudgetsPage,Xn as CTCTemplatesPage,hr as CompensationAnalyticsPage,Jn as CompensationBandsPage,Hn as CompensationDashboardPage,On as CompensationLayout,ur as CompensationReportsPage,xr as CompensationSettingsPage,Wn as EmployeeCTCPage,cr as FBPDeclarationsPage,lr as FBPPlansPage,or as FBPProofsPage,Zn as IncrementCyclesPage,er as IncrementRecommendationsPage,dr as ReimbursementClaimsPage,mr as ReimbursementPoliciesPage,pr as TotalRewardsPage,ar as VariablePayCalculationsPage,sr as VariablePayPlansPage,la as useApproveBenefitClaim,Ys as useApproveFBPDeclaration,Ts as useApproveIncrementRecommendation,ua as useApproveReimbursementClaim,ra as useBenefitClaims,At as useBenefitEnrollments,Vt as useBenefitPrograms,Un as useCTCTemplate,kt as useCTCTemplates,Mn as useCompensationBand,fs as useCompensationBands,ya as useCompensationDashboard,us as useCompensationSettings,ia as useCreateBenefitClaim,aa as useCreateBenefitEnrollment,ea as useCreateBenefitProgram,vs as useCreateCTCTemplate,js as useCreateCompensationBand,Cs as useCreateEmployeeCTC,Us as useCreateFBPDeclaration,Qs as useCreateFBPPlan,Xs as useCreateFBPProof,Ls as useCreateIncrementBudget,Ps as useCreateIncrementCycle,Rs as useCreateIncrementRecommendation,xa as useCreateReimbursementClaim,oa as useCreateReimbursementPolicy,Is as useCreateVariablePayCalculation,Ds as useCreateVariablePayPlan,sa as useDeleteBenefitProgram,bs as useDeleteCTCTemplate,gs as useDeleteCompensationBand,Ms as useDeleteFBPPlan,da as useDeleteReimbursementPolicy,Ks as useDeleteVariablePayPlan,Gn as useEmployeeCTC,Ns as useEmployeeCTCs,Tt as useFBPDeclarations,Rt as useFBPPlans,Ws as useFBPProofs,Fs as useFinalizeIncrementCycle,ja as useGenerateTotalRewards,As as useIncrementBudgets,Yn as useIncrementCycle,pt as useIncrementCycles,Es as useIncrementRecommendations,qs as useLaunchIncrementCycle,ks as useLockIncrementCycle,pa as useReimbursementClaims,Lt as useReimbursementPolicies,ca as useRejectBenefitClaim,Hs as useRejectFBPDeclaration,Zs as useRejectFBPProof,Vs as useRejectIncrementRecommendation,ha as useRejectReimbursementClaim,Ss as useReviseCTC,Gs as useSubmitFBPDeclaration,fa as useTotalRewardsStatements,na as useUpdateBenefitEnrollment,ta as useUpdateBenefitProgram,_s as useUpdateCTCTemplate,ys as useUpdateCompensationBand,hs as useUpdateCompensationSettings,Os as useUpdateFBPPlan,Bs as useUpdateIncrementBudget,ws as useUpdateIncrementCycle,ma as useUpdateReimbursementPolicy,zs as useUpdateVariablePayPlan,$s as useVariablePayCalculations,Et as useVariablePayPlans,Js as useVerifyFBPProof};
