PageSourceSearch

https://www.elevolt.co.ke/_next/static/chunks/pages/hr/[tenant]/or…/reconciliation-d3527f0ff5dfe809.js

js elevolt.co.ke collected 2026-10-04 21:47:52 UTC 18,126 bytes, 1 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b138af83-1290-48cf-8c9c-00dfa747c18f",e._sentryDebugIdIdentifier="sentry-dbid-b138af83-1290-48cf-8c9c-00dfa747c18f")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4246],{23659:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/hr/[tenant]/organisation/reconciliation",function(){return s(72042)}])},72042:function(e,n,s){"use strict";s.r(n),s.d(n,{default:function(){return ei}});var a=s(52322),l=s(77590),r=s(59820),t=s(78298),i=s(14010),o=s(87686),d=s(60418),c=s(47477),u=s(82036),g=s(84475),p=s(29825);let m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(u.JW,"tenant/").concat((0,c.d_)(),"/").concat(e)},h=function(){let{status:e="open",reason:n,page:s=1,perPage:a=15,enabled:l=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i={status:e,page:s,per_page:a,...n&&{reason:n}};return(0,r.a)({queryKey:p.Hq.orgReconciliation(i),enabled:!!l&&(0,c.Xu)(),placeholderData:t.Wk,queryFn:async()=>{let e=(await d.Z.get(m("org-assignments/reconciliation"),{params:i,headers:(0,g.g0)({realm:"hr"})})).data;return{...e,data:((null==e?void 0:e.data)||[]).map(e=>({...e,details:(0,p.f5)(e.details)}))}}})},b=function(){let{onSuccess:e,onError:n,onSettled:s,onMutate:a,...l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(0,i.NL)();return(0,o.D)({mutationFn:async e=>{let{rcid:n,note:s}=e;return(await d.Z.post(m("org-assignments/reconciliation/".concat(n,"/resolve")),s?{note:s}:{},{headers:(0,g.g0)({realm:"hr"})})).data},onMutate:a,onSuccess:(n,s,a)=>{r.invalidateQueries({queryKey:p.Hq.orgReconciliationRoot}),null==e||e(n,s,a)},onError:(e,s,a)=>{var l;(null==e?void 0:null===(l=e.response)||void 0===l?void 0:l.status)===409&&r.invalidateQueries({queryKey:p.Hq.orgReconciliationRoot}),(0,p.t_)(e,{fallback:"Failed to resolve this case. Please try again.",context:"useResolveReconciliationCase"}),null==n||n(e,s,a)},onSettled:s,...l})};var v=s(75588),x=s(13980),f=s.n(x),j=s(2784),y=s(79337),_=s(62202),w=s(47023),N=s(95254),k=s(6309),C=s(37903),Z=s(28512),R=s(97203),q=s(76467),S=s(45558),D=s(18183),P=s(94693),F=s(71896),E=s(10988),O=s(19317),A=s(69682);let T="Unresolvable case",L=e=>"cross_tenant_manager"!==e.reason&&"proposed_manager"in e?e.proposed_manager?{kind:"named",manager:e.proposed_manager}:{kind:"none",manager:null}:{kind:"redacted",manager:null},W=e=>e?e.name:T,I=e=>{let{person:n=null}=e;return n?(0,a.jsxs)("div",{...(0,A.p)("flex items-center gap-2"),children:[(0,a.jsx)(F.Z,{size:"sm",user:n}),(0,a.jsx)(q.Z,{variant:"labelValue",children:n.name})]}):(0,a.jsx)(q.Z,{color:"text-gray-500",variant:"bodySmall",children:T})};I.propTypes={person:f().shape({name:f().string,avatar:f().string})};let K=e=>{let{caseObj:n}=e,s=L(n);return"redacted"===s.kind?(0,a.jsx)(q.Z,{color:"text-gray-500",variant:"caption",children:"Manager details can't be shown for this case"}):"none"===s.kind?(0,a.jsx)(q.Z,{color:"text-gray-400",variant:"bodySmall",children:"—"}):(0,a.jsxs)("div",{...(0,A.p)("flex items-center gap-2"),children:[(0,a.jsx)(F.Z,{size:"sm",user:s.manager}),(0,a.jsx)(q.Z,{variant:"bodySmall",children:s.manager.name})]})};K.propTypes={caseObj:f().object.isRequired};let M=(e,n)=>{let{onAssign:s,onDismiss:a}=n;return[{text:"Assign",action:()=>s(e),isDisabled:()=>!e.user,title:()=>e.user?void 0:"This case has no resolvable employee to assign.",show:()=>e.is_open},{text:"Dismiss",action:()=>a(e),show:()=>e.is_open}]},B=e=>{let{caseObj:n,layout:s="row",onAssign:l,onDismiss:r}=e,t=(0,p.f5)(n.details),i=M(n,{onAssign:l,onDismiss:r}),o=!!n.is_open,d=n.is_open?(0,a.jsx)(E.Z,{color:"orange",label:"Open"}):(0,a.jsx)(E.Z,{color:"green",label:n.resolution_label||"Resolved"}),u=!n.is_open&&(0,a.jsxs)("span",{...(0,A.p)("block"),children:[(0,a.jsxs)(q.Z,{className:"block mt-1",color:"text-gray-500",variant:"caption",children:["by ",W(n.resolved_by)]}),!!t.dismiss_note&&(0,a.jsxs)(q.Z,{className:"block italic",color:"text-gray-500",variant:"caption",children:['"',t.dismiss_note,'"']})]}),g=o?(0,a.jsx)(O.Z,{menuItems:i,subject:n}):(0,a.jsx)(q.Z,{variant:"caption",children:"—"});return"card"===s?(0,a.jsxs)("div",{className:"p-4 flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)(I,{person:n.user}),g]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(E.Z,{color:"blue",label:n.reason_label}),d]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(q.Z,{className:"block",color:"text-gray-500",variant:"caption",children:"Proposed manager"}),(0,a.jsx)(K,{caseObj:n})]}),!!n.proposed_job_title&&(0,a.jsxs)("div",{children:[(0,a.jsx)(q.Z,{className:"block",color:"text-gray-500",variant:"caption",children:"Proposed job title"}),(0,a.jsx)(q.Z,{variant:"bodySmall",children:n.proposed_job_title})]}),(0,a.jsxs)(q.Z,{color:"text-gray-500",variant:"caption",children:["Last seen ",(0,c.p6)(n.last_seen_at)]}),u]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsx)(I,{person:n.user})}),(0,a.jsxs)("td",{className:"px-4 py-3",children:[(0,a.jsx)(E.Z,{color:"blue",label:n.reason_label}),!!n.proposed_job_title&&(0,a.jsxs)(q.Z,{className:"block mt-1",color:"text-gray-500",variant:"caption",children:["Proposed: ",n.proposed_job_title]})]}),(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsx)(K,{caseObj:n})}),(0,a.jsxs)("td",{className:"px-4 py-3",children:[d,u]}),(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsx)(q.Z,{variant:"bodySmall",children:(0,c.p6)(n.last_seen_at)})}),(0,a.jsx)("td",{className:"px-4 py-3 text-right",children:g})]})};
1B.propTypes={caseObj:f().shape({rcid:f().string.isRequired,reason:f().string,reason_label:f().string,user:f().shape({uid:f().string,name:f().string,avatar:f().string,status:f().string}),proposed_job_title:f().string,proposed_manager:f().object,details:f().oneOfType([f().object,f().array]),last_seen_at:f().string,is_open:f().bool,resolution_label:f().string,resolved_by:f().shape({uid:f().string,name:f().string,avatar:f().string,status:f().string})}).isRequired,layout:f().oneOf(["row","card"]),onAssign:f().func.isRequired,onDismiss:f().func.isRequired};let J=["manager_user_id","department_id","job_title","effective_from"],U=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(u.JW,"tenant/").concat((0,c.d_)(),"/").concat(e)},H=function(){let{uid:e,enabled:n=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[s,a]=(0,j.useState)({data:null,isFetching:!1,error:null});return(0,j.useEffect)(()=>{if(!n||!e||!(0,c.Xu)()){a({data:null,isFetching:!1,error:null});return}let s=!1;return a({data:null,isFetching:!0,error:null}),d.Z.get(U("users/".concat(e,"/org-assignment")),{headers:(0,g.g0)({realm:"hr"})}).then(e=>{var n,l;s||a({data:null!==(l=null===(n=e.data)||void 0===n?void 0:n.data)&&void 0!==l?l:null,isFetching:!1,error:null})}).catch(e=>{s||a({data:null,isFetching:!1,error:e})}),()=>{s=!0}},[e,n]),s},V=e=>{let n=L(e);return"named"===n.kind?{uid:n.manager.uid,name:n.manager.name}:null},X=e=>{var n;let{show:s,onClose:l,reconciliationCase:r=null,onSuccess:t}=e,[i,o]=(0,j.useState)(null),[d,c]=(0,j.useState)(null),[u,g]=(0,j.useState)(""),[m,h]=(0,j.useState)(new Date),[b,v]=(0,j.useState)(!1),[x,f]=(0,j.useState)({}),[y,F]=(0,j.useState)(""),{data:E}=(0,C.Lo)({enabled:s}),O=(null==E?void 0:E.data)||[],T=H({uid:null==r?void 0:null===(n=r.user)||void 0===n?void 0:n.uid,enabled:s}),L=T.data;(0,j.useEffect)(()=>{s&&r&&(o(V(r)),c(null),g(r.proposed_job_title||""),h(new Date),v(!1),f({}),F(""))},[s,r]);let W=(0,Z.dR)({silenceFieldErrors:!0,onSuccess:()=>{_.default.success("Assignment saved."),null==t||t(),l()},onError:e=>{var n,s,a,l,r,t;let i=(0,S._I)(e);if(Object.keys(i).length>0){let e={},n="";Object.entries(i).forEach(s=>{let[a,l]=s;J.includes(a)?e[a]=l:n=l}),f(e),F(n);return}let o=null==e?void 0:null===(s=e.response)||void 0===s?void 0:null===(n=s.data)||void 0===n?void 0:n.reason,d=o&&(0,p.vl)(o);f(d&&J.includes(d)?{[d]:null==e?void 0:null===(l=e.response)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.message}:{}),F(d&&!J.includes(d)?null==e?void 0:null===(t=e.response)||void 0===t?void 0:null===(r=t.data)||void 0===r?void 0:r.message:"")}});return(0,a.jsx)(R.B,{centerY:!0,fullWidth:!0,maxWidth:"500px",onClose:l,show:s,title:"Assign reporting line",children:(0,a.jsxs)("form",{className:"flex flex-col gap-4",onSubmit:e=>{var n,s,a;if(e.preventDefault(),!(null==r?void 0:r.user)||T.error)return;f({}),F("");let l=u.trim(),t=b?(0,p.DB)(m):null,o={user_id:r.user.uid,manager_user_id:null!==(s=null==i?void 0:i.uid)&&void 0!==s?s:null,department_id:null!==(a=null!=d?d:null==L?void 0:null===(n=L.department)||void 0===n?void 0:n.did)&&void 0!==a?a:null,job_title:l||(null==L?void 0:L.job_title)||null};t&&(o.effective_from=t),W.mutate(o)},children:[!!T.error&&(0,a.jsx)("div",{className:"rounded border border-red/30 bg-red/5 p-3",children:(0,a.jsx)(q.Z,{color:"text-red",variant:"caption",children:"We couldn't load this employee's current department and job title, so saving is disabled to avoid overwriting them. Close and reopen this dialog to try again."})}),!!y&&(0,a.jsx)("div",{className:"rounded border border-red/30 bg-red/5 p-3",children:(0,a.jsx)(q.Z,{color:"text-red",variant:"caption",children:y})}),!!(null==r?void 0:r.user)&&(0,a.jsxs)(q.Z,{...(0,A.p)(),variant:"body",children:["Set ",r.user.name,"'s manager, department and job title."]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(q.Z,{className:"mb-2 block",variant:"label",children:"Manager"}),(0,a.jsx)(P.Z,{error:x.manager_user_id,onChange:o,value:i})]}),(0,a.jsx)(D.Z,{departments:O,error:x.department_id,label:"Department",onChange:c,value:d}),(0,a.jsx)(N.o,{error:x.job_title,label:"Job title",name:"job_title",onCh
1ange:e=>g(e.target.value),value:u}),(0,a.jsx)(k.M,{error:x.effective_from,label:"Effective from",maxDate:new Date,onChange:e=>{v(!0),h(e)},selected:m}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,a.jsx)(w.Z,{design:"secondary",disabled:W.isPending,onClick:l,type:"button",children:"Cancel"}),(0,a.jsx)(w.Z,{disabled:W.isPending||T.isFetching||!!T.error||!(null==r?void 0:r.user),type:"submit",children:W.isPending?"Assigning...":"Assign"})]})]})})};X.propTypes={show:f().bool.isRequired,onClose:f().func.isRequired,reconciliationCase:f().shape({user:f().shape({uid:f().string,name:f().string}),reason:f().string,proposed_job_title:f().string,proposed_manager:f().shape({uid:f().string,name:f().string})}),onSuccess:f().func};var z=s(62372);let Q=e=>{let{show:n,onClose:s,reconciliationCase:l=null,onSuccess:r}=e,[t,i]=(0,j.useState)("");(0,j.useEffect)(()=>{n&&i("")},[n]);let o=b({onSuccess:()=>{_.default.success("Case dismissed."),null==r||r(),s()}});return(0,a.jsx)(R.B,{centerY:!0,fullWidth:!0,maxWidth:"450px",onClose:s,show:n,title:"Dismiss case",children:(0,a.jsxs)("form",{className:"flex flex-col gap-4",onSubmit:e=>{e.preventDefault(),(null==l?void 0:l.rcid)&&o.mutate({rcid:l.rcid,note:t.trim()||void 0})},children:[(0,a.jsx)(q.Z,{variant:"body",children:"Dismissing removes this case from the queue without changing any reporting line. Add a note if it helps explain the decision later."}),!!(null==l?void 0:l.reason_label)&&(0,a.jsxs)("div",{className:"p-3 bg-gray-50 rounded-lg",children:[(0,a.jsx)(q.Z,{className:"block",variant:"label",children:"Reason"}),(0,a.jsx)(q.Z,{variant:"labelValue",children:l.reason_label})]}),(0,a.jsx)(z.K,{description:"".concat(t.length,"/").concat(1e3),label:"Note (optional)",name:"dismiss_note",onChange:e=>i(e.target.value.slice(0,1e3)),placeholder:"Why is this case being dismissed?",rows:4,value:t}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,a.jsx)(w.Z,{design:"secondary",disabled:o.isPending,onClick:s,type:"button",children:"Cancel"}),(0,a.jsx)(w.Z,{disabled:o.isPending,type:"submit",children:o.isPending?"Dismissing...":"Dismiss case"})]})]})})};Q.propTypes={show:f().bool.isRequired,onClose:f().func.isRequired,reconciliationCase:f().shape({rcid:f(
1).string,reason_label:f().string}),onSuccess:f().func};var Y=s(65232),G=s(16936),$=s(63798),ee=s(79663),en=s(65405);let es=[{key:"open",label:"Open"},{key:"resolved",label:"Resolved"},{key:"all",label:"All"}],ea=[{value:"no_profile",label:"No Job Profile Found"},{value:"multiple_profiles",label:"Multiple Job Profiles Found"},{value:"null_reports_to",label:"No Manager Listed"},{value:"cross_tenant_manager",label:"Manager At Another Company"},{value:"inactive_manager",label:"Manager No Longer Active"},{value:"self_referential_manager",label:"Reports To Themselves"},{value:"write_rejected",label:"Could Not Be Saved"},{value:"closed_assignment_history",label:"Reporting Line Closed, Not Reassigned"}],el=[{key:"employee",header:"Employee"},{key:"reason",header:"Reason"},{key:"proposed_manager",header:"Proposed manager"},{key:"status",header:"Status"},{key:"last_seen",header:"Last seen"},{align:"right",key:"actions",header:"Actions"}],er=e=>{let{cases:n=[],meta:s={},isLoading:l,isFetching:r,isError:t,status:i,onStatusChange:o,reason:d="",onReasonChange:c,onPageChange:u,onAssign:g,onDismiss:p}=e,m=es.findIndex(e=>e.key===i);return(0,a.jsxs)(Y.ZP,{children:[(0,a.jsx)(Y.Ol,{padding:{y:0},children:(0,a.jsxs)("div",{className:"w-full flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)(ee.ZP,{activeIndex:-1===m?0:m,onChange:e=>{var n,s;return o(null!==(s=null===(n=es[e])||void 0===n?void 0:n.key)&&void 0!==s?s:"open")},syncWithUrl:!1,children:es.map(e=>(0,a.jsx)(en.Z,{label:e.label},e.key))}),(0,a.jsx)("div",{className:"py-2 sm:py-0 sm:w-64",children:(0,a.jsx)($.P,{defaultOption:"All reasons",name:"reason",onChange:e=>c(e.target.value),options:ea,selected:d})})]})}),(0,a.jsx)(Y.eW,{padding:0,children:(0,a.jsx)(G.Z,{columns:el,emptyClassName:"p-4",emptyDescription:"Only Elevolt's one-off reconciliation pass raises cases, so an empty queue is the normal state.",emptyMessage:"No cases to review",errorDescription:"Please try refreshing the page.",errorMessage:"Failed to load the reconciliation queue",isError:!!t,isFetching:!!r,isLoading:!!l,mobileListClassName:"md:hidden flex flex-col divide-y divide-gray-200",onPageChange:u,pagination:s,renderMobileCard:e=>(0,a.jsx)(B,{caseObj:e,layout:"card",onAssign:g,onDismiss:p}),renderRow:e=>(0,a.jsx)(B,{caseObj:e,onAssign:g,onDismiss:p}),rowKey:e=>e.rcid,rows:n})})]})};er.propTypes={cases:f().array,meta:f().object,isLoading:f().bool.isRequired,isFetching:f().bool.isRequired,isError:f().bool.isRequired,status:f().oneOf(["open","resolved","all"]).isRequired,onStatusChange:f().func.isRequired,reason:f().string,onReasonChange:f().func.isRequired,onPageChange:f().func.isRequired,onAssign:f().func.isRequired,onDismiss:f().func.isRequired};let et=e=>{let{tenantName:n}=e,[s,r]=(0,j.useState)("open"),[t,i]=(0,j.useState)(""),[o,d]=(0,j.useState)(1),[c,u]=(0,j.use
1State)(null),[g,p]=(0,j.useState)(null),{data:m,isPending:b,isFetching:x,error:f}=h({status:s,reason:t||void 0,page:o,perPage:15}),_=(0,j.useCallback)(e=>{r(e),d(1)},[]),w=(0,j.useCallback)(e=>{i(e),d(1)},[]),N=(0,j.useCallback)(()=>u(null),[]),k=(0,j.useCallback)(()=>p(null),[]),C=[{href:"/hr/".concat(n,"/organisation/departments"),name:"Organisation",nodeType:"Link"},{href:"#",name:"Reconciliation queue",nodeType:"a"}];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.Z,{title:"".concat((0,l.kC)((0,l.parseUnderScore)(n))," - Reconciliation queue")}),(0,a.jsxs)("main",{className:"container flex flex-col gap-4 mx-auto px-4 md:px-8 lg:px-12 pb-6",children:[(0,a.jsx)(v.Z,{breadcrumbs:C,description:"Settle the reporting lines Elevolt could not work out on its own",tenantName:n,title:"Reconciliation queue"}),(0,a.jsx)(er,{cases:null==m?void 0:m.data,isError:!!f,isFetching:x,isLoading:b,meta:null==m?void 0:m.meta,onAssign:u,onDismiss:p,onPageChange:d,onReasonChange:w,onStatusChange:_,reason:t,status:s})]}),(0,a.jsx)(X,{onClose:N,reconciliationCase:c,show:!!c}),(0,a.jsx)(Q,{onClose:k,reconciliationCase:g,show:!!g})]})};et.getInitialProps=async e=>{let n=e.query.tenant;return!n&&e.res?{notFound:!0}:{tenantName:n}},et.propTypes={tenantName:f().string};var ei=(0,g.withAuthSync)(et)},62372:function(e,n,s){"use strict";s.d(n,{K:function(){return o}});var a=s(52322);s(2784);var l=s(13980),r=s.n(l),t=s(12524),i=s.n(t);let o=e=>{let{label:n,placeholder:s,name:l,error:r,rows:t,onChange:o,value:d,defaultValue:c,className:u,onKeyUp:g,onKeyDown
1Handler:p,onBlur:m,disabled:h,required:b=!1}=e,v=i()("block","text-sm","font-medium","tracking-wide","mb-1",{"text-gray-700":!r,"text-red-400":r}),x=i()("appearance-none","w-full","px-3","py-2","text-gray-700","bg-white","border","rounded-lg","leading-tight","transition-colors","duration-200","focus:outline-none","focus:ring-2","focus:ring-blue-500","focus:border-transparent","disabled:bg-gray-100","disabled:text-gray-500","disabled:cursor-not-allowed",{"border-gray-300":!r,"border-red-400":r,"focus:ring-red-500":r},u);return(0,a.jsxs)(a.Fragment,{children:[!!n&&(0,a.jsxs)("label",{className:v,htmlFor:l,children:[n,!!b&&(0,a.jsx)("span",{className:"text-red-400 text-xs ml-1",children:"*"})]}),(0,a.jsx)("textarea",{className:x,defaultValue:c,disabled:h,id:l,name:l,onBlur:m,onChange:o,onKeyDown:p,onKeyUp:g,placeholder:s,required:b,rows:t,value:d}),!!r&&(0,a.jsx)("span",{className:"text-red-400 text-xs mt-1 block",children:r})]})};o.propTypes={label:r().string,value:r().string,placeholder:r().string,name:r().string.isRequired,rows:r().number,error:r().string,onChange:r().func.isRequired,defaultValue:r().string,className:r().string,onKeyUp:r().func,onKeyDownHandler:r().func,onBlur:r().func,disabled:r().bool,required:r().bool}}},function(e){e.O(0,[5351,6383,1985,9436,9400,8819,5742,493,3733,2718,974,1282,9277,248,916,4422,2888,9774,179],function(){return e(e.s=23659)}),_N_E=e.O()}]);

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.