PageSourceSearch

https://cloud.hellopebl.com/assets/InitiateEngagementOffboardingModal-Dzoa98Dm.js

js hellopebl.com collected 2026-09-29 06:12:28 UTC 8,931 bytes, 69 lines download raw bytes

1import{i as e}from"./_virtual___federation_fn_import-B42vpj-0.js";import{j as t}from"./jsx-runtime-CL4fN_ac.js";import{G as a}from"./GlobalModalProvider-DeoO_r9a.js";import{V as n}from"./VgInput-DzWJAxjN.js";import{D as i,S as o,a as l,b as s,I as r}from"./VgInput.styles-y2t2y3-I.js";import{I as d,U as m,C as u}from"./ComboBox-BzvGA-ni.js";import{b as p}from"./utils-BLCd2nbx.js";import{r as g}from"./CurrentUserProvider.web-DgTLWXaF.js";import{d as c}from"./dateHelper-DAO7lBZ0.js";import{r as f}from"./routeConstants-Dtn71CaO.js";import{o as h,p as b,q as y,r as x,s as j}from"./graphql-5FcXE4qu.js";import{C as S}from"./nomad-ui-xnM5QRDh.js";import{u as v,e as C}from"./useEventLogger-DagIR_Kc.js";import{a as I}from"./employmentConstants-BZ1FQMaO.js";import{b as O}from"./userHelper-CjO_GA5j.js";import{u as E,m as w,l as R,V as N}from"./luna-ui-D_FPDmj2.js";import{u as T}from"./useFeatureFlags-S1SOsunU.js";import{f as F}from"./FeatureFlagsProvider-BzYqmjb7.js";const{styled:$}=await e("styled-components"),A=$.div`
2  background-color: ${({theme:e})=>e.nomadTheme.palette.functional.white};
3  max-height: 600px;
4`,D=$.div`
5  display: flex;
6  justify-content: space-between;
7  gap: 16px;
8`,k=$.div`
9  textarea {
10    height: 80px;
11    padding: 8px 12px;
12    border: 1px solid ${({theme:e})=>e.colors.gray30};
13    border-radius: 6px;
14    line-height: ${({theme:e})=>e.lineHeights.sm};
15    font-size: ${({theme:e})=>e.fontSize.sm};
16  }
17`,z=$.div`
18  display: flex;
19  flex-direction: column;
20  flex: 1;
21
22  margin-bottom: 24px;
23  label {
24    font-family: ${({theme:e})=>e.fonts.sansSerifPrimary};
25    font-weight: 300;
26    span {
27      font-weight: 300;
28      font-family: ${({theme:e})=>e.fonts.sansSerifPrimary};
29      font-size: ${({theme:e})=>e.fontSize.md};
30    }
31  }
32  ${i} {
33    width: 100%;
34
35    ${o} {
36      font-size: ${({theme:e})=>e.fontSize.sm};
37      line-height: ${({theme:e})=>e.lineHeights.md};
38    }
39    ${l} {
40      display: none;
41    }
42    input {
43      border: 1px solid ${({theme:e})=>e.colors.gray30};
44      border-radius: 3px;
45    }
46  }
47  ${d} {
48    width: 100%;
49    margin-left: 0;
50    margin-bottom: 0;
51  }
52
53  ${m} {
54    max-height: 250px;
55  }
56
57  ${s} {
58    margin-top: 5px;
59    input:not([type='checkbox']) {
60      height: 44px;
61    }
62  }
63`,M=$(S)`
64  margin-bottom: 24px;
65  strong {
66    font-weight: 700;
67  }
68`,{useCallback:P,useContext:_,useState:B}=await e("react"),{useNavigate:q}=await e("react-router");function G({onCancel:e=()=>{},defaultEmployeeId:i=null,defaultEmploymentId:o=null}){const{hideModal:l}=_(a),{flags:s}=T(),d=!!s?.[F.OFFBOARDING_REFRESH],m=q(),[S,$]=B(null),[G,H]=B([]),[U,V]=B([]),[L,J]=B(null),[W,X]=B(null),[K,Q]=B([]),[Y,Z]=B(null),[ee,te]=B(null),[ae,ne]=B(null),[ie,oe]=B(""),[le,se]=B(null),[re,de]=B(!1),[me,ue]=B(""),[pe,ge]=B(!0),ce=e=>{ge(e)},fe=v(),{data:he,loading:be,fetchMore:ye}=h({skip:d,fetchPolicy:"cache-and-network",variables:{roleSlug:g.HR_MANAGER,excludeOnboardingEmployees:!0,pageSize:25,searchBy:me},onCompleted:({paginatedManagedExternalEmployeesForRole:e})=>{if(!i||S)return;const t=e?.externalEmployeeItems??[],a=t.find((({employee:e})=>e?.id===i))?.employee;a?.id&&a?.user&&$({...a,id:a.id,user:a.user,slug:a.user?.fullName??""})}}),{data:xe,loading:je,fetchMore:Se}=b({skip:!d,fetchPolicy:"cache-and-network",variables:{pageSize:25,sortColumn:"fullName",sortDirection:"asc",searchBy:me,filterBy:[{name:"countries",value:"213"}]}}),ve=d?je:be,Ce=he?.paginatedManagedExternalEmployeesForRole?.externalEmployeeItems??[],Ie=xe?.paginatedJobsReport?.jobReportItems??[],Oe=new Set,Ee=Ie.filter((e=>!(!e.employeeId||Oe.has(e.employeeId))&&(Oe.add(e.employeeId),!0)));const{loading:we}=y({variables:{employeeId:S?.id??""},skip:!S?.id,onCompleted:e=>{const t=p(e?.employmentsByEmployee);if(H(t),o){const e=t.find((e=>e.id===o));e?.id&&se({id:e.id,slug:e.contract?.uuid??""})}}}),{loading:Re}=x({fetchPolicy:"cache-and-network",onCompleted:e=>{const t=p(e?.employeeOffboardingCategories);Q(t)}}),[Ne]=j();function Te(e){$(e),se(null)}const Fe=d?Ee.map((e=>({value:e.employeeId,label:O({fullName:e.fullName,firstName:e.firstName,lastName:e.lastName,preferredFirstName:e.preferredFirstName}
68,!0)||e.fullName||""}))):Ce.filter((({employee:e})=>!!e?.id&&!!e?.user)).map((({employee:e})=>({value:e.id,label:O(e?.user,!0)||e?.user?.fullName||""}))),$e=S?{value:S.id,label:S.slug??""}:void 0,Ae=U?.map((({reason:e})=>({id:e?.slug??"",slug:e?.label??""})))||[],De=P((()=>L&&L?.subreason?.map((e=>({id:e?.slug??"",slug:e?.label??"",hasComments:!!e?.commentRequirement})))||[]),[L]),ke=G.filter((e=>e.engagementStatus?.slug!==I.HIRING_PROCESS)).map((e=>({id:e.id,slug:e.contract?.uuid??""})))||[],ze=K?.map((({category:e})=>({id:e?.slug??"",slug:e?.label??""})))||[];const Me=t.jsxs(A,{children:[t.jsxs(M,{variant:"body",size:"md",element:"p",children:["Are you sure you want to initiate an Offboarding for this Engagement? This change will not be visible to the Supported Worker",t.jsx("strong",{children:" but it will be visible to their Client and Partner Managers."})]}),d&&t.jsx(E,{variant:"info",title:"US EOR Only",description:"This legacy offboarding flow is only available for US EOR engagements. All other countries are managed through the new offboarding process.",dataTestId:"us-eor-only-callout"}),t.jsxs(D,{children:[t.jsx(z,{children:t.jsx(w,{label:"Individual Name",options:Fe,selectedOption:$e,onChange:e=>{const t=e;Te(t?{id:t.value,user:{id:"",fullName:t.label},slug:t.label}:null),ue("")},onInputChange:(e,t)=>
68{"input-change"===t.action&&ue(e)},onMenuScrollToBottom:function(){if(d){if(je||0===Ie.length)return;const e=Ie[Ie.length-1];if(!e?.id)return;Se({variables:{lastId:e.id,lastValue:e.fullName??""}})}else{if(be||0===Ce.length)return;const e=Ce[Ce.length-1];if(!e?.employee?.id)return;ye({variables:{lastId:e.employee.id,lastValue:e.employee.user?.fullName??""}})}},filterOption:null,isLoading:ve,placeholder:"Search for an employee...",required:!0,dataTestId:"individual-name-dropdown"})}),t.jsx(z,{children:t.jsx(u,{label:"Engagement",isSingleSelect:!0,selectedOptions:le?[{id:le.id,slug:le.slug??""}]:[],handleOptionSelect:se,listItems:ke,allowSearching:!0,loading:we,isOptional:!1,shouldShowRequired:!1},"Engagement")})]}),t.jsxs(D,{children:[t.jsx(z,{children:t.jsx(u,{label:"Offboarding Category",isSingleSelect:!0,selectedOptions:W?[{id:W.id,slug:W.slug??""}]:[],handleOptionSelect:function(e){X(e);const t=(K.filter((({category:t})=>t?.slug===e.id))||[])[0].reasons;V(t),te(null),ne(null)},listItems:ze,loading:Re,isOptional:!1,shouldShowRequired:!1},"Offboarding Category")}),t.jsx(z,{children:t.jsx(n,{type:r.DATE,label:"Anticipated Termination Date",value:Y??"",onChange:Z,isOptional:!1})})]}),t.jsxs(D,{children:[t.jsx(z,{children:t.jsx(u,{label:"reason",isSingleSelect:!0,selectedOptions:ee?[ee]:[],handleOptionSelect:function(e){te(e);const t=U?.filter((({reason:t})=>t?.slug===e?.id))[0]||null;J(t),ne(null),oe("")},listItems:Ae,allowSearching:!0,isOptional:!1,shouldShowRequired:!1})}),t.jsx(z,{children:t.jsx(u,{label:"subreason",isSingleSelect:!0,selectedOptions:ae?[ae]:[],handleOptionSelect:ne,listItems:De(),allowSearching:!0,isOptional:!1,shouldShowRequired:!1})})]}),ae&&ae.hasComments&&t.jsx(k,{children:t.jsx(n,{type:r.TEXTAREA,label:"Comments",onChange:oe,value:ie,isOptional:!1})})]});return t.jsxs(R,{open:pe,onOpenChange:ce,size:"wide",dataTestId:"initiate-engagement-offboarding-modal",dismissible:!1,children:[t.jsx(R.Header,{title:"User Management",description:"Initiate Engagement Offboarding",onClose:()=>{e(),l()}}),t.jsx(R.Body,{children:Me}),t.jsxs(R.Footer,{children:[t.jsx(N,{variant:"ghost",size:"md",onClick:()=>{e(),l()},dataTestId:"cancel-button",children:"Cancel"}),t.jsx(N,{variant:"primary",size:"md",onClick:async function(){de(!0);const{data:e}=await Ne({variables:{employmentId:le?.id??"",endReason:ee?.id.toLowerCase(),endSubReason:ae?.id.toLowerCase()??"",endReasonComments:ae?.hasComments?ie:"",endDate:"object"==typeof Y&&Y instanceof Date?c.convertDateToAPIDate(Y):Y??"",engagementStatusSlug:W?.id?.toUpperCase()}}),t=e?.startEngagementOffboarding?.employment,a=t?.contract?.client,n={id:e?.startEngagementOffboarding?.id??"",employment:{id:"",employee:{id:"",user:t?.employee?.user||{id:""}},contract:{client:{id:a?.id??"",name:a?.name??""}}}};fe(C.logInitiatedOffboardingEvent(n,S?.user||{id:""},{id:a?.id??"",name:a?.name??""})),fe(C.logTerminationFieldAddedEvent(n,"endReason",ee?.slug??"")),fe(C.logTerminationFieldAddedEvent(n,"anticipatedEndDate","object"==typeof Y&&Y instanceof Date?c.convertDateToAPIDate(Y):Y??"")),m(f.OFFBOARDING_ENGAGEMENT+`/${e?.startEngagementOffboarding?.processId??""}`),ce(!1),de(!1),l()},dataTestId:"submit-button",disabled:!(S&&le&&Y&&!re&&W?.id&&L&&ae&&(!ae.hasComments||ae.hasComments&&ie)),children:"Initiate Offboarding"})]})]})}export{G as InitiateEngagementOffboardingModal};
69//# sourceMappingURL=InitiateEngagementOffboardingModal-Dzoa98Dm.js.map

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.