1import{aa as Se,a as d,j as e,bH as qt}from"./vendor-mui-B3bBnIQX.js";import{f as Ne,g as mt,h as re}from"./vendor-state-3ufgB8Gu.js";import{o as Fs,s as be,Z as $e,C as it}from"./vendor-forms-BOKXSlZG.js";import{u as me,M as As,L as Bt,I as J,V as He,_ as Ps,B as y,T as We,N as Qe,x as Ls,F as Ms,y as Os,P as _t,H as qs}from"./index-K18uQlJT.js";import{L as b}from"./Label-BBxSpPWg.js";import{S as ce}from"./SearchableSelect-bG3ORqDE.js";import{A as _s}from"./AppDateTimePicker-CWA_5Ueg.js";import{E as _e}from"./ErrorMessage-BDhGtcgQ.js";import{u as Hs}from"./useTopbar-DdNCAeWW.js";import{u as Ys}from"./useZodForm-0VxvzzsK.js";import{t as Ht}from"./dateFormat-gOhHwZfI.js";import{R as W,K as Gs,L as Bs,M as Us,O as Vs,P as Ks,Q as zs,l as $s,S as Qs,T as Js,U as Ws,V as Zs,X as Xs,Y as en,Z as tn,_ as sn,$ as nn,a0 as ct,a1 as an}from"./recruitmentConstants-CGeWx0bk.js";import{u as rn}from"./useUpdateScreeningStatus-vCa8OOXX.js";import{n as Je}from"./normalizeStatus-BzEZbyLE.js";import{R as on}from"./RoundStatusBadge-BuMeRwyS.js";import{R as ln}from"./RoundHistoryModal-B1tcIMQ9.js";import{A as dn}from"./AppDatePicker-itKlj75y.js";import{M as cn}from"./AddEditMultiSelect-DpF1iQy_.js";import{s as Ee,t as mn,c as un}from"./cross-BbzxRljI.js";import{e as pn}from"./edit-B9ejy_yn.js";import{b as fn,g as xn,a as lt,r as dt}from"./documentPdf-CVZ5RZVq.js";import{f as hn,b as gn}from"./vendor-router-DjW2o810.js";import"./insightsStatusColors-BRdZlWrL.js";import"./Badge-CsR-r87v.js";import"./Avatar-B_NjdpbM.js";import"./NoHistoryResult-UZtoD070.js";const yn=n=>Ne({queryKey:[...W.CANDIDATE_DETAIL,n],queryFn:()=>Gs(n),enabled:!!n,staleTime:0,select:a=>{const o=a?.data?.records??a?.records;return Array.isArray(o)?o[0]:o}}),vn=(n=!0)=>Ne({queryKey:W.INTERVIEWER_OPTIONS,queryFn:Bs,enabled:n,select:a=>(a?.data?.records??a?.records??[]).map(j=>({value:j.userId,label:j.employeeNumberAndName}))}),jn=()=>{const n=mt(),a=me();return re({mutationFn:Us,onSuccess:o=>{if(o?.error){a.error(o?.message??"Unable to save. Please try again.");return}n.invalidateQueries({queryKey:W.CANDIDATE_DETAIL}),a.success(o?.message??"Saved successfully")},onError:o=>{a.error(o?.message??"Failed to save")}})},bn=()=>{const n=mt(),a=me();return re({mutationFn:Vs,onSuccess:o=>{if(o?.error){a.error(o?.message??"Unable to save. Please try again.");return}n.invalidateQueries({queryKey:W.CANDIDATE_DETAIL}),a.success(o?.message??"Round updated successfully")},onError:o=>{a.error(o?.message??"Failed to update round")}})},Sn=Fs({interviewMode:be().optional(),interviewerName:be().optional(),interviewDate:be().optional(),meetingLink:be().optional(),status:be().optional(),feedback:be().optional(),reason:be().optional()}).superRefine((n,a)=>{n.status==="interview_scheduled"&&(n.interviewerName?.trim()||a.addIssue({code:$e.custom,path:["interviewerName"],message:"Interviewer Name is required."}),n.interviewDate||a.addIssue({code:$e.custom,path:["interviewDate"],message:"Interview Date is required."}),n.interviewMode==="Online"&&!n.meetingLink?.trim()&&a.addIssue({code:$e.custom,path:["meetingLink"],message:"Meeting Link is required for Online interviews."})),["selected","rejected","skipped"].includes(n.status)&&!n.reason?.trim()&&a.addIssue({code:$e.custom,path:["reason"],message:"Reason is required for this status."})}),Nn=n=>Ne({queryKey:[...W.OFFER,"employmentTypes"],queryFn:()=>Ks({}),select:a=>a?.data?.records??[],enabled:n,staleTime:6e4}),Cn=n=>Ne({queryKey:[...W.OFFER,"structureList",n],queryFn:()=>zs(n?{employeeType:[Number(n)]}:{}),select:a=>a?.data?.records??[],enabled:!!n,staleTime:6e4}),In=n=>Ne({queryKey:[...W.OFFER,"allMonths"],queryFn:$s,select:a=>a?.data?.records??[],enabled:n,staleTime:1/0}),wn=n=>Ne({queryKey:[...W.OFFER,"country"],queryFn:Qs,select:a=>(a?.data?.record??[]).find(j=>j.isActive)?.countryName?.toLowerCase()==="india",enabled:n,staleTime:1/0}),Dn=n=>Ne({queryKey:[...W.OFFER,"templates"],queryFn:Js,select:a=>a?.data?.records??[],enabled:n,staleTime:6e4}),En=()=>{const n=me();return re({mutationFn:({structureId:a,ctc:o,gross:j,applicationId:m})=>Ws({structureId:a,ctc:o,gross:j,applicationId:m}),onError:a=>n.error(a?.message??"Failed to fetch structure data")})},Yt=()=>re({mutationFn:({structureId:n,usedType:a,applicationId:o})=>Zs({structureId:n,usedType:a,applicationId:o})}),kn=()=>{const n=me();return re({mutationFn:a=>Xs(a),onError:a=>n.error(a?.message??"Failed to fetch component")})},Tn=()=>{const n=me();return re({mutationFn:a=>en(a),onError:a=>n.error(a?.message??"Failed to verify calculation")})},Rn=()=>{const n=me();return re({mutationFn:a=>tn(a),onError:a=>n.error(a?.message??"Failed to save salary breakup")})},Fn=()=>{const n=me();return re({mutationFn:a=>sn(a),onError:a=>n.error(a?.message??"Failed to send offer letter")})},An=()=>re({mutationFn:n=>nn(n)}),ae=n=>n?String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):"",Pn=({candidate:n,joiningDate:a,offeredCTC:o})=>({EmployeeName:ae(n?.candidateName??n?.name),Email:ae(n?.email),PhoneNumber:ae(n?.phone),JobTitle:ae(n?.jobTitle),CompanyName:ae(n?.organizationName),offeredJoiningDate:a?ae(Se(a).format("DD-MMM-YYYY")):"",offeredCTC:ae(o),offeredDate:ae(Se().format("DD-MMM-YYYY")),CurrentDate:ae(Se().format("DD-MMM-YYYY"))});function De({variant:n,onClick:a,title:o,disabled:j}){return e.jsx(y,{variant:"icon",size:"icon",onClick:a,disabled:j,title:o,"aria-label":o,className:"shrink-0",children:e.jsx("img",{src:n==="ok"?mn:un,alt:"",className:"w-full h-full object-contain"})})}const Ln=()=>e.jsx("img",{src:pn,alt:"Edit",className:"w-6 h-6"});function Gt({item:n,onToggle:a,onValueChange:o}){return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm text-text-primary",children:n.componentName}),e.jsx(He,{checked:!!n.isSelected,onChange:j=>a(j.target.checked)})]}),e.jsx(J,{onInput:Ee,disabled:n.isDependent===!0||n.isSelected===!1||n.isEditable===!1,value:n.value??"",onChange:o})]})}function de({label:n,value:a,editable:o,onChange:j}){return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-sm text-text-primary",children:n}),e.jsx(J,{onInput:o?Ee:void 0,disabled:!o,placeholder:a==null?"0":void 0,value:a??"",onChange:j})]})}const l=[],Mn=({open:n,onClose:a,candidate:o,onSuccess:j})=>
1{const m=me(),E=o?.id,[S,U]=d.useState(null),[P,V]=d.useState(!1),[K,H]=d.useState(""),[v,ue]=d.useState(""),[L,oe]=d.useState(""),[R,N]=d.useState(""),[C,pe]=d.useState(""),[Ce,fe]=d.useState(""),[k,M]=d.useState(l),[Ze,g]=d.useState(!1),[f,F]=d.useState(!1),[Ye,ke]=d.useState(!1),[Y,Z]=d.useState(!1),[xe,z]=d.useState(l),[x,G]=d.useState(!1),[I,q]=d.useState(l),[O,X]=d.useState(!1),[he,B]=d.useState(l),[D,$]=d.useState(!1),[ee,te]=d.useState(l),[_,T]=d.useState(!1),[Ge,Te]=d.useState(l),[se,Q]=d.useState(l),[ge,u]=d.useState(""),[w,A]=d.useState(""),[ie,Ie]=d.useState(l),[Re,ye]=d.useState(""),[ne,ut]=d.useState(-1),[pt,Xe]=d.useState(l),[Fe,ve]=d.useState(l),[Be,Ae]=d.useState(l),[Pe,et]=d.useState(""),[tt,st]=d.useState(""),[Le,nt]=d.useState(1),[Ut,Vt]=d.useState(""),[ft,at]=d.useState(!1),[Kt,Ue]=d.useState(!1),[zt,$t]=d.useState(""),xt=d.useRef(null);d.useEffect(()=>{xt.current?.scrollTo(0,0)},[Le]);const{data:Qt=l}=Nn(n),{data:Jt=l}=Cn(L),{data:ht=l}=In(n),{data:gt=!1}=wn(n),{data:Me=l}=Dn(n),Wt=gt?"Rs.":"$",yt=En(),vt=Yt(),jt=Yt(),Zt=kn(),rt=Tn(),Oe=Rn(),we=Fn(),bt=An(),Xt=yt.isPending||rt.isPending||Oe.isPending||we.isPending||bt.isPending||vt.isPending||jt.isPending;d.useEffect(()=>{if(!n){V(!1);return}nt(1),at(!1),g(!1),F(!1),U(null),Ue(!1);const t=o?.salaryBreakup,s=t?.componentData?.length>0;ke(s),ue(o?.offeredCTC?String(o.offeredCTC):""),H(o?.offeredDate?Se(o.offeredDate).format("YYYY-MM-DD"):""),fe(o?.offeredRemarks||""),oe(o?.employmentTypeId?String(o.employmentTypeId):"");const r=t?.structureId?String(t.structureId):o?.payrollStructureId?String(o.payrollStructureId):"";N(r);const i=t?.gross?String(t.gross):o?.gross?String(o.gross):"";pe(i),Q(l),ve(l),Ae(l),Te(l),Xe(l),t?.componentData?.length>0?(M(t.componentData.map(c=>({...c,isSelected:c.isSelected!==void 0?c.isSelected:!0,isEditable:c.isEditable!==void 0?c.isEditable:!0}))),Z(t.includeEsi||!1),z(t.esiData||l),G(t.includeEpf||!1),q(t.epfData||l),X(t.includeGratuity||!1),B(t.gratuityData||l),$(t.includeProfessionalTax||!1),te(t.professionalTaxData||l),T(t.flexiEpfType||!1),Q((t.additionalData||[]).map(c=>({...c,isSelected:c.isSelected!==void 0?c.isSelected:!0}))),ve((t.reimbursedData||[]).map(c=>({...c,isSelected:c.isSelected!==void 0?c.isSelected:!0}))),r&&(Ve(r,"unReimbursed"),Ve(r,"reimbursed"))):(M(l),Z(!1),z(l),G(!1),q(l),X(!1),B(l),$(!1),te(l),T(!1),r&&o?.offeredCTC&&i&&St(r,o.offeredCTC,i))},[n]),d.useEffect(()=>{if(!n||P||Me.length===0)return;const t=o?.templateId?Me.find(s=>String(s.id)===String(o.templateId)):null;U(t??null),V(!0)},[n,P,Me,o?.templateId]);const Ve=(t,s)=>{(s==="unReimbursed"?vt:jt).mutate({structureId:parseInt(t,10),usedType:s,applicationId:E},{onSuccess:i=>{const c=i?.records??i?.data?.records??[];if(s==="unReimbursed"){const h=c.map(je=>je.componentId);Q(je=>je.filter(Rs=>h.includes(parseInt(Rs.componentId,10)))),Te(c)}else Xe(c)}})},St=(t,s,r)=>{yt.mutate({structureId:parseInt(t,10),ctc:parseFloat(s),gross:parseFloat(r),applicationId:E},{onSuccess:i=>{const c=i?.data?.records,h=Array.isArray(c)?c[0]:c;if(!h?.componentData?.length){M(l);return}M([...h.componentData]),Z(h.includeEsi||!1),z(h.esiComp||l),G(h.includeEpf||!1),q(h.epfComp||l),X(h.includeGratuity||!1),B(h.gratuityComp||l),$(h.includeProfessionalTax||!1),T(h.flexiEpfType||!1),h.payloadListAdditionHidden?.length>0?Te(h.payloadListAdditionHidden):Ve(t,"unReimbursed"),h.payloadListReimbursement?.length>0?Xe(h.payloadListReimbursement):Ve(t,"reimbursed")}})},le=()=>at(!1),es=t=>{const s=Me.find(r=>String(r.id)===String(t));U(s??null),le(),F(!0)},ts=t=>{H(t),le(),F(!0)},ss=t=>{ue(t.target.value),le(),g(!0),F(!0)},ns=t=>{pe(t.target.value),le(),g(!0),F(!0)},as=t=>{oe(t??""),le(),F(!0),N(""),M(l)},rs=t=>{N(t??""),le(),g(!0),F(!0),M(l),Q(l),ve(l),Ae(l),Z(!1),z(l),G(!1),q(l),T(!1),X(!1),B(l),$(!1),te(l),t&&v?.trim()&&C?.trim()&&St(t,v.trim(),C.trim())},os=t=>{fe(t.target.value),le(),F(!0)},is=()=>k.map(t=>({componentId:t.componentId,isSelected:t.isSelected,value:t.value})),qe=(t,s)=>{Zt.mutate({dataType:t,componentData:is(),additionalData:se,gross:C,applicationId:E},{onSuccess:r=>s(r?.records??r?.data?.records??[])})},ls=t=>{Z(t),g(!0),F(!0),t?qe("esi",z):z(l)},ds=t=>{G(t),g(!0),F(!0),t?qe("epf",q):(q(l),T(!1))},cs=t=>{X(t),g(!0),F(!0),t?qe("gratuity",B):B(l)},ms=t=>{$(t),g(!0),F(!0),t?qe("professionalTax",te):te(l)},us=t=>{T(t),g(!0),t||qe("epf",q)},ps=(t,s)=>{g(!0),M(r=>r.map(i=>i.componentId===t.componentId?{...i,isSelected:s}:i))},fs=(t,s)=>{le(),g(!0),M(r=>r.map(i=>i.componentId===t.componentId?{...i,value:s}:i))},Nt=(t,s)=>{q(r=>r.map((i,c)=>c===t?{...i,value:s}:i))},Ct=()=>{u(""),A(""),Ie(l),ye(""),ut(-1)},xs=()=>
1{if(!ge||!w||!Re){m.error("Please fill all fields");return}const t=Ge.find(r=>String(r.componentId)===String(ge)),s={componentId:ge,componentName:t?.componentName??"",frequency:w,month:ie,value:Re};Q(r=>ne>=0?r.map((i,c)=>c===ne?s:i):[...r,s]),g(!0),Ct()},hs=(t,s)=>{u(t.componentId),A(t.frequency),Ie(t.month??l),ye(t.value),ut(s)},gs=t=>{g(!0),Q(s=>s.filter((r,i)=>i!==t))},ys=(t,s)=>{g(!0),ve(r=>r.map(i=>i.componentId===t.componentId?{...i,isSelected:s}:i))},vs=(t,s)=>{g(!0),ve(r=>r.map(i=>i.componentId===t.componentId?{...i,value:s}:i))},js=()=>{if(!Pe||!tt){m.error("Please fill all fields");return}const t=pt.find(s=>String(s.componentId)===String(Pe));Ae(s=>[...s,{componentId:Pe,componentName:t?.componentName??"",value:tt}]),g(!0),et(""),st("")},bs=t=>{g(!0),Ae(s=>s.filter((r,i)=>i!==t))},Ss=t=>(t??[]).map(s=>ht.find(r=>r.id===s)?.month).filter(Boolean).join(", "),Ke=!!(S&&K&&v?.trim()&&L&&R&&C?.trim()&&Ce?.trim()),It=()=>[...Fe,...Be].filter((t,s,r)=>r.findIndex(i=>parseInt(i.componentId,10)===parseInt(t.componentId,10))===s).map(t=>({componentId:parseInt(t.componentId,10),isSelected:t.isSelected!==void 0?t.isSelected:!0,value:parseFloat(t.value)||0})),wt=()=>se.map(t=>({componentId:parseInt(t.componentId,10),frequency:t.frequency,month:t.month||[],value:parseFloat(t.value)||0})),Dt=()=>[...k].sort((t,s)=>
1t.componentId-s.componentId).map(t=>({componentId:t.componentId,isSelected:t.isSelected,value:parseFloat(t.value)||0})),Ns=()=>{if(!R||!v?.trim()||!C?.trim())return;const t=I.find(r=>r.componentName?.toLowerCase()?.includes("employee"))||I[0]||{},s=I.find(r=>r.componentName?.toLowerCase()?.includes("employer"))||I[1]||{};rt.mutate({applicationId:E,structureId:parseInt(R,10),ctc:parseFloat(v.trim()),gross:parseFloat(C.trim()),componentData:Dt(),additionalData:wt(),reimbursedData:It(),includeEsi:Y,includeEpf:x,flexiEpfType:_,employeeEpfValue:x&&parseFloat(t.value)||0,employerEpfValue:x&&parseFloat(s.value)||0,includeGratuity:O,includeProfessionalTax:D},{onSuccess:r=>{const i=r?.data?.records??r?.records,c=Array.isArray(i)?i[0]:i;c?.componentData?.length>0&&(M(c.componentData.map(h=>({...h,isEditable:h.isEditable!==void 0?h.isEditable:!0}))),Z(c.includeEsi||!1),z(c.esiComp||l),G(c.includeEpf||!1),q(c.epfComp||l),X(c.includeGratuity||!1),B(c.gratuityComp||l),$(c.includeProfessionalTax||!1),te(c.professionalTax||l),T(c.flexiEpfType||!1),c.additionalData&&Q(c.additionalData.map(h=>({...h,month:h.month?.map(je=>typeof je=="object"?je.id:je)||[]}))),c.reimbursedData&&(ve(c.reimbursedData.filter(h=>h.type==="structureReimbursed")),Ae(c.reimbursedData.filter(h=>h.type==="extraReimbursed")))),g(!1),m.success(r?.message||"Calculated successfully")}})},Et=t=>{const s=I.find(i=>i.componentName?.toLowerCase()?.includes("employee"))||I[0]||{},r=I.find(i=>i.componentName?.toLowerCase()?.includes("employer"))||I[1]||{};return{applicationId:E,structureId:parseInt(R,10),ctc:parseFloat(v.trim()),gross:parseFloat(C.trim()),componentData:Dt(),additionalData:wt(),reimbursedData:It(),includeEsi:Y,includeEpf:x,flexiEpfType:_,employeeEpfValue:x&&parseFloat(s.value)||0,employerEpfValue:x&&parseFloat(r.value)||0,esiData:Y?xe.map(i=>({type:"esi",componentId:i.componentId,value:parseFloat(i.value)||0})):[],epfData:x?I.map(i=>({type:"epf",componentId:i.componentId,value:parseFloat(i.value)||0})):[],gratuityData:O?he.map(i=>({type:"gratuity",componentId:i.componentId,value:parseFloat(i.value)||0})):[],professionalTaxData:D?ee.map(i=>({type:"professionalTax",componentId:i.componentId,value:parseFloat(i.value)||0})):[],includeGratuity:O,includeProfessionalTax:D,isActuallyUpdate:t}},kt=()=>({applicationId:String(E),jobId:String(o?.jobId),templateId:String(S.id),offeredCTC:v.trim(),employmentTypeId:String(L),payrollStructureId:String(R),offeredDate:Se(K).format("YYYY-MM-DD"),offeredRemarks:Ce.trim()}),Cs=async()=>{if(!(!Ke||!R||!v?.trim()||!C?.trim()||k.length===0||!f))try{const[t]=await Promise.all([Oe.mutateAsync(Et(!1)),we.mutateAsync(kt())]);ke(!0),F(!1),g(!1),$t(t?.message||"Do you want to save this salary breakup?"),Ue(!0),j?.()}catch{}},Is=()=>{Ue(!1),Oe.mutate(Et(!0),{onSuccess:t=>{const s=t?.data?.records??t?.records,r=Array.isArray(s)?s[0]:s;r?.componentData?.length>0&&(M([...r.componentData]),Z(r.includeEsi||!1),z(r.esiComp||l),G(r.includeEpf||!1),q(r.epfComp||l),X(r.includeGratuity||!1),B(r.gratuityComp||l),$(r.includeProfessionalTax||!1),T(r.flexiEpfType||!1),r.additionalData&&Q(r.additionalData),r.reimbursedData&&ve(r.reimbursedData)),ke(!0),m.success(t?.message||"Salary breakup calculated successfully")}})},ot=async t=>{try{const s=await bt.mutateAsync(t),r=s?.data?.data??s?.data;return r?r.startsWith("data:")?r:`data:image/png;base64,${r}`:null}catch(s){return m.error(s?.message??"Proxy image fetch failed, skipping image"),null}},Tt=async()=>{const t=Pn({candidate:o,joiningDate:K,offeredCTC:v}),s=xn({componentData:k,structureReimbursements:Fe,updatedListExtraComp:se,includeEsi:Y,esiComp:xe,includeEpf:x,epfComp:I,includeGratuity:O,gratuityComp:he,includeProfessionalTax:D,professionalTaxComp:ee,offeredCTC:v,grossSalary:C,currencySymbol:Wt}),r=S.header?await lt(dt(S.header,t,s),ot):"";let i=S.mainContent?await lt(dt(S.mainContent,t,s),ot):"";const c=S.footer?await lt(dt(S.footer,t,s),ot):"";return!(S.mainContent||"").includes("EmployeeSalaryBreakup")&&k.length>0&&(i+=s),{headerHtml:r,mainHtml:i,footerHtml:c}},ws=async()=>{if(!S){m.error("Please select a template");return}try{const{headerHtml:t,mainHtml:s,footerHtml:r}=await Tt();Vt(`${t}${s}${r}`),at(!0)}catch{m.error("Failed to load preview")}},Ds=async()=>
1{if(!(!Ke||!Ye))try{await we.mutateAsync(kt()),j?.(),await ws(),nt(2)}catch{}},Es=async()=>{if(!ft)return;let t;try{const{headerHtml:s,mainHtml:r,footerHtml:i}=await Tt();t=await fn({headerHtml:s,mainHtml:r,footerHtml:i})}catch(s){m.error(s?.message??"Failed to generate the offer letter document");return}try{const s={applicationId:String(E),jobId:String(o?.jobId),templateId:String(S.id),offeredCTC:v.trim(),employmentTypeId:L,structureId:R,payrollStructureId:R,gross:C.trim(),componentData:[...k].sort((i,c)=>i.componentId-c.componentId).map(i=>({componentId:i.componentId,isSelected:i.isSelected,value:i.value||0})),includeEsi:Y,includeEpf:x,includeGratuity:O,includeProfessionalTax:D,flexiEpfType:_,esiComp:xe,epfComp:I,gratuityComp:he,additionalData:se,reimbursedData:[...Fe,...Be],offeredDate:Se(K).format("YYYY-MM-DD"),offeredRemarks:Ce.trim(),documentBase64:t},r=await we.mutateAsync(s);m.success(r?.message||"Offer letter sent successfully"),j?.(),a()}catch{}},Rt=(t,s)=>e.jsxs("div",{className:"border border-border rounded-xl p-4",children:[s&&e.jsx("h4",{className:"text-sm font-semibold text-text-primary mb-3",children:s}),e.jsx("div",{className:"grid grid-cols-2 gap-x-5 gap-y-4",children:t.map(r=>e.jsx(Gt,{item:r,onToggle:i=>ps(r,i),onValueChange:i=>fs(r,i.target.value)},r.componentId))})]}),ze=k.some(t=>t.includeInGrossSalary!==void 0),Ft=ze?k.filter(t=>t.includeInGrossSalary).sort((t,s)=>
1t.componentId-s.componentId):[],At=ze?k.filter(t=>!t.includeInGrossSalary).sort((t,s)=>t.componentId-s.componentId):[...k].sort((t,s)=>t.componentId-s.componentId),Pt=xe.find(t=>t.componentName?.toLowerCase()?.includes("employee")),Lt=xe.find(t=>t.componentName?.toLowerCase()?.includes("employer")),Mt=I.find(t=>t.componentName?.toLowerCase()?.includes("employee")),ks=I.findIndex(t=>t.componentName?.toLowerCase()?.includes("employee")),Ot=I.find(t=>t.componentName?.toLowerCase()?.includes("employer")),Ts=I.findIndex(t=>t.componentName?.toLowerCase()?.includes("employer"));return e.jsxs(e.Fragment,{children:[e.jsxs(As,{open:n,onClose:a,title:"Generate Offer Letter",width:900,bodyRef:xt,footer:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx(y,{variant:"secondary",onClick:()=>Le===2?nt(1):a(),children:Le===2?"Back":"Cancel"}),Le===1?e.jsxs("div",{className:"flex items-center gap-3",children:[k.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"success",onClick:Ns,disabled:!R||!v?.trim()||!C?.trim()||!Ze,isLoading:rt.isPending,children:"Calculate"}),e.jsx(y,{variant:"primary",onClick:Cs,disabled:!Ke||!R||!v?.trim()||!C?.trim()||k.length===0||!f,isLoading:Oe.isPending||we.isPending,children:"Save"})]}),e.jsx(y,{variant:"primary",onClick:Ds,disabled:!Ke||!Ye,children:"Preview Offer"})]}):e.jsx(y,{variant:"primary",onClick:Es,disabled:!ft,isLoading:we.isPending,children:"Save"})]}),children:[Xt&&e.jsx(Bt,{}),Le===1?e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{required:!0,children:"Select Template"}),e.jsx(ce,{options:Me.map(t=>({value:String(t.id),label:t.title})),value:S?.id!=null?String(S.id):"",onChange:es,placeholder:"Select Template"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{required:!0,children:"Joining Date"}),e.jsx(dn,{label:"",value:K,onChange:ts,minDate:Se().format("YYYY-MM-DD")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{required:!0,children:"Employment Type"}),e.jsx(ce,{options:Qt.map(t=>({value:String(t.id),label:t.name})),value:L,onChange:as,placeholder:"Select Employment Type"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{required:!0,children:"Offered CTC"}),e.jsx(J,{onInput:Ee,value:v,onChange:ss,placeholder:"Enter Offered CTC"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{required:!0,children:"Gross Salary"}),e.jsx(J,{onInput:Ee,value:C,onChange:ns,placeholder:"Enter Gross Salary"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{required:!0,children:"Salary Structure"}),e.jsx(ce,{options:Jt.map(t=>({value:String(t.structureId),label:t.structureName})),value:R,onChange:rs,placeholder:"Select Structure",disabled:!L})]})]}),k.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"text-sm font-semibold text-text-primary -mb-2",children:"Salary Breakup"}),ze&&Ft.length>0&&Rt(Ft,"Gross Salary"),At.length>0&&Rt(At,ze?null:void 0)]}),gt&&k.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border border-border rounded-xl p-4 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Include ESI"}),e.jsx(He,{checked:Y,onChange:t=>ls(t.target.checked)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-5 gap-y-4",children:[e.jsx(de,{label:Pt?.componentName??"Employee ESI",value:Y?Pt?.value:void 0}),e.jsx(de,{label:Lt?.componentName??"Employer ESI",value:Y?Lt?.value:void 0})]}),e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Include EPF"}),e.jsx(He,{checked:x,onChange:t=>ds(t.target.checked)})]}),e.jsx(Ps,{label:"Flexible",checked:_,disabled:!x,onChange:t=>us(t.target.checked)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-5 gap-y-4",children:[e.jsx(de,{label:Mt?.componentName??"Employee PF",value:x?Mt?.value:void 0,editable:_&&x,onChange:t=>Nt(ks,t.target.value)}),e.jsx(de,{label:Ot?.componentName??"Employer PF",value:x?Ot?.value:void 0,editable:_&&x,onChange:t=>Nt(Ts,t.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Gratuity"}),e.jsx(He,{checked:O,onChange:t=>cs(t.target.checked)})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Professional Tax"}),e.jsx(He,{checked:D,onChange:t=>ms(t.target.checked)})]})]}),e.jsxs("div",{className:"border border-border rounded-xl p-4 grid grid-cols-2 gap-x-5 gap-y-4",children:[O&&he.length>0?he.map((t,s)=>e.jsx(de,{label:t.componentName,value:t.value},`gr-${s}`)):e.jsx(de,{label:"Gratuity"}),D&&ee.length>0?ee.map((t,s)=>e.jsx(de,{label:t.componentName,value:t.value},`pt-${s}`)):e.jsx(de,{label:"Professional Tax"})]})]}),e.jsxs("div",{className:"border border-border rounded-xl p-4",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-3 items-end",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{className:"text-xs font-medium text-text-secondary",children:"Additional Component"}),e.jsx(ce,{options:Ge.map(t=>({value:String(t.componentId),label:t.componentName}
1)),value:ge?String(ge):"",onChange:t=>u(t??""),disabled:ne>=0,placeholder:"Select"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{className:"text-xs font-medium text-text-secondary",children:"Frequency"}),e.jsx(ce,{options:[{value:"custom",label:"Custom"},{value:"monthly",label:"Monthly"},{value:"quarterly",label:"Quarterly"},{value:"biyearly",label:"Bi Yearly"},{value:"yearly",label:"Yearly"},{value:"none",label:"None"}],value:w,onChange:t=>A(t??""),placeholder:"Component Frequency"})]}),e.jsx("div",{"aria-hidden":"true"}),e.jsx(cn,{label:"Month",options:ht,selected:ie,onChange:Ie,valueKey:"id",labelKey:"month",disabled:w==="none"||w===""}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{className:"text-xs font-medium text-text-secondary",children:"Amount"}),e.jsx(J,{onInput:Ee,value:Re,onChange:t=>ye(t.target.value),placeholder:"Amount"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(De,{variant:"ok",title:ne>=0?"Update component":"Add component",onClick:xs}),e.jsx(De,{variant:"remove",title:ne>=0?"Cancel edit":"Clear",onClick:Ct})]})]}),se.length>0&&e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs font-semibold text-text-secondary border-b border-border",children:[e.jsx("th",{className:"py-2 pr-2",children:"Additional Component"}),e.jsx("th",{className:"py-2 pr-2",children:"Frequency"}),e.jsx("th",{className:"py-2 pr-2",children:"Month"}),e.jsx("th",{className:"py-2 pr-2",children:"Amount"}),e.jsx("th",{className:"py-2 pr-2",children:"Action"})]})}),e.jsx("tbody",{children:se.map((t,s)=>e.jsxs("tr",{className:"border-b border-border last:border-0",children:[e.jsx("td",{className:"py-2 pr-2",children:t.componentName}),e.jsx("td",{className:"py-2 pr-2 capitalize",children:t.frequency}),e.jsx("td",{className:"py-2 pr-2",children:Ss(t.month)}),e.jsx("td",{className:"py-2 pr-2",children:t.value}),e.jsx("td",{className:"py-2 pr-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{variant:"icon",size:"icon",onClick:()=>hs(t,s),"aria-label":"Edit component",className:"text-text-secondary",children:e.jsx(Ln,{})}),e.jsx(De,{variant:"remove",title:"Remove",onClick:()=>gs(s)})]})})]},s))})]})})]}),e.jsxs("div",{className:"border border-border rounded-xl p-4",children:[e.jsx("h4",{className:"text-sm font-semibold text-text-primary mb-3",children:"Reimbursements"}),e.jsx("p",{className:"text-xs font-medium text-text-secondary mb-3",children:"Structure Linked Reimbursement"}),Fe.length>0&&e.jsx("div",{className:"grid grid-cols-2 gap-x-5 gap-y-4 mb-4",children:Fe.map(t=>e.jsx(Gt,{item:t,onToggle:s=>ys(t,s),onValueChange:s=>vs(t,s.target.value)},t.componentId))}),e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-3 items-end pt-3 border-t border-border",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{className:"text-xs font-medium text-text-secondary",children:"Additional Reimbursement"}),e.jsx(ce,{options:pt.map(t=>({value:String(t.componentId),label:t.componentName})),value:Pe?String(Pe):"",onChange:t=>et(t??""),placeholder:"Select"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(b,{className:"text-xs font-medium text-text-secondary",children:"Amount"}),e.jsx(J,{onInput:Ee,value:tt,onChange:t=>st(t.target.value),placeholder:"Amount"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(De,{variant:"ok",title:"Add reimbursement",onClick:js}),e.jsx(De,{variant:"remove",title:"Clear",onClick:()=>{et(""),st("")}})]})]}),Be.length>0&&e.jsx("div",{className:"mt-4 flex flex-col gap-2",children:Be.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-text-primary",children:t.componentName}),e.jsx("span",{className:"text-text-primary",children:t.value}),e.jsx(De,{variant:"remove",title:"Remove",onClick:()=>bs(s)})]},s))})]}),e.jsxs("div",{children:[e.jsx(b,{required:!0,children:"Remarks"}),e.jsx(We,{rows:3,value:Ce,onChange:os,placeholder:"Enter Remarks"})]})]}):e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("h4",{className:"text-sm font-semibold text-text-primary",children:"Offer Letter Preview"}),e.jsx("div",{className:"ck-content offer-letter-preview border border-border rounded-xl p-6 bg-white text-black",dangerouslySetInnerHTML:{__html:Ut}}
1)]})]}),e.jsx(Qe,{open:Kt,title:zt,confirmText:"Yes",cancelText:"Cancel",isLoading:Oe.isPending,onConfirm:Is,onClose:()=>Ue(!1)})]})},p=(n,...a)=>a.map(o=>n?.[o]).find(o=>o!=null&&o!==""),On=n=>n?`${n}:00`:"",ma=()=>{const{applicationId:n}=hn(),a=Ls(n),o=gn(),j=mt(),{data:m,isLoading:E}=yn(a),{data:S=[]}=vn(),U=rn(),P=jn(),V=bn(),[K,H]=d.useState(null),[v,ue]=d.useState(""),[L,oe]=d.useState(null),[R,N]=d.useState(!1),[C,pe]=d.useState(!1),[Ce,fe]=d.useState(!1),[k,M]=d.useState(!1),Ze=()=>j.invalidateQueries({queryKey:[...W.CANDIDATE_DETAIL,a]});d.useEffect(()=>{m&&ue(m.comment??"")},[m]);const g=m?.rounds??[],f=K!=null?g[K]:null,{register:F,control:Ye,handleSubmit:ke,reset:Y,watch:Z,formState:{errors:xe}}=Ys(Sn,{defaultValues:{interviewMode:"",interviewerName:"",interviewDate:"",meetingLink:"",status:"",feedback:"",reason:""}}),z=Z("status");d.useEffect(()=>{f&&Y({interviewMode:p(f,"mode","interviewMode","roundMode")??"",interviewerName:p(f,"interviewerName")??"",interviewDate:Ht(p(f,"interviewDate")),meetingLink:p(f,"meetingLink","interviewLink")??"",status:p(f,"status","roundStatus")??"",feedback:p(f,"feedback")??"",reason:p(f,"reason")??""})},[f,Y]);const x=Je(m?.status),G=["screening_rejected","rejected"].includes(x),I=g[g.length-1],q=I?Je(p(I,"status","roundStatus")):null,O=g.length>0&&["selected","skipped"].includes(q)&&!["offered","hired"].includes(x),X=["offered","hired"].includes(x),he=!!(m?.offeredPresignedUrl||m?.offeredCTC),B=X?"Offer letter has already been generated and sent to the candidate":he?"Offer letter is ready, not sent to the candidate yet":O?"":"Enabled once the candidate's last round is Selected or Skipped",D=m?.jobId,$=()=>o(D?`${_t.APP.recruitmentDetailPath(qs(D))}?tab=candidates`:_t.APP.RECRUITMENT),[ee,te]=d.useState(null),_=(u,w)=>{te(u),U.mutate({jobId:D,applicationId:[m.id],screeningStatus:u},{...w,onSettled:()=>te(null)})},T=v!==(m?.comment??""),Ge=()=>{!T||!g[0]||P.mutate({jobId:D,applicationId:a,roundId:p(g[0],"roundId"),comment:v})},Te=ke(u=>{const w=p(f,"roundId"),A={status:Je(p(f,"status","roundStatus")),feedback:p(f,"feedback")??"",reason:p(f,"reason")??"",meetingLink:p(f,"meetingLink","interviewLink")??"",interviewerName:p(f,"interviewerName")??"",interviewDate:Ht(p(f,"interviewDate"))},ie=u.status===A.status&&u.feedback===A.feedback&&u.reason===A.reason&&u.meetingLink===A.meetingLink&&u.interviewerName===A.interviewerName&&u.interviewDate===A.interviewDate;if(ie&&!T){H(null);return}if(ie&&T){P.mutate({jobId:D,applicationId:a,roundId:w,comment:v},{onSuccess:()=>H(null)});return}if(u.status==="interview_scheduled"){P.mutate({jobId:D,applicationId:a,roundId:w,interviewStatus:"interview_scheduled",meetingLink:u.meetingLink,interviewerName:u.interviewerName,interviewDate:On(u.interviewDate),...T&&{comment:v}},{onSuccess:()=>H(null)});return}ct.includes(u.status)&&V.mutate({jobId:D,applicationId:a,roundId:w,interviewStatus:u.status,feedback:u.feedback,reason:u.reason},{onSuccess:()=>{T&&P.mutate({jobId:D,applicationId:a,roundId:w,comment:v}),H(null)}})}),se=(u,w)=>{if(!G){const A=m?.currentRoundNo?Number(m.currentRoundNo)+1:1;if(Number(p(u,"roundNumber","roundNo"))>A)return}H(w)},Q=P.isPending||V.isPending;if(Hs({title:"Candidate Details",searchPlaceholder:!1,showBack:!0,onBack:$,rightAction:!E&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"secondary",onClick:$,children:"Cancel"}),e.jsx(y,{variant:"primary",isLoading:P.isPending&&!f,disabled:!T||f,onClick:Ge,children:"Save"}),e.jsx(Ms,{title:B,children:e.jsx("span",{children:e.jsx(y,{variant:"primary",disabled:!O,onClick:()=>M(!0),children:"Generate Offer"})})})]}),deps:[E,T,v,!!f,P.isPending,O,B]}),E||!m)return e.jsx(Bt,{});const ge=m.resumeUrl?.split("/").pop()?.replace(/\.[^.]+$/,"")||"Resume";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"border border-border rounded-2xl p-4 flex flex-col gap-6",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-x-6 gap-y-6 text-sm",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-text-primary",children:"Candidate Name :"})," ",e.jsx("span",{className:"text-text-secondary",children:m.candidateName??m.name})]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-text-primary",children:"Email :"})," ",e.jsx("span",{className:"text-primary",children:m.email})]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-text-primary",children:"Phone No. :"})," ",e.jsx("span",{className:"text-text-secondary",children:m.phone})]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-text-primary",children:"Current City :"})," ",e.jsx("span",{className:"text-text-secondary",children:m.currentLocation??m.address})]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-text-primary",children:"Experience :"})," ",e.jsxs("span",{className:"text-text-secondary",children:[m.experience," Years"]})]}),e.jsxs("p",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-text-primary",children:"Resume :"}),m.resumePresignedUrl?e.jsxs("a",{href:m.resumePresignedUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:[e.jsx(qt,{sx:{fontSize:16}})," ",ge]}):e.jsx("span",{className:"text-text-secondary",children:"â"})]}),m.offeredPresignedUrl&&e.jsxs("p",{className:"flex items-center gap-1 sm:col-span-3",children:[e.jsx("span",{className:"font-medium text-text-primary",children:"Offer Letter :"}),e.jsxs("a",{href:m.offeredPresignedUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:[e.jsx(qt,{sx:{fontSize:16}})," Offer Letter"]})]})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"comment",children:"Add Comment"}
1),e.jsx(We,{id:"comment",rows:4,value:v,onChange:u=>ue(u.target.value),placeholder:"Write Comment"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 flex-wrap",children:[x==="applied"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"warning",isLoading:ee==="screening_accepted",onClick:()=>_("screening_accepted"),children:"Screening Accepted"}),e.jsx(y,{variant:"danger",isLoading:ee==="screening_rejected",onClick:()=>_("screening_rejected"),children:"Screening Rejected"})]}),x==="screening_accepted"&&e.jsx(y,{variant:"warning",disabled:!0,children:"Screening Accepted"}),x==="screening_rejected"&&e.jsx(y,{variant:"danger",disabled:!0,children:"Screening Rejected"}),x==="under_interview"&&!O&&e.jsx(y,{variant:"secondary",disabled:!0,children:"Under Interview"}),["offered","hired","rejected"].includes(x)&&e.jsxs(e.Fragment,{children:[x==="offered"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"warning",disabled:!0,children:"Offered"}),e.jsx(y,{variant:"success",onClick:()=>pe(!0),children:"Hired"})]}),x==="hired"&&e.jsx(y,{variant:"success",disabled:!0,children:"Hired"}),x==="rejected"&&e.jsx(y,{variant:"danger",disabled:!0,children:"Rejected"}),x==="offered"&&e.jsx(y,{variant:"danger",isLoading:ee==="rejected",onClick:()=>fe(!0),children:"Rejected"})]}),O&&!["offered","hired"].includes(x)&&e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"warning",onClick:()=>N(!0),children:"Offered"}),e.jsx(y,{variant:"success",onClick:()=>pe(!0),children:"Hired"}),e.jsx(y,{variant:"danger",isLoading:ee==="rejected",onClick:()=>fe(!0),children:"Rejected"})]})]})]}),f==null?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:g.map((u,w)=>{const A=p(u,"roundNumber","roundNo"),ie=p(u,"status","roundStatus"),Ie=p(u,"interviewerName"),Re=S.find(ne=>ne.value===Ie)?.label??Ie,ye=!G&&Number(A)>(m?.currentRoundNo?Number(m.currentRoundNo)+1:1);return e.jsxs("div",{role:"button",tabIndex:ye?-1:0,"aria-disabled":ye,onClick:()=>se(u,w),onKeyDown:ne=>ne.key==="Enter"&&se(u,w),className:Os("text-left border border-border rounded-2xl p-4 flex flex-col gap-3 transition-colors duration-fast",ye?"opacity-50 cursor-not-allowed":"hover:border-border-strong cursor-pointer"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-base font-semibold text-primary",children:["Round ",A]}),e.jsx("p",{className:"text-sm text-text-secondary",children:p(u,"description","roundDescription")})]}),ie&&e.jsx(on,{status:ie})]}),e.jsx("hr",{className:"border-border"}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Mode Of Interview:"})," ",e.jsx("span",{className:"text-text-primary",children:p(u,"mode","interviewMode","roundMode")||"â"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Interviewer Name:"})," ",e.jsx("span",{className:"text-text-primary",children:Re||"â"})]})]})]},p(u,"roundId")??w)})}):e.jsxs("div",{className:"border border-border rounded-2xl overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 bg-primary-light",children:e.jsxs("p",{className:"text-sm font-semibold text-primary",children:["Round ",p(f,"roundNumber","roundNo")," : ",p(f,"description","roundDescription")]})}),e.jsxs("div",{className:"p-4 grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-4",children:[e.jsxs("div",{children:[e.jsx(b,{htmlFor:"roundDetails",children:"Round Details"}),e.jsx(J,{id:"roundDetails",disabled:!0,readOnly:!0,value:p(f,"description","roundDescription")??""})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"interviewMode",children:"Mode of Interview"}),e.jsx(J,{id:"interviewMode",disabled:!0,readOnly:!0,value:p(f,"mode","interviewMode","roundMode")??""})]}),e.jsx(qn,{register:F,control:Ye,errors:xe,watchedStatus:z,candidate:m,round:f,isCandidateRejected:G,interviewerOptions:S,onViewHistory:oe})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[e.jsx(y,{variant:"secondary",onClick:()=>H(null),children:"Cancel"}),e.jsx(y,{variant:"primary",isLoading:Q,onClick:Te,children:"Save"})]})]})]}),e.jsx(ln,{jobId:D,applicationId:a,roundId:L?p(f,"roundId"):null,action:L,onClose:()=>oe(null)}),e.jsx(Qe,{open:R,title:"Are you sure you want to send the offer letter to this candidate?",confirmText:"Send Offer",cancelText:"Cancel",isLoading:U.isPending,onConfirm:()=>_("offered",{onSuccess:()=>N(!1)}),onClose:()=>N(!1)}),e.jsx(Qe,{open:C,title:"Are you sure you want to hire this candidate?",confirmText:"Hire",cancelText:"Cancel",isLoading:U.isPending,onConfirm:()=>_("hired",{onSuccess:()=>pe(!1)}),onClose:()=>pe(!1)}),e.jsx(Qe,{open:Ce,title:"Are you sure you want to reject this candidate?",confirmText:"Reject",cancelText:"Cancel",isLoading:U.isPending,onConfirm:()=>_("rejected",{onSuccess:()=>fe(!1)}),onClose:()=>fe(!1)}),e.jsx(Mn,{open:k,onClose:()=>M(!1),candidate:m,onSuccess:Ze})]})},qn=({register:n,control:a,errors:o,watchedStatus:j,candidate:m,round:E,isCandidateRejected:S,interviewerOptions:U,onViewHistory:P})=>{const V=Je(p(E,"status","roundStatus")),K=Number(p(E,"roundNumber","roundNo")),H=Number(m?.currentRoundNo??
10),v=p(E,"mode","interviewMode","roundMode"),ue=S||V==="skipped"||K<H,L=(S||ct.includes(V))&&j!=="interview_scheduled",oe=S||j===""||j==="interview_scheduled",R=an.map(N=>({...N,disabled:["selected","rejected"].includes(N.value)&&(V==="skipped"||V==="")}));return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(b,{htmlFor:"roundNumber",children:"Round Number"}),e.jsx(J,{id:"roundNumber",disabled:!0,readOnly:!0,value:p(E,"roundNumber","roundNo")??""})]}),e.jsx("div",{}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"interviewerName",required:!0,children:"Interviewer Name"}),e.jsx(it,{name:"interviewerName",control:a,render:({field:N})=>e.jsx(ce,{id:"interviewerName",options:U,value:N.value,onChange:C=>N.onChange(C??""),placeholder:"Select",disabled:L,hasError:!!o.interviewerName})}),e.jsx(_e,{message:o.interviewerName?.message})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"interviewDate",required:!0,children:"Interview Scheduled On"}),e.jsx(it,{name:"interviewDate",control:a,render:({field:N})=>e.jsx(_s,{value:N.value,onChange:N.onChange,minDateTime:new Date().toISOString(),disabled:L})}),e.jsx(_e,{message:o.interviewDate?.message})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"meetingLink",required:v==="Online",children:"Meeting Link"}),e.jsx(J,{id:"meetingLink",placeholder:"https://meet.google.com/...",disabled:L,hasError:!!o.meetingLink,...n("meetingLink")}),e.jsx(_e,{message:o.meetingLink?.message})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"status",required:!0,children:"Status"}),e.jsx(it,{name:"status",control:a,render:({field:N})=>e.jsx(ce,{id:"status",options:R,value:N.value,onChange:C=>N.onChange(C??""),placeholder:"Select",disabled:ue,hasError:!!o.status})}),e.jsx(_e,{message:o.status?.message})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(b,{htmlFor:"feedback",className:"mb-0",children:"Feedback"}),e.jsx("button",{type:"button",onClick:()=>P("feedback"),className:"text-xs font-medium text-primary hover:underline cursor-pointer",children:"View History"})]}),e.jsx(We,{id:"feedback",rows:3,disabled:oe,...n("feedback")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(b,{htmlFor:"reason",required:ct.includes(j),className:"mb-0",children:"Reason"}),e.jsx("button",{type:"button",onClick:()=>P("reason"),className:"text-xs font-medium text-primary hover:underline cursor-pointer",children:"View History"})]}),e.jsx(We,{id:"reason",rows:3,disabled:oe,hasError:!!o.reason,...n("reason")}),e.jsx(_e,{message:o.reason?.message})]})]})};export{ma as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.