PageSourceSearch

https://www.elevolt.co.ke/_next/static/chunks/6081-451ff24208528a8a.js

js elevolt.co.ke collected 2026-10-04 21:46:01 UTC 15,863 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:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be043e17-1b83-4994-8107-f198f6c80037",e._sentryDebugIdIdentifier="sentry-dbid-be043e17-1b83-4994-8107-f198f6c80037")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6081],{18183:function(e,t,n){var a=n(52322),r=n(13980),l=n.n(r),s=n(2784),i=n(63798),o=n(29825);let d=e=>{let{departments:t=[],value:n=null,onChange:r,name:l="department_id",label:d,error:u}=e,c=(0,s.useMemo)(()=>{let e=(0,o.w8)(t);return(0,o.Z8)(e,{excludeArchived:!0}).map(e=>({value:e.did,label:"".concat("\xa0\xa0\xa0\xa0".repeat(e.depth)).concat(e.name)}))},[t]);return(0,a.jsx)(i.P,{defaultOption:"Select a department...",error:u,label:d,name:l,onChange:e=>r(e.target.value||null),options:c,selected:null!=n?n:""})};d.propTypes={departments:l().arrayOf(l().object),value:l().string,onChange:l().func.isRequired,name:l().string,label:l().string,error:l().string},t.Z=d},86848:function(e,t,n){n.d(t,{Z:function(){return E}});var a=n(52322),r=n(13980),l=n.n(r),s=n(2784),i=n(91516),o=n(47023),d=n(18427),u=n(95254),c=n(6309),m=n(62372),p=n(36845),f=n(79413),h=n(76467),g=n(18183),v=n(12840);let x=e=>{if(!(e instanceof Date)||Number.isNaN(e.getTime()))return"";let t=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(e.getFullYear(),"-").concat(t,"-").concat(n)},b=e=>{if(!e)return null;let t=new Date("".concat(e,"T00:00:00"));return Number.isNaN(t.getTime())?null:t},y=e=>{if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?"":x(t)},_=Object.freeze(["name","department_id","facilitator_user_id","scheduled_at","notes"]),j=Object.freeze({name:"text",department_id:"nullableText",facilitator_user_id:"lockedText",scheduled_at:"lockedText",notes:"clearableText"}),N=(e,t)=>{let n="string"==typeof t?t.trim():null!=t?t:"";return"nullableText"===e?""===n?null:n:"string"==typeof n?n:String(n)},w=e=>(null==e?void 0:e.status)?"scheduled"===e.status?_:_.filter(e=>"department_id"!==e):[],q=(e,t)=>{var n,a;return"department_id"===t?(null==e?void 0:null===(n=e.department)||void 0===n?void 0:n.did)||"":"facilitator_user_id"===t?(null==e?void 0:null===(a=e.facilitator)||void 0===a?void 0:a.uid)||"":"scheduled_at"===t?y(null==e?void 0:e.scheduled_at):(null==e?void 0:e[t])||""},Z=e=>_.reduce((t,n)=>({...t,[n]:q(e,n)}),{}),C=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={name:N("text",e.name),department_id:N("nullableText",e.department_id)};return["facilitator_user_id","scheduled_at","notes"].forEach(n=>{let a=N(j[n],e[n]);""!==a&&(t[n]=a)}),t},S=function(){let{session:e,values:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return w(e).reduce((n,a)=>{if(!Object.prototype.hasOwnProperty.call(t||{},a))return n;let r=j[a],l=N(r,t[a]),s=N(r,q(e,a));return"lockedText"===r&&""===l||l===s?n:{...n,[a]:l}},{})},D=e=>{var t,n,r,l,y,j,N;let{isOpen:q,session:D,departments:E=[],onClose:k,onSubmit:T,isSubmitting:F=!1,error:M}=e,O=!!D,[H,R]=(0,s.useState)(()=>Z(D)),[P,Q]=(0,s.useState)((null==D?void 0:null===(t=D.facilitator)||void 0===t?void 0:t.name)||"");(0,s.useEffect)(()=>{var e;q&&(R(Z(D)),Q((null==D?void 0:null===(e=D.facilitator)||void 0===e?void 0:e.name)||""))},[q,null==D?void 0:D.csid]);let{loadOptions:K,searchError:L}=(0,p.Z)({minChars:3}),z=(O?w(D):_).includes("department_id"),I=(e,t)=>R(n=>({...n,[e]:t})),A=(0,s.useMemo)(()=>O?S({session:D,values:H}):C(H),[O,D,H]),W=O?Object.keys(A).length>0:!!H.name.trim(),X=e=>{null==e||e.preventDefault(),W&&T(A)},Y=H.facilitator_user_id?{value:H.facilitator_user_id,label:P||H.facilitator_user_id}:null;return(0,a.jsx)(d.Z,{footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{design:"outlined",disabled:F,onClick:k,size:"sm",children:"Cancel"}),(0,a.jsx)(o.Z,{disabled:!W||F,isLoading:F,onClick:X,size:"sm",children:O?"Save changes":"Create session"})]}),onClose:k,show:q,title:O?"Edit calibration session":"New calibration session",children:(0,a.jsxs)("form",{className:"flex flex-col gap-4 ".concat(v.il),"data-hj-suppress":!0,"data-hs-do-not-collect":"true",onSubmit:X,children:[!!((null==M?void 0:M.message)&&!(null==M?void 0:null===(n=M.fieldErrors)||void 0===n?void 0:n.name))&&(0,a.jsx)(f.Z,{message:M.message,variant:"warning"}),(0,a.jsx)(u.o,{error:null==M?void 0:null===(r=M.fieldErrors)||void 0===r?void 0:r.name,label:"Session name",name:"name",onChange:e=>I("name",e.target.value),required:!0,value:H.name}),!!z&&(0,a.jsx)(g.Z,{departments:E,error:null==M?void 0:null===(l=M.fieldErrors)||void 0===l?void 0:l.department_id,label:"Department scope",name:"department_id",onChange:e=>I("department_id",e||""),value:H.department_id||null}),!z&&(0,a.jsx)(h.Z,{color:"text-gray-500",variant:"caption",children:"This session’s department scope can no longer be changed now that it has left Scheduled."}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 ".concat(v.il),"data-hj-suppress":!0,"data-hs-do-not-collect":"true",children:[(0,a.jsx)(h.Z,{as:"label",htmlFor:"calibration-se
1ssion-facilitator",variant:"label",children:"Facilitator"}),(0,a.jsx)(i.Z,{"aria-label":"Facilitator",className:"c-react-select",classNamePrefix:"crs",defaultOptions:!!Y&&[Y],inputId:"calibration-session-facilitator",isClearable:!0,loadOptions:K,loadingMessage:()=>"Searching employees...",noOptionsMessage:e=>{let{inputValue:t}=e;return!t||t.length<3?"Type at least ".concat(3," letters of a name"):L?"Employee search is not responding. Try again in a moment.":'No employees match "'.concat(t,'"')},onChange:e=>{I("facilitator_user_id",(null==e?void 0:e.value)||""),Q((null==e?void 0:e.label)||"")},placeholder:"Search employees by name",value:Y}),!!(null==M?void 0:null===(y=M.fieldErrors)||void 0===y?void 0:y.facilitator_user_id)&&(0,a.jsx)(h.Z,{color:"text-red-400",variant:"caption",children:M.fieldErrors.facilitator_user_id})]}),(0,a.jsx)(c.M,{error:null==M?void 0:null===(j=M.fieldErrors)||void 0===j?void 0:j.scheduled_at,label:"Scheduled for",onChange:e=>I("scheduled_at",x(e)),selected:b(H.scheduled_at)}),(0,a.jsx)(m.K,{error:null==M?void 0:null===(N=M.fieldErrors)||void 0===N?void 0:N.notes,label:"Notes",name:"notes",onChange:e=>I("notes",e.target.value),rows:4,value:H.notes})]})})};D.propTypes={isOpen:l().bool.isRequired,session:l().object,departments:l().arrayOf(l().object),onClose:l().func.isRequired,onSubmit:l().func.isRequired,isSubmitting:l().bool,error:l().shape({message:l().string,fieldErrors:l().object})};var E=D},12840:function(e,t,n){n.d(t,{X5:function(){return c},il:function(){return m}});var a=n(52322),r=n(13980),l=n.n(r),s=n(10988),i=n(47023),o=n(65232),d=n(47477),u=n(76467);let c=new Map([["scheduled","gray"],["in_progress","blue"],["completed","green"],["cancelled","red"]]),m="fs-exclude",p=e=>{var t,n;let{session:r,onEdit:l,onStart:p,onComplete:f,isStarting:h=!1,isCompleting:g=!1}=e,v="scheduled"===r.status,x="in_progress"===r.status,b=(null===(t=r.department)||void 0===t?void 0:t.name)||"Whole cycle",y=(null===(n=r.facilitator)||void 0===n?void 0:n.name)?"Facilitated by ".concat(r.facilitator.name):"No facilitator assigned";return(0,a.jsxs)(o.ZP,{children:[(0,a.jsx)(o.Ol,{children:(0,a.jsx)(u.Z,{as:"h2",variant:"sectionHeader",children:"Session details"})}),(0,a.jsx)(o.eW,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,a.jsx)(s.Z,{color:c.get(r.status)||"gray",label:r.status_label||r.status})}),(0,a.jsxs)(u.Z,{color:"text-gray-600",variant:"caption",children:[b," \xb7 ",(0,a.jsx)("span",{className:m,"data-hj-suppress":!0,"data-hs-do-not-collect":"true",children:y})]}),!!r.scheduled_at&&(0,a.jsx)(u.Z,{color:"text-gray-600",variant:"caption",children:"Scheduled for ".concat((0,d.p6)(r.scheduled_at,"MMM dd, yyyy"))}),!!r.notes&&(0,a.jsx)("div",{className:m,"data-hj-suppress":!0,"data-hs-do-not-collect":"true",children:(0,a.jsx)(u.Z,{color:"text-gray-600",variant:"bodySmall",children:r.notes})})]}),(0,a.jsxs)("div",{className:"flex flex-shrink-0 gap-2",children:[(0,a.jsx)(i.Z,{design:"outlined",onClick:l,size:"sm",children:"Edit"}),!!v&&(0,a.jsx)(i.Z,{isLoading:h,onClick:p,size:"sm",children:"Start session"}),!!x&&(0,a.jsx)(i.Z,{isLoading:g,onClick:f,size:"sm",children:"Complete session"})]})]})})]})};p.propTypes={session:l().shape({status:l().string,status_label:l().string,department:l().object,facilitator:l().object,scheduled_at:l().string,notes:l().string}).isRequired,onEdit:l().func.isRequired,onStart:l().func.isRequired,onComplete:l().func.isRequired,isStarting:l().bool,isCompleting:l().bool},t.ZP=p},6309:function(e,t,n){n.d(t,{M:function(){return u}});var a=n(52322),r=n(12524),l=n.n(r),s=n(13980),i=n.n(s);n(2784);var o=n(37726),d=n.n(o);n(34112);let u=e=>{let{label:t,error:n,selected:r,onChange:s,placeholderText:i,minDate:o,description:u,className:c,required:m=!1,showIcon:p=!0,dateFormat:f="MMM d, yyyy",...h}=e,g=l()("block","tracking-wide","text-sm","font-medium","mb-2",{"text-gray-700":!n},{"text-red-400":n}),v=l()("appearance-none","rounded","w-full","py-3","px-3","text-gray-700","bg-blue-50","border","border-gray-200","leading-tight","focus:outline-none","focus:border-gray-400",{border:n},{"border-red-400":n},c);return(0,a.jsxs)("div",{className:"w-full flex flex-col cx-date-picker",children:[t?(0,a.jsxs)("label",{className:g,children:[t,m?(0,a.jsx)("span",{className:"text-red-400 text-xs ml-1",children:"*"}):null]}):null,(0,a.jsx)(d(),{className:v,dateFormat:f,minDate:o,onChange:s,placeholderText:i,selected:r,showIcon:p,...h}),u?(0,a.jsx)("span",{className:"text-gray-500 text-sm mt-1 block",children:u}):null,n?(0,a.jsx)("span",{className:"text-red-400 text-xs",children:n}):null]})};
1u.propTypes={label:i().string,error:i().string,selected:i().instanceOf(Date),onChange:i().func.isRequired,placeholderText:i().string,minDate:i().instanceOf(Date),className:i().string,required:i().bool,dateFormat:i().string}},78690:function(e,t,n){var a=n(2784);t.Z=function(e,t){let[n,r]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}},37903:function(e,t,n){n.d(t,{E3:function(){return g},EQ:function(){return y},Hg:function(){return h},Lo:function(){return p},b2:function(){return f},e1:function(){return x},zh:function(){return v}});var a=n(59820),r=n(14010),l=n(87686),s=n(60418),i=n(47477),o=n(82036),d=n(84475),u=n(29825),c=n(53651);let m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(o.JW,"tenant/").concat((0,i.d_)(),"/").concat(e)},p=function(){let{enabled:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.a)({queryKey:u.Hq.departments,enabled:!!e&&(0,i.Xu)(),staleTime:6e4,queryFn:async()=>(await s.Z.get(m("departments"),{params:{include_archived:(0,u.Yg)(!0)},headers:(0,d.g0)({realm:"hr"})})).data})},f=function(){let{did:e,includeSubDepartments:t=!1,page:n=1,perPage:r=15,enabled:l=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o={include_sub_departments:(0,u.Yg)(t),page:n,per_page:r};return(0,a.a)({queryKey:u.Hq.departmentMembers(e,o),enabled:!!(l&&e)&&(0,i.Xu)(),placeholderData:(0,c.g)(e),queryFn:async()=>(await s.Z.get(m("departments/".concat(e,"/members")),{params:o,headers:(0,d.g0)({realm:"hr"})})).data})},h=function(){let{onSuccess:e,onError:t,onSettled:n,onMutate:a,silenceFieldErrors:i=!1,...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=(0,r.NL)();return(0,l.D)({mutationFn:async e=>(await s.Z.post(m("departments"),e,{headers:(0,d.g0)({realm:"hr"})})).data,onMutate:a,onSuccess:(t,n,a)=>{c.invalidateQueries({queryKey:u.Hq.departments}),null==e||e(t,n,a)},onError:(e,n,a)=>{(0,u.t_)(e,{fallback:"Failed to create department. Please try again.",context:"useCreateDepartment",silenceFieldErrors:i}),null==t||t(e,n,a)},onSettled:n,...o})},g=function(){let{onSuccess:e,onError:t,onSettled:n,onMutate:a,silenceFieldErrors:i=!1,...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=(0,r.NL)();return(0,l.D)({mutationFn:async e=>{let{did:t,...n}=e;return(await s.Z.put(m("departments/".concat(t)),n,{headers:(0,d.g0)({realm:"hr"})})).data},onMutate:a,onSuccess:(t,n,a)=>{c.invalidateQueries({queryKey:u.Hq.departments}),null==e||e(t,n,a)},onError:(e,n,a)=>{(0,u.t_)(e,{fallback:"Failed to update department. Please try again.",context:"useUpdateDepartment",silenceFieldErrors:i}),null==t||t(e,n,a)},onSettled:n,...o})},v=function(){let{onSuccess:e,onError:t,onSettled:n,onMutate:a,silenceFieldErrors:i=!1,...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=(0,r.NL)();return(0,l.D)({mutationFn:async e=>{let{did:t}=e;return(await s.Z.delete(m("departments/".concat(t)),{headers:(0,d.g0)({realm:"hr"})})).data},onMutate:a,onSuccess:(t,n,a)=>{c.invalidateQueries({queryKey:u.Hq.departments}),null==e||e(t,n,a)},onError:(e,n,a)=>{(0,u.t_)(e,{fallback:"Failed to delete department. Please try again.",context:"useDeleteDepartment",silenceFieldErrors:i}),null==t||t(e,n,a)},onSettled:n,...o})},x=function(){let{onSuccess:e,onError:t,onSettled:n,onMutate:a,...i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=(0,r.NL)();return(0,l.D)({mutationFn:async e=>{let{did:t,archived:n=!0}=e;return(await s.Z.post(m("departments/".concat(t,"/archive")),{archived:n},{headers:(0,d.g0)({realm:"hr"})})).data},onMutate:a,onSuccess:(t,n,a)=>{o.invalidateQueries({queryKey:u.Hq.departments}),o.invalidateQueries({queryKey:u.Hq.orgAssignmentsRoot}),null==e||e(t,n,a)},onError:(e,n,a)=>{(0,u.t_)(e,{fallback:"Failed to update department status. Please try again.",context:"useArchiveDepartment"}),null==t||t(e,n,a)},onSettled:n,...i})},b=(e,t)=>{let{order:n}=t;if(!(null==e?void 0:e.data))return e;let a=new Map(e.data.map(e=>[e.did,e])),r=[];e.data.forEach((e,t)=>{n.includes(e.did)&&r.push(t)});let l=[...e.data];
1return n.forEach((e,t)=>{let n=r[t],s=a.get(e);void 0!==n&&s&&(l[n]={...s,position:t})}),{...e,data:l}},y=function(){let{onSuccess:e,onError:t,onSettled:n,onMutate:a,...i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=(0,r.NL)();return(0,l.D)({mutationFn:async e=>{let{parentDid:t,order:n}=e;return(await s.Z.post(m("departments/reorder"),{parent_did:null!=t?t:null,order:n},{headers:(0,d.g0)({realm:"hr"})})).data},onMutate:async e=>{await o.cancelQueries({queryKey:u.Hq.departments});let t=o.getQueryData(u.Hq.departments);return t&&o.setQueryData(u.Hq.departments,b(t,e)),{previous:t,callerContext:await (null==a?void 0:a(e))}},onSuccess:(t,n,a)=>{null==e||e(t,n,null==a?void 0:a.callerContext)},onError:(e,n,a)=>{(null==a?void 0:a.previous)&&o.setQueryData(u.Hq.departments,a.previous),(0,u.t_)(e,{fallback:"Failed to reorder departments. Please try again.",context:"useReorderDepartments"}),null==t||t(e,n,null==a?void 0:a.callerContext)},onSettled:(e,t,a,r)=>{o.invalidateQueries({queryKey:u.Hq.departments}),null==n||n(e,t,a,null==r?void 0:r.callerContext)},...i})}},36845:function(e,t,n){var a=n(2784),r=n(78690),l=n(90269);t.Z=function(){let{debounceMs:e=300,minChars:t=2}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[n,s]=(0,a.useState)(""),i=(0,r.Z)(n,e),{data:o,isFetching:d,error:u}=(0,l.bD)({search:i,enabled:i.length>=t}),c=u||null,m=(0,a.useMemo)(()=>c||!o?[]:o.map(e=>({label:e.name,value:e.uid})),[o,c]),p=(0,a.useRef)(null),f=(0,a.useRef)("");return(0,a.useEffect)(()=>{p.current&&i===f.current&&!d&&(p.current(m),p.current=null,f.current="")},[i,d,m]),{loadOptions:(0,a.useCallback)(e=>new Promise(n=>{if(!e||e.length<t){n([]);return}p.current=n,f.current=e,s(e)}),[t]),userOptions:m,searchError:c}}}}]);

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.