1import{t as ie,r as u,k as e,I as B,n as ps}from"./vendor-frozen-BjHTscMc.js";import{l as ue,w as T,Bn as ye,sZ as gs,dE as fs,pq as bs,bE as ze,Bo as ys,sP as xs,cU as ht,Bp as js,cg as Ke,Bq as q,I as Is,J as o,b3 as wt,O as Ce,b4 as Ut,aF as j,b6 as ce,n as Ye,m as F,a9 as f,aa as h,aj as p,gK as se,b7 as _,bm as L,o as Z,ab as X,zJ as vs,cf as Cs,W as St,dP as W,y as ke,aE as Tt,bb as Qe,T as As,kN as ws,U as Us,V as Ss,p as A,co as Ts,b5 as Q,cl as Ie,nM as Ds,gL as ks,Br as Ns,aQ as Fs,Bs as Dt,a3 as E,Bt as Es,ts as Bs,tL as kt,dn as Ps,br as ve,Bu as Os,Bv as Rs,Bw as Js,ei as Ls,eg as Vs,fx as Me,ea as Ms,ej as Ws,ek as $s,eT as Hs,eU as mt,vD as ne,aq as pt,Bx as m,By as gt,s as qs,r as ae,cR as Gs,qh as Se,lx as zs,hh as Ks,gT as Ys,d4 as Qs,Bz as v,B as _s,L as Xs,bo as ft,vE as Zs,ae as en,c3 as De,aT as tn,gO as Te,BA as sn,vu as nn,t5 as an,qe as rn,gP as on,gQ as ln,vr as dn,dk as cn,dl as un,fi as We,a as hn,cS as mn,t6 as pn,jx as gn,aR as J,sC as fn,bk as bn,dM as yn,BB as xn,dR as bt,e0 as jn,pa as In,cP as vn,sQ as Cn,p9 as An,pv as yt,BC as xt,kT as jt,kD as wn,eI as It,aO as Un,gV as Sn,uy as Tn,gY as Dn,gZ as kn}from"./index-BXLY1or4.js";import{d as Nn,e as Fn}from"./schedules-QeIeemIy.js";import{L as En}from"./LinkEntityToAccounting.api.handler-BvTxuD-Y.js";import{S as Ge,V as Bn}from"./CellPhoneInput.types-UowuRKUA.js";import{w as Pn}from"./UpgradeRequiredBoundary-BE9mj9DJ.js";import{g as On}from"./takeoff.utility-B2Qr-8GQ.js";import{a as Rn,T as Jn}from"./TakeoffIntegrationMarketing-D8dEgLev.js";import{V as Ln}from"./vendor.types-DjBN62Q5.js";import{f as Vn}from"./vendor.utility-BlL2oG1u.js";import{H as Mn,a as Wn,b as $n,c as Hn}from"./HomeDepotUnconnectedDisplay-H-M0Y2tI.js";import{I as Nt}from"./LinkJobToAccounting.api.types-DDyOjSlj.js";import{P as $e}from"./PayrollSettings.api.types-58flW8Dq.js";import{B as qn}from"./BTSplitButton-DH5q50Qh.js";import{u as Gn}from"./useEditMode-C7nQfJVU.js";import{L as zn}from"./AccountingLinkingOptions.api.types-B3pxz0Wp.js";import{C as Kn,b as Yn,c as Qn}from"./CellPhoneInput-B7kdgyB0.js";import{g as _n,c as Xn}from"./CellPhoneInput.utils-BgslTRgl.js";import{a as Zn,P as ea,C as ta}from"./CustomFieldContainer-DIp3YqKD.js";import{I as ge}from"./InputEmail.utils-BiqmZ53F.js";import{E as sa,I as na}from"./EmailFormEntry-CDCsp5Ie.js";import{b as aa,c as ia,R as ra,N as oa}from"./JobAccessTab-BCWPDsrm.js";import{N as la,m as da,s as ca}from"./NotificationPreferencesTableExpandable-QVGhoJ4i.js";import{T as ua}from"./TextVerificationBanner-hCTLVCOb.js";import{F as Ft}from"./FormikValidationSummary-DpmLAkyp.js";import{R as ha}from"./RfiStatusTag-Wm6T4Xm8.js";import{W as ma}from"./WarrantyServiceStatus-zFXKC_8G.js";import{A as pa}from"./AccountingLinkingCard-z60nBJAx.js";import{B as xe}from"./BTIconLegacyTrash-lM821eN-.js";import{B as ga}from"./BTUpload-BgkFN82v.js";import{S as fa}from"./SignatureImage-BjLfAso9.js";import{P as ba}from"./PayrollEmployeeSyncStatusDisplay-CMrc2rn8.js";import{u as ya,A as xa,a as ja,R as Ia,E as va,N as Ca}from"./NotificationPreferencesHeader-DzeCtZsm.js";import{I as vt,R as Aa,M as wa}from"./RolePermissions-Bm6uJh7H.js";import{N as Et}from"./NoteText-DQflFE31.js";import{F as Ua}from"./FilterDrawer-DPsNN1k7.js";import{B as Sa,d as Ta}from"./BTInputNumber-CsCuvC3c.js";import{C as Ct}from"./Currency-vBwVcJNE.js";import{B as fe}from"./BTSection-EL_JDh1X.js";import{B as Da}from"./BTIconArrowRightOutlined-BrInDqeq.js";import{B as He}from"./BTInput-BCkEBvP_.js";import{R as Bt}from"./RoleSelect-DAIK0gcZ.js";import{P as At}from"./PhoneActionSheet-BaJr_Mow.js";import{M as Pt}from"./IconGearSix-Czh3E5Ns.js";import"./accountingConstants-BcE_fJb9.js";import"./index-DyIamSZx.js";import"./CellPhoneField-D1pbXhwV.js";import"./BTNumberInput-drz-jbjz.js";import"./BTDatePicker-c-89lJ3I.js";import"./BTSelectEditable-CrE-eCNf.js";import"./CollectionEditable-BqrNsSZB.js";import"./ErrorLoading-pJWt4cqF.js";import"./BTIconDeleteFilled-BwONBXmB.js";import"./BTIconPlusCircleFilled-fsPvse7V.js";import"./FilteredEmptyState-BzV6N6ut.js";import"./DocumentContextMenu.types-DP8pY6Rj.js";import"./BTIconMessageOutlined-irzxXP-S.js";import"./ValidationSummary-BnyDyRBI.js";import"./BTIconHomeowners-Bf3zWeDa.js";import"./accounting-linking-BzpejHXz.js";import"./SplitRow-_g_6kM98.js";import"./SplitRowWithDotLeader-DSVWIanA.js";import"./IconArrowsClockwise-gSGOUbnB.js";import"./fileUpload.utils-rNC0QUAB.js";import"./BTIconInboxOutlined-YpvwzAp6.js";import"./BTIconUploadOutlined-CfkVUgBq.js";import"./FileDragTarget-BRJYtgcw.js";import"./IconUploadSimple-sPEBDAot.js";import"./BTLabel-Dnwib9cv.js";import"./useRequireStepUp-DeHZZHWX.js";import"./settingUtils-C0OLXZdR.js";import"./BTTableCustom-xpPEyBoH.js";import"./useHistoryState-CUcPAISI.js";import"./Filter-DcoGlmeB.js";import"./Filter-J4iebBjz.js";import"./SavedViewsAndFiltersSettings-CXLPtvP2.js";import"./BTIconEditFilled-ChD_aP92.js";import"./BTIconEllipsisOutlined-DC_4pacl.js";import"./BTIconSettingFilled-BjDXEQGN.js";import"./BTSelectDuplicate-DYXxikgs.js";import"./BTTimePicker-quHpr-Qz.js";import"./BTSelectLazy-DKepDlVe.js";import"./adminApiUrl-D88FOAn3.js";import"./DateRange-BRAzMxtm.js";import"./BTRangePicker-B75hsto1.js";import"./useBuilderDateFilterUtils-BCRo3QqR.js";
1import"./NumberDisplay-DIrVWjNP.js";import"./TextTruncate.utility-C3epKT3I.js";const _e=15;class je{constructor(t,s,a){this.jobId=t,this.newUserId=s,this.userDisplayName=a}jobId;newUserId;userDisplayName}class Ot{constructor(t,s,a){this.jobId=t,this.newUserId=s,this.userDisplayName=a}jobId;newUserId;userDisplayName}class qe{constructor(t){this.jobsites=t.jobsites?.map(a=>new Na(a))??[];const s=new ue({title:"-- NONE --",value:-1});this.users=t.users?.map(a=>new ka(a))??[],this.usersWithJobViewing=[s,...this.users.filter(a=>a.canViewJobs).map(a=>a.toBTSelectItem())],this.usersWithLeadViewing=[s,...this.users.filter(a=>a.canViewLeads).map(a=>a.toBTSelectItem())],this.usersWithRfiViewing=[s,...this.users.filter(a=>a.canViewRfis).map(a=>a.toBTSelectItem())],this.usersWithAdminUpdatePermission=[s,...this.users.filter(a=>a.canUpdateAdmin).map(a=>a.toBTSelectItem())],this.usersThatCanReassignSalesperson=[s,...this.users.filter(a=>a.canReassignSalesperson).map(a=>a.toBTSelectItem())],this.usersWithBillViewing=[s,...this.users.filter(a=>a.canViewBills).map(a=>a.toBTSelectItem())],this.usersWithSchedulesViewing=[s,...this.users.filter(a=>a.canViewSchedules).map(a=>a.toBTSelectItem())],this.purchaseOrderJobs=t.purchaseOrderJobs?.map(a=>new Oa(a,this.users))??[],this.warrantyServiceJobs=t.warrantyServiceJobs?.map(a=>new La(a,this.users))??[],this.documentJobs=t.documentJobs?.map(a=>new Wa(a,this.users.filter(n=>n.canViewDocuments)))??[],this.leads=t.leads?.map(a=>new Pa(a))??[],this.leadActivities=t.leadActivities?.map(a=>new Ba(a))??[],this.leadProposalTemplates=t.leadProposalTemplates?.map(a=>new Ea(a))??[],this.rfis=t.rfis?.map(a=>new Fa(a))??[],this.bills=t.bills?.map(a=>new Ja(a))??[],this.isContactFormDefaultUser=t.isContactFormDefaultUser,this.isAccountingUser=t.isAccountingUser,this.hasConflicts=t.hasConflicts}jobsites;users;usersWithJobViewing;usersWithLeadViewing;usersWithRfiViewing;usersWithAdminUpdatePermission;usersThatCanReassignSalesperson;usersWithBillViewing;usersWithSchedulesViewing;purchaseOrderJobs;warrantyServiceJobs;documentJobs;leads;leadActivities;leadProposalTemplates;rfis;bills;isContactFormDefaultUser;isAccountingUser;hasConflicts}class ka{constructor(t){this.loginId=t.loginId,this.name=t.name,this.canViewJobs=t.canViewJobs,this.canViewLeads=t.canViewLeads,this.canReassignSalesperson=t.canReassignSalesperson,this.canUpdateAdmin=t.canUpdateAdmin,this.canViewRfis=t.canViewRfis,this.canViewDocuments=t.canViewDocuments,this.canViewBills=t.canViewBills,this.canViewSchedules=t.canViewSchedules}loginId;name;canViewJobs;canViewLeads;canReassignSalesperson;canUpdateAdmin;canViewRfis;canViewDocuments;canViewBills;canViewSchedules;toBTSelectItem=()=>new ue({name:this.name,value:this.loginId})}class Na{constructor(t){this.jobId=t.jobId,this.jobName=t.jobName,this.totalOtherUsers=t.totalOtherUsers}jobId;jobName;totalOtherUsers}class Fa{constructor(t){this.rfiId=t.rfiId,this.titlePrefix=t.titlePrefix,this.title=t.title,this.status=t.status,this.assignedName=t.assignedName,this.jobPrefix=t.jobPrefix,this.dueDate=ie(t.dueDate)}rfiId;titlePrefix;title;status;assignedName;jobPrefix;dueDate}class Ea{constructor(t){this.proposalId=t.proposalId,this.title=t.title,this.addedByDate=ie(t.addedByDate)}proposalId;title;addedByDate}class Ba{constructor(t){this.activityId=t.activityId,this.activityType=t.activityType,this.scheduledDate=ie(t.scheduledDate),this.opportunityTitle=t.opportunityTitle}activityId;activityType;scheduledDate;opportunityTitle}class Pa{constructor(t){this.leadId=t.leadId,this.opportunityTitle=t.opportunityTitle,this.dateAdded=ie(t.dateAdded)}leadId;opportunityTitle;dateAdded}class Oa{constructor(t,s){this.jobId=t.jobId,this.jobName=t.jobName,this.purchaseOrders=t.purchaseOrders.map(n=>new Ra(n));const a=new Set(t.associatedLoginIds);this.associatedLogins=[new ue({title:"-- NONE --",value:-1}),...s.filter(n=>a.has(n.loginId)).map(n=>n.toBTSelectItem())]}jobId;jobName;purchaseOrders;associatedLogins}class Ra{constructor(t){this.purchaseOrderId=t.purchaseOrderId,this.ownerName=t.ownerName,this.workStatus=t.workStatus,this.dateAdded=ie(t.dateAdded),this.title=t.title}purchaseOrderId;ownerName;workStatus;dateAdded;title}class Ja{constructor(t){this.billId=t.billId,this.title=t.title,this.paymentStatus=t.paymentStatus,this.isSubRequested=t.isSubRequested,this.dateAdded=ie(t.dateAdded)}billId;isSubRequested;paymentStatus;dateAdded;title}class La{constructor(t,s){this.jobId=t.jobId,this.jobName=t.jobName,this.warrantyServices=t?.warrantyServices.map(n=>new Va(n));const a=new Set(t.associatedLoginIds);this.associatedLogins=[new ue({title:"-- NONE --",value:-1}),...s.filter(n=>a.has(n.loginId)).map(n=>n.toBTSelectItem())]}jobId;jobName;warrantyServices;associatedLogins}
1class Va{constructor(t){this.warrantyServiceId=t.warrantyServiceId,this.warrantyTitle=t.warrantyTitle,this.serviceStatus=new Ma(t.serviceStatus),this.warrantyClassification=t.warrantyClassification,this.appointmentDate=ie(t.appointmentDate)}warrantyServiceId;warrantyTitle;serviceStatus;warrantyClassification;appointmentDate}class Ma{constructor(t){this.subAckStatusAsEnum=t.subAckStatusAsEnum,this.hoursUntilAppointmentDate=t.hoursUntilAppointmentDate,this.performedByLoginType=t.performedByLoginType,this.subNeedsToSetAppointment=t.subNeedsToSetAppointment,this.performingUserAcceptedDate=t.performingUserAcceptedDate?ie(t.performingUserAcceptedDate):void 0}subAckStatusAsEnum;hoursUntilAppointmentDate;performedByLoginType;subNeedsToSetAppointment;performingUserAcceptedDate}class Wa{constructor(t,s){this.jobId=t.jobId,this.jobName=t.jobName,this.documents=t.documents.map(n=>new $a(n));const a=new Set(t.associatedLoginIds);this.associatedLogins=[new ue({title:"-- NONE --",value:-1}),...s.filter(n=>a.has(n.loginId)).map(n=>n.toBTSelectItem())]}jobId;jobName;documents;associatedLogins}class $a{constructor(t){this.documentInstanceId=t.documentInstanceId,this.title=t.title,this.folderName=t.folderName}documentInstanceId;title;folderName}class Ha{async get(t){return await T(`/api/InternalUsers/${t}`,{method:"GET",responseType:ye})}async getDefault(){return await T("/api/InternalUsers/Defaults",{method:"GET",responseType:ye})}async getJobsitesForUser(t,s,a){return await T("/api/InternalUsers/JobAccess",{method:"GET",data:{userId:t,filter:fs(s),addToAllExistingJobs:a},responseType:gs})}async getAccountingInfo(t){return await T(`/api/Accounting/${t}/LinkedEntityInfo?loginType=${ze.BUILDER}`,{method:"GET",responseType:bs})}async syncEmployee(t){return await T(`/api/Accounting/${t}/SyncEmployee`,{method:"PUT",responseType:ys})}async unlinkAccountingVendor(t){return await T("/api/Accounting/AccountingEntity",{method:"PUT",data:{accountingEntityID:"-1",idType:Nt.EmployeeID,numericEntityID:t},responseType:xs})}async create(t){return await T("/api/InternalUsers/AddInternalUserReact",{method:"POST",data:t,responseType:ye})}async update(t,s){return await T(`/api/InternalUsers/${t}/UpdateInternalUserReact`,{method:"PUT",data:s,responseType:ye})}async delete(t){return await T(`/api/InternalUsers/${t}`,{method:"DELETE",responseType:ht})}async deleteCalendarFeed(t,s){return await T(`/api/Calendar/DeleteCalendarFeed?calendarFeedId=${s}&loginId=${t}`,{method:"DELETE",responseType:ht})}async getDeleteConflicts(t){return await T(`/api/InternalUsers/${t}/InternalUserDeleteConflicts`,{method:"GET",responseType:qe})}async reassignJobsitesForUserDeletion(t,s){return await T("/api/InternalUsers/ReassignJobsitesForUserDeletion",{method:"PUT",data:{oldLoginId:t,newLoginId:s},responseType:qe})}async reassignItemsForUserDeletion(t){return await T("/api/InternalUsers/ReassignItemsForUserDeletion",{method:"PUT",data:t,responseType:qe})}async getPayrollSettingsInfo(t){if(t===0)throw new Error("globalUserId cannot be 0");return await T(`/api/payroll/InternalUsersSettings?globalUserId=${t}`,{method:"GET",responseType:js})}async syncWithGusto(t){if(t===0)throw new Error("globalUserId cannot be 0");return await T("/api/payroll/SyncEmployee",{method:"PUT",data:{id:t},responseType:$e})}async addToGusto(t){if(t===0)throw new Error("globalUserId cannot be 0");return await T("/api/payroll/CreateEmployee",{method:"PUT",data:{id:t},responseType:$e})}async disconnectFromGusto(t){if(t===0)throw new Error("globalUserId cannot be 0");return await T("/api/payroll/DisconnectEmployee",{method:"PUT",data:{id:t},responseType:$e})}}const qa=i=>{switch(i){case q.Voided:return"danger";case q.InProgress:return"";case q.WorkCompleted:return"success";case q.Pending:case q.SubRequestedInspectionAndPayment:throw Error("Not yet implemented for this status.")}},Ga=i=>{switch(i){case q.Voided:return"Voided";case q.InProgress:return"Work Incomplete";case q.WorkCompleted:return"Work Complete";case q.Pending:case q.SubRequestedInspectionAndPayment:throw Error("Not yet implemented for this status.")}};class za extends u.PureComponent{render(){const{status:t}=this.props;return e.jsx(Ke,{statusType:qa(t),statusText:Ga(t)})}}const Rt=(i,t)=>`purchaseOrderJobs[${i}].${t}`,Ka=(i,t)=>`warrantyServiceJobs[${i}].${t}`,Ya=(i,t)=>`documentJobs[${i}].${t}`,Qa=i=>{const t=i.jobsites.length>0&&i.usersWithJobViewing.length===1,s=i.leads.length>0&&i.usersWithLeadViewing.length===1,a=i.leadActivities.length>0&&i.usersWithLeadViewing.length===1,n=i.leadProposalTemplates.length>0&&i.usersWithLeadViewing.length===1,r=i.rfis.length>0&&i.usersWithRfiViewing.length===1,l=i.isContactFormDefaultUser&&i.usersThatCanReassignSalesperson.length===1,d=i.isAccountingUser&&i.usersWithAdminUpdatePermission.length===1;let c=!1;const{purchaseOrderJobs:I,documentJobs:g}=i;I.length>_e?c=i.users.length===0:I.length>0&&(c=I.some(w=>w.associatedLogins.length===1));const y=i.warrantyServiceJobs.length>0&&i.warrantyServiceJobs.some(w=>w.associatedLogins.length===1);let S=!1;return g.length>0&&(S=g.some(w=>w.associatedLogins.length===1)),t||c||s||a||n||r||l||d||S||y?e.jsx(Ye,{showIcon:!0,banner:!0,type:"error",message:e.jsxs(e.Fragment,{children:["There are no available users with permissions to update the following.",e.jsxs("ul",{children:[t&&e.jsx("li",{children:"Jobsites"}),c&&e.jsx("li",{children:"Purchase Orders"}),s&&e.jsx("li",{children:"Leads"}),S&&e.jsx("li",{children:"Documents"}),n&&e.jsx("li",{children:"Lead Proposal Templates"}),a&&e.jsx("li",{children:"Lead Activities"}),r&&e.jsx("li",{children:"RFIs"}),l&&e.jsx("li",{children:"Lead Contact Form"}),d&&e.jsx("li",{children:"Accounting System Setup"}),y&&e.jsx("li",{children:"Warranty Service Appointments"})]}),"Grant another user with these permissions and try again."]}),"data-testid":"noAvailableUsersWithPermissions"}):null};let _a=class extends u.Component{render(){const{actionBeingPerformed:t,handleSubmit:s,values:a,errors:n,internalUserName:r}=this.props;return e.jsx(wt,{title:"Internal User Delete Conflicts",footerContent:e.jsx(ce,{type:"primary","data-testid":"submitting",onClick:s,actionBeingPerformed:t,loadingAction:"submitting",children:this.props.entity.jobsites.length===0?"Transfer Permissions":"Save & Continue"}),modalConfig:this.props.modalConfig,children:e.jsx(Ce,{children:e.jsxs(Ut,{children:[e.jsx(Ft,{errors:n,values:a,showAfterSubmit:this.props.submitCount,scheme:Jt(this.props)}),e.jsx(Qa,{...this.props.entity}),e.jsxs(j,{title:"Users Conflicts Preventing Deletion",children:["There are jobs, docs, POs, warranty service appointments, RFIs, leads, lead proposal templates, lead activities and/or lead emails currently that ONLY ",e.jsx("strong",{children:r})," has access to. In order to proceed with delete, you'll need to choose a user who can access these items."]}),this.props.entity.jobsites.length>0&&e.jsx(Xa,{...this.props}),this.props.entity.jobsites.length===0&&e.jsx(Za,{...this.props})]})})})}};class Xa extends u.Component{render(){const{setFieldValue:t,values:s}=this.props,{jobsites:a,usersWithJobViewing:n}=this.props.entity,r=e.jsxs("div",{children:[e.jsx(F,{children:"Jobs"}),e.jsx("ul",{children:a.map((l,d)=>e.jsx("li",{children:l.jobName},d))})]});return e.jsxs(j,{title:"Reassign Jobs",children:[r,e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"assignJobToId",children:e.jsx(se,{id:"assignJobToId","data-testid":"assignJobTo",value:s.assignJobToId,treeData:n,onChange:t,onBlur:()=>{}})})})})]})}}class Za extends u.Component{handlePurchaseOrderOrJobAssignmentChange=(t,s,a,n)=>{this.props.setFieldValue(s,this.props.values.purchaseOrderJobs.map((r,l)=>l===t?new je(r.jobId,parseInt(a),n):r))};handleWarrantyServiceOrJobAssignmentChange=(t,s,a,n)=>{this.props.setFieldValue(s,this.props.values.warrantyServiceJobs.map((r,l)=>l===t?new je(r.jobId,parseInt(a),n):r))};handleDocumentJobAssignmentChange=(t,s,a,n)=>{this.props.setFieldValue(s,this.props.values.documentJobs.map((r,l)=>l===t?new Ot(r.jobId,parseInt(a),n):r))};render(){const{leads:t,leadActivities:s,leadProposalTemplates:a,purchaseOrderJobs:n,warrantyServiceJobs:r,rfis:l,isAccountingUser:d,isContactFormDefaultUser:c,documentJobs:I,bills:g}=this.props.entity,y=t.length>0||s.length>0||a.length>0,S=n.length>_e,w=!S&&n.length>0;return e.jsxs(e.Fragment,{children:[S&&this.props.values.purchaseOrderJobs!==null&&e.jsx(si,{...this.props,onPurchaseOrderOrDocumentJobAssignmentChange:this.handlePurchaseOrderOrJobAssignmentChange}),w&&this.props.values.purchaseOrderJobs!==null&&e.jsx(ti,{...this.props,onPurchaseOrderOrDocumentJobAssignmentChange:this.handlePurchaseOrderOrJobAssignmentChange}),g.length>0&&e.jsx(oi,{...this.props}),r.length>0&&e.jsx(ai,{...this.props,onWarrantyServiceOrAssignmentChange:this.handleWarrantyServiceOrJobAssignmentChange}),I.length>0&&e.jsx(ei,{...this.props,onPurchaseOrderOrDocumentJobAssignmentChange:this.handleDocumentJobAssignmentChange}),y&&e.jsx(ii,{...this.props}),l.length>0&&e.jsx(ri,{...this.props}),c&&e.jsx(di,{...this.props}),d&&e.jsx(li,{...this.props})]})}}class ei extends u.Component{render(){const{values:t}=this.props,{documentJobs:s}=this.props.entity;return e.jsx(j,{title:"Purchase Orders",children:s.map((a,n)=>e.jsxs("div",{className:"padding-bottom-lg",children:[e.jsx(Z,{label:"Job",children:a.jobName}),e.jsx(_,{rowKey:r=>r.documentInstanceId.toString(),dataSource:a.documents,columns:[{title:"Folder",dataIndex:"folderName"},{title:"Title",dataIndex:"title"}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:Ya(n,"newUserId"),children:e.jsx(L,{id:"purchaseOrderJobs","data-testid":"purchaseOrderJobs",value:t.documentJobs[n].newUserId,treeData:a.associatedLogins,onChange:(r,l,d)=>this.props.onPurchaseOrderOrDocumentJobAssignmentChange(n,r,l,d.title),onBlur:()=>{}})})})}),pagination:!1})]},`job-${a.jobId}`))})}}class ti extends u.Component{render(){const{values:t}=this.props,{purchaseOrderJobs:s}=this.props.entity;return e.jsx(j,{title:"Purchase Orders",children:s.map((a,n)=>e.jsxs("div",{className:"padding-bottom-lg",children:[e.jsx(Z,{label:"Job",children:a.jobName}),e.jsx(_,{rowKey:r=>r.purchaseOrderId.toString(),dataSource:a.purchaseOrders,columns:[{title:"Title",dataIndex:"title"},{title:"Client Name",dataIndex:"ownerName"},{title:"Work Completed",dataIndex:"workStatus",render:r=>e.jsx(za,{status:r})},{title:"Date Added",dataIndex:"dateAdded",render:r=>e.jsx(X,{value:r})}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:Rt(n,"newUserId"),children:e.jsx(L,{id:"purchaseOrderJobs","data-testid":"purchaseOrderJobs",value:t.purchaseOrderJobs[n].newUserId,treeData:a.associatedLogins,onChange:(r,l,d)=>this.props.onPurchaseOrderOrDocumentJobAssignmentChange(n,r,l,d.title),onBlur:()=>{}})})})}),pagination:!1})]},`job-${a.jobId}`))})}}class si extends u.Component{render(){const{values:t}=this.props,{purchaseOrderJobs:s,users:a}=this.props.entity,n=s.reduce((d,c)=>d+c.purchaseOrders.length,0),r=new Set;
1s.forEach(d=>{d.associatedLogins.forEach(c=>{r.has(c.value)||r.add(c.value)})});const l=[new ue({title:"-- NONE --",value:-1}),...a.filter(d=>r.has(d.loginId)).map(d=>d.toBTSelectItem())];return e.jsxs(j,{title:"Purchase Orders",children:[s.length," Jobs contains ",n," Purchase Orders",e.jsx(_,{className:"padding-top-md",rowKey:d=>d.jobId.toString(),dataSource:s,columns:[{title:"Job Name",dataIndex:"jobName"},{title:"Purchase Orders",dataIndex:"purchaseOrders",render:d=>d.length,align:"right"}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:Rt(0,"newUserId"),label:"Assign all purchase orders to",children:e.jsx(L,{id:"purchaseOrderJobs","data-testid":"purchaseOrderJobs",value:t.purchaseOrderJobs[0].newUserId,treeData:l,onChange:(d,c,I)=>this.props.onPurchaseOrderOrDocumentJobAssignmentChange(0,d,c,I.title),onBlur:()=>{}})})})}),pagination:!1})]})}}const ni=(i,t,s,a)=>()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:Ka(i,"newUserId"),children:e.jsx(L,{id:"warrantyServiceJobs","data-testid":"warrantyServiceJobs",value:t,treeData:s,onChange:(n,r,l)=>a(i,n,r,l.title),onBlur:()=>{}})})})}),ai=({values:i,entity:t,onWarrantyServiceOrAssignmentChange:s})=>{const{warrantyServiceJobs:a}=t;return e.jsx(j,{title:"Warranty Service Appointments",children:a.map((n,r)=>e.jsxs("div",{className:"padding-bottom-lg",children:[e.jsx(Z,{label:"Job",children:n.jobName}),e.jsx(_,{rowKey:"warrantyServiceId",dataSource:n.warrantyServices,columns:[{title:"Warranty",dataIndex:"warrantyTitle"},{title:"Classification",dataIndex:"warrantyClassification"},{title:"Appointment Date",dataIndex:"appointmentDate",render:l=>e.jsx(X,{showTime:!0,value:l})},{title:"Status",dataIndex:"serviceStatus",render:l=>e.jsx(ma,{status:l.subAckStatusAsEnum,hoursUntilAppointmentDate:l.hoursUntilAppointmentDate,assignedToLoginType:l.performedByLoginType,scheduledDateAccepted:!l.subNeedsToSetAppointment,acknowledgedDate:l.performingUserAcceptedDate})}],pagination:!1,footer:ni(r,i.warrantyServiceJobs[r].newUserId,n.associatedLogins,s)})]},`job-${n.jobId}`))})};class ii extends u.Component{render(){const{values:t,setFieldValue:s}=this.props,{leads:a,leadProposalTemplates:n,leadActivities:r,usersWithLeadViewing:l}=this.props.entity;return e.jsxs(j,{title:"Leads",children:[a.length>0&&e.jsxs("div",{children:[e.jsx(F,{children:"Leads"}),e.jsx(_,{dataSource:a,rowKey:d=>d.leadId.toString(),columns:[{title:"Lead Name",dataIndex:"opportunityTitle"},{title:"Date Added",dataIndex:"dateAdded",render:d=>e.jsx(X,{value:d})}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"newLeadAssignedUserId",children:e.jsx(se,{id:"newLeadAssignedUserId","data-testid":"leadAssignedUser",value:t.newLeadAssignedUserId,treeData:l,onChange:s,onBlur:()=>{}})})})}),pagination:!1})]}),n.length>0&&e.jsxs("div",{className:"padding-top-lg",children:[e.jsx(F,{children:"Lead Proposal Templates"}),e.jsx(_,{dataSource:n,rowKey:d=>d.proposalId.toString(),columns:[{title:"Template Name",dataIndex:"title"},{title:"Date Added",dataIndex:"addedByDate",render:d=>e.jsx(X,{value:d})}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"newLeadProposalAssignedUserId",children:e.jsx(se,{id:"newLeadProposalAssignedUserId","data-testid":"leadProposalAssignedUse",value:t.newLeadProposalAssignedUserId,treeData:l,onChange:s,onBlur:()=>{}})})})}),pagination:!1})]}),r.length>0&&e.jsxs("div",{className:"padding-top-lg",children:[e.jsx(F,{children:"Lead Activities"}),e.jsx(_,{dataSource:r,rowKey:d=>d.activityId.toString(),columns:[{title:"Lead Name",dataIndex:"opportunityTitle"},{title:"Activity Type",dataIndex:"activityType"},{title:"Scheduled Date",dataIndex:"scheduledDate",render:d=>e.jsx(X,{value:d})}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"newLeadActivityAssignedUserId",children:e.jsx(se,{id:"newLeadActivityAssignedUserId","data-testid":"leadActivityAssignedUser",value:t.newLeadActivityAssignedUserId,treeData:l,onChange:s,onBlur:()=>{}})})})}),pagination:!1})]})]})}}class ri extends u.Component{render(){const{values:t,setFieldValue:s}=this.props,{rfis:a,usersWithRfiViewing:n}=this.props.entity;return e.jsxs(j,{title:"RFIs",children:[e.jsx(F,{children:"RFIs"}),e.jsx(_,{dataSource:a,rowKey:r=>r.rfiId.toString(),columns:[{title:"Title",dataIndex:"title",render:(r,l)=>Cs(l.jobPrefix)?`${l.titlePrefix} - ${r}`:`${l.jobPrefix}
1 - ${l.titlePrefix} - ${r}`},{title:"Status",dataIndex:"status",render:r=>e.jsx(ha,{status:r})},{title:"Assigned To",dataIndex:"assignedName"},{title:"Due Date",dataIndex:"dueDate",render:r=>e.jsx(X,{value:r})}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"newRfiAssignedUserId",children:e.jsx(se,{id:"newRfiAssignedUserId","data-testid":"rfiAssignedUser",value:t.newRfiAssignedUserId,treeData:n,onChange:s,onBlur:()=>{}})})})}),pagination:!1})]})}}class oi extends u.Component{render(){const{values:t,setFieldValue:s}=this.props,{bills:a,usersWithBillViewing:n}=this.props.entity;return e.jsxs(j,{title:"Bills",children:[e.jsx(F,{children:"Bills"}),e.jsx(_,{dataSource:a,rowKey:r=>r.billId.toString(),columns:[{title:"Title",dataIndex:"title"},{title:"Status",dataIndex:"paymentStatus",render:(r,l)=>vs(r,l.isSubRequested)},{title:"Date Added",dataIndex:"dateAdded",render:r=>e.jsx(X,{value:r})}],footer:()=>e.jsx(f,{children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"newBillAssignedUserId",children:e.jsx(se,{id:"newBillAssignedUserId","data-testid":"billAssignedUser",value:t.newBillAssignedUserId,treeData:n,onChange:s,onBlur:()=>{}})})})}),pagination:!1})]})}}class li extends u.Component{render(){const{values:t,setFieldValue:s}=this.props,{usersWithAdminUpdatePermission:a}=this.props.entity;return e.jsxs(j,{title:"Accounting System Setup",children:["The login you are deleting is set as the default user for viewing/modifying the Accounting settings on the Setup page. Please assign a new default user.",e.jsx(f,{className:"padding-top-sm",children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"newAccountingUserId",children:e.jsx(se,{id:"newAccountingUserId","data-testid":"accountingUser",value:t.newAccountingUserId,treeData:a,onChange:s,onBlur:()=>{}})})})})]})}}class di extends u.Component{render(){const{values:t,setFieldValue:s}=this.props,{usersThatCanReassignSalesperson:a}=this.props.entity;return e.jsxs(j,{title:"Lead Contact Form",children:["The login you are deleting is set as the default user for the Lead Contact Form. Please assign a new default user.",e.jsx(f,{className:"padding-top-sm",children:e.jsx(h,{xs:24,sm:12,children:e.jsx(p,{id:"newLeadContactFormDefaultUserId",children:e.jsx(se,{id:"newLeadContactFormDefaultUserId","data-testid":"leadContactFormDefaultUser",value:t.newLeadContactFormDefaultUserId,treeData:a,onChange:s,onBlur:()=>{}})})})})]})}}const Jt=i=>{const t=i.entity.jobsites.length>0;return o.object().shape({oldUserId:o.number(),assignJobToId:t?o.number().label("Assign job to").nullable(!1).min(1,"Must select a user."):o.number().nullable(),purchaseOrderJobs:!t&&i.entity.purchaseOrderJobs.length>0?o.array().of(o.object().shape({jobId:o.number().nullable(),userDisplayName:o.string(),newUserId:o.number().label("Assign purchase orders to").nullable(!1).min(1,"Must select a user.")})):o.array().nullable(),documentJobs:!t&&i.entity.documentJobs.length>0?o.array().of(o.object().shape({jobId:o.number().nullable(),userDisplayName:o.string(),newUserId:o.number().label("Assign documents to").nullable(!1).min(1,"Must select a user.")})):o.array().nullable(),warrantyServiceJobs:!t&&i.entity.warrantyServiceJobs.length>0?o.array().of(o.object().shape({jobId:o.number().nullable(),userDisplayName:o.string(),newUserId:o.number().label("Assign warranty service appointments to").nullable(!1).min(1,"Must select a user.")})):o.array().nullable(),newLeadAssignedUserId:o.number().label("Assign leads to").nullable(),newLeadProposalAssignedUserId:!t&&i.entity.leadProposalTemplates.length>0?o.number().label("Assign proposal templates to").nullable(!1).min(1,"Must select a user."):o.number().nullable(),newLeadActivityAssignedUserId:!t&&i.entity.leadActivities.length>0?o.number().label("Assign activities to").nullable(!1).min(1,"Must select a user."):o.number().nullable(),newRfiAssignedUserId:!t&&i.entity.rfis.length>0?o.number().label("Assign RFIs to").nullable(!1).min(1,"Must select a user."):o.number().nullable(),newLeadContactFormDefaultUserId:!t&&i.entity.isContactFormDefaultUser?o.number().label("Assign lead contact form default user to").nullable(!1).min(1,"Must select a user."):o.number().nullable(),newAccountingUserId:!t&&i.entity.isAccountingUser?o.number().label("Assign lead contact form default user for accounting setup to").nullable(!1).min(1,"Must select a user."):o.number().nullable(),newBillAssignedUserId:!t&&i.entity.bills.length>0?o.number().label("Assign Bills to").nullable(!1).min(1,"Must select a user."):o.number().nullable()})},ci=Is({mapPropsToValues:i=>{let t=null;i.entity.purchaseOrderJobs.length>_e?t=[new je(null,-1,"-- NONE --")]:i.entity.purchaseOrderJobs.length>0&&(t=i.entity.purchaseOrderJobs.map(n=>new je(n.jobId,-1,"-- NONE --")));let s=null;i.entity.warrantyServiceJobs.length>0&&(s=i.entity.warrantyServiceJobs.map(n=>new je(n.jobId,-1,"-- NONE --")));let a=null;return i.entity.documentJobs.length>0&&(a=i.entity.documentJobs.map(n=>new Ot(n.jobId,-1,"-- NONE --"))),{oldUserId:i.loginId,assignJobToId:i.entity.jobsites.length>0?-1:null,newRfiAssignedUserId:i.entity.rfis.length>0?-1:null,newLeadAssignedUserId:i.entity.leads.length>0?-1:null,newLeadProposalAssignedUserId:i.entity.leadProposalTemplates.length>0?-1:null,newLeadActivityAssignedUserId:i.entity.leadActivities.length>0?-1:null,newLeadContactFormDefaultUserId:i.entity.isContactFormDefaultUser?-1:null,newAccountingUserId:i.entity.isAccountingUser?-1:null,purchaseOrderJobs:t,warrantyServiceJobs:s,documentJobs:a,newBillAssignedUserId:i.entity.bills.length>0?-1:null}},validationSchema:Jt,validateOnChange:!0,validateOnBlur:!0,enableReinitialize:!0,handleSubmit:async(i,{props:t,setSubmitting:s})=>{s(!0),t.entity.jobsites.length>0?await t.onReassignJobsitesForUserDeletion(i.assignJobToId):await t.onReassignItemsForUserDeletion(i),s(!1)}})(_a);class ui extends u.Component{state={actionBeingPerformed:void 0};handleReassignJobsitesForUserDeletion=async t=>{await W(this,{actionBeingPerformed:"submitting",callback:async()=>await this.props.onReassignJobsitesForUserDeletion(t)})};handleReassignItemsForUserDeletion=async t=>{await W(this,{actionBeingPerformed:"submitting",callback:async()=>await this.props.onReassignItemsForUserDeletion(t)})};
1render(){if(!this.state)return e.jsx(ke,{});const{modalConfig:t}=this.props,s=e.jsx(ci,{loginId:this.props.loginId,internalUserName:this.props.internalUserName,entity:this.props.entity,onReassignJobsitesForUserDeletion:this.handleReassignJobsitesForUserDeletion,onReassignItemsForUserDeletion:this.handleReassignItemsForUserDeletion,actionBeingPerformed:this.state.actionBeingPerformed,modalConfig:t});return t?e.jsx(Tt,{"data-testid":"btModalInternalUserDeleteConflicts",title:"Internal User Delete Conflicts",beforeClose:t.beforeClose,width:"800px",visible:!0,removeBodyPadding:!0,useModalLayout:!0,children:s}):s}}const hi=St(ui)("Could not load Internal User Delete Conflicts"),mi=({visible:i,onConfirm:t,onCancel:s,userName:a,actionBeingPerformed:n})=>{const l=u.useContext(Qe)?.name??"Company";return e.jsxs(As,{beforeClose:s,visible:i,removeHeader:!0,className:"OrgOwnerRoleConfirm",fitToContent:!0,removeBodyPadding:!0,children:[e.jsx(ws,{className:"ConfirmHeader",children:"Are you sure you want to assign this role?"}),e.jsxs(Us,{className:"ConfirmContent",children:[a," will be able to access and edit:",e.jsxs("ul",{children:[e.jsx("li",{children:"All entities in Buildertrend"}),e.jsxs("li",{children:[l," bank account information"]}),e.jsxs("li",{children:[l,"'s Buildertrend subscription"]})]})]}),e.jsxs(Ss,{className:"ConfirmFooter",children:[e.jsx(A,{onClick:s,"data-testid":"cancelRoleChange",type:"secondary",className:"margin-right-xs",children:"Cancel"}),e.jsx(A,{onClick:t,"data-testid":"confirmRoleChange",type:"primary",loading:n!==void 0,children:"Confirm"})]})]})};function pi(i){const{entity:t,values:s,setFieldValue:a,setFieldTouched:n,onReloadUser:r}=i,l=Ts(t.accountingEntity.accountingIntegrationType),d=t.internalUser.id===0;return e.jsx(e.Fragment,{children:e.jsxs(j,{title:l,children:[e.jsx(pa,{entity:t.accountingEntity,linkByDefault:!1,isNew:d,btEntityName:`${t.internalUser.firstName} ${t.internalUser.lastName}`,idType:Nt.EmployeeID,errorValidationText:`Please select a ${l} ${t.accountingEntity.primaryAccountingTerm.toLocaleLowerCase()} to link to.`,actionFieldName:"createNewAccountingEntityOption",linkTypeFieldName:"accountingEntityLinkingType",onUpdateAccounting:i.onUpdateAccounting,onUnlinkFromAccounting:i.onUnlinkAccounting,onReloadAccounting:r,onLinkEntityToAccounting:i.onLinkEntityToAccounting}),t.payrollItems&&e.jsxs("div",{className:"margin-top-lg",children:[e.jsx(F,{level:2,children:"Time Clock Options"}),e.jsx(h,{xs:16,md:8,lg:6,children:e.jsx(Z,{label:e.jsxs(e.Fragment,{children:["Default Quickbooks Payroll Item"," ",e.jsx(Q,{content:"Select the Payroll Item you want used by default when creating QuickBooks time activities from this internal user's time clock shifts. This selection can be overridden on individual shifts before sending to QuickBooks.",removeSpacing:!0})]}),children:e.jsx(L,{...i,id:"defaultPayrollItem","data-testid":"defaultPayrollItem",onChange:a,onBlur:n,treeData:t.payrollItems.treeData,value:s.defaultPayrollItem})})})]})]})})}const gi=({values:i,setFieldValue:t,setFieldTouched:s,handleChange:a,canEdit:n,inEditMode:r})=>{const l=u.useCallback(async()=>(B.info("Click Save to Upload File"),!0),[]);return e.jsx(j,{title:"Messaging",children:e.jsx(Ce,{children:e.jsxs("div",{className:"margin-bottom-md flex flex-col gap-2",children:[e.jsx(F,{children:"Message Preferences"}),e.jsxs("div",{className:"flex flex-row",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(p,{id:"isOutOfOffice",useBds:!0,children:e.jsx(Ie,{id:"isOutOfOffice","data-testid":"isOutOfOffice",onChange:a,checked:i.isOutOfOffice,disabled:!n||!r,children:"Set Out of Office Status"})})}),e.jsx("div",{className:"flex flex-col padding-top-xs",children:n&&e.jsx(Q,{content:"Turning on Out of Office does not prevent others from sending you messages.",children:e.jsx(Ds,{})})})]}),e.jsx(p,{id:"messageSignature",useBds:!0,children:e.jsx(ks,{id:"messageSignature","data-testid":"messageSignature",onChange:t,onBlur:s,value:i.messageSignature,maxLength:2e4,readOnly:!r})}),e.jsx(p,{id:"signatureImage",useBds:!0,children:e.jsx(fa,{url:i.tempFile?i.tempFile.url:Ns})}),e.jsxs(f,{children:[e.jsx(h,{children:e.jsx(p,{id:"tempFile",children:e.jsx(ga,{id:"tempFile","data-testid":"tempFile",setFieldValue:t,value:i.tempFile,allowedFileTypes:["jpg","jpeg","gif","png"],tempFileType:Fs.Contacts,showUploadList:i.tempFile?.fileName!=="",beforeUpload:l,disabled:!r})})}),e.jsx(h,{children:i.tempFile&&r&&e.jsx(A,{"data-testid":"remove-signature-image",className:"margin-left-sm",onClick:()=>{t("signatureImageTempId",-1),t("signatureImage",Dt),t("tempFile",void 0),B.info("Click Save to Permanently Delete File")},type:"tertiary",icon:e.jsx(xe,{}),"aria-label":"Trash"})})]})]})})})};class fi extends u.Component{state={actionBeingPerformed:void 0,failedToSync:!1,errorTitle:void 0,errorDescription:void 0,loading:!1};componentDidUpdate(t){const{entity:s}=this.props;t.entity!==s&&this.setState({failedToSync:!1,errorTitle:void 0,errorDescription:void 0})}handleAddToGusto=async()=>{try{const{id:t,firstName:s,onReload:a}=this.props;this.setState({loading:!0});const n=await this.props.handler.addToGusto(t);
1if(n?.errorList){const r=n.errorList[0];this.setState({failedToSync:!0,errorTitle:"There was a problem adding "+s+" to gusto.",errorDescription:r})}else B.success("Successfully added "+s+" to gusto."),this.setState({failedToSync:!1,errorTitle:void 0,errorDescription:void 0}),await a()}catch(t){E(t)}this.setState({loading:!1})};handleSyncWithGusto=async()=>{try{const{id:t,firstName:s,onReload:a}=this.props;this.setState({loading:!0});const n=await this.props.handler.syncWithGusto(t);if(n?.errorList){const r=n.errorList[0];this.setState({failedToSync:!0,errorTitle:s+" could not be synced",errorDescription:r+' You can sync manually by choosing an employee from the menu below and clicking "Save", or click "Create User in Gusto" to generate a new Gusto employee to sync with.'})}else this.setState({failedToSync:!1,errorTitle:void 0,errorDescription:void 0}),B.success("Successfully synced "+s+" with gusto."),await a()}catch(t){E(t)}this.setState({loading:!1})};handleDisconnectFromGusto=async()=>{try{const{id:t,firstName:s,onReload:a}=this.props;this.setState({loading:!0}),(await this.props.handler.disconnectFromGusto(t))?.errorList?this.setState({failedToSync:!0,errorDescription:"There was a problem disconnecting "+s+" from gusto."}):(await a(),B.success("Successfully disconnected "+s+" from gusto."))}catch(t){E(t)}this.setState({loading:!1})};JobDropDown=()=>{const{entity:t,setFieldValue:s,setFieldTouched:a,values:n}=this.props,{payrollIntegratioName:r,availableJobs:l,canUpdate:d}=t;return l?e.jsx(p,{id:"payrollJobID",label:r+" Job",children:e.jsx(L,{id:"payrollJobID","data-testid":"payrollJobID",value:n.payrollJobID,onChange:s,onBlur:a,treeData:l,disabled:!d,className:"margin-bottom-sm"})}):e.jsx(e.Fragment,{})};EmployeeDropDown=()=>{const{entity:t,setFieldValue:s,setFieldTouched:a,values:n}=this.props,{payrollIntegratioName:r,payrollEmployees:l,canUpdate:d}=t;return e.jsx(p,{id:"payrollEmployeeId",label:"Linked "+r+" Employee",children:e.jsx(L,{id:"payrollEmployeeId","data-testid":"payrollEmployeeId",value:n.payrollEmployeeId,onChange:s,onBlur:a,treeData:l,disabled:!d,className:"margin-bottom-sm"})})};AddButton=()=>{const{entity:t}=this.props,{payrollIntegratioName:s}=t;return e.jsxs(ce,{"data-testid":"add-to-payroll-provider",onClick:this.handleAddToGusto,actionBeingPerformed:this.state.actionBeingPerformed,loadingAction:"add",children:["Create User in ",s]})};SyncButton=()=>{const{entity:t}=this.props,{payrollIntegratioName:s}=t;return e.jsx(Q,{content:`Attempt to link this user to and existing employee in ${s}.`,placement:"top",children:e.jsxs(ce,{"data-testid":"sync-with-payroll-provider",onClick:this.handleSyncWithGusto,actionBeingPerformed:this.state.actionBeingPerformed,loadingAction:"sync",className:"margin-right-sm",children:["Sync With ",s," User"]})})};render(){const{entity:t}=this.props,{failedToSync:s,errorDescription:a,errorTitle:n,loading:r}=this.state,{payrollLogoUrl:l,payrollIntegratioName:d,payrollEmployeeId:c}=t,I=()=>e.jsx(ce,{"data-testid":"disconnect-from-payroll-provider",onClick:this.handleDisconnectFromGusto,actionBeingPerformed:this.state.actionBeingPerformed,loadingAction:"sync",className:"margin-right-sm",type:"destruction",children:"Disconnect"});return e.jsxs(e.Fragment,{children:[r&&e.jsx(ke,{}),e.jsxs(j,{title:"Payroll",children:[e.jsx(f,{className:"justify-content-start align-items-baseline",gutter:16,children:e.jsxs(h,{span:8,children:[e.jsx("img",{className:"Internal-User-Details-Payroll-Logo margin-bottom-lg",src:l,alt:d}),e.jsx("div",{className:"margin-bottom-lg",children:e.jsx(ba,{status:t.syncStatus,payrollIntegrationName:d})}),c!=="-1"&&e.jsxs(e.Fragment,{children:[this.EmployeeDropDown(),this.JobDropDown(),I()]})]})}),c==="-1"&&!s&&e.jsx(f,{className:"justify-content-start align-items-baseline",gutter:16,children:e.jsxs(h,{span:16,children:[this.SyncButton(),this.AddButton()]})}),n&&a&&e.jsx(f,{className:"justify-content-start align-items-baseline",gutter:16,children:e.jsx(h,{span:16,children:e.jsx(Ye,{title:n,message:a,showIcon:!0,type:"error",className:"margin-bottom-lg","data-testid":"payrollError"})})}),c==="-1"&&s&&e.jsxs(f,{className:"justify-content-start align-items-baseline",gutter:16,children:[e.jsx(h,{span:8,children:this.EmployeeDropDown()}),e.jsx(h,{span:8,className:"padding-left-sm",children:e.jsxs(Z,{label:e.jsx(e.Fragment,{children:"Â "}),children:[e.jsx("span",{className:"margin-right-sm",children:" - or - "}),this.AddButton()]})})]})]})]})}}const be={buttonLabel:"Set up two-factor authentication (2FA)",confirmTitle:"Enroll in two-factor authentication (2FA)",confirmContent:"Enrolling in two-factor authentication will log you out and send you to set up your second factor. If two-factor authentication is already configured, this will simply require you to login with it.",confirmOk:"Enroll & log out",unknownStatusTooltip:"If two-factor authentication is already configured, this will simply require you to login with it."},bi=({internalUserEntity:i,isSelf:t,loading:s,setLoading:a,showEditUsername:n,setShowEditUsername:r,mutateAsync:l})=>{const d=u.useContext(Ps),c=t?"When you save, you'll be logged out of Buildertrend. Log in again using your new username.":"When you save, the user will have to log in using their updated username.",I="Your new username must be a valid email address",g=t?"Save & log out":"Save",y=t,S="Emails sent",w=y?()=>{Rs(d)}:()=>{r(!1),B.success(S)},V=async O=>{await l({userId:i.internalUser.userId,data:{emailAddress:O}})};return e.jsx(va,{bodyCopy:c,currentUsername:i.internalUser.username,loading:s,newEmailHelperText:I,newEmailSubmitText:g,visible:n,onBeforeClose:()=>
1r(!1),onEditUsernameSuccess:w,onUsernameEdited:V,setLoading:a})},yi=({userId:i})=>{const{data:t}=Os(),s=t?.data;if(!!(s?.hasFactor&&s?.hasEveryLogin))return null;const n=!s?.isApplicable,r=()=>{ve({title:be.confirmTitle,content:be.confirmContent,okText:be.confirmOk,onOk:()=>Js(i)})};return e.jsxs("span",{className:"flex items-center gap-2",children:[n&&e.jsx(Q,{"data-testid":"mfaSelfEnroll-unknownStatus",content:be.unknownStatusTooltip}),e.jsx(A,{type:"secondary","data-testid":"mfaSelfEnroll-cta",onClick:r,children:be.buttonLabel})]})};function xi({internalUserEntity:i,isSelf:t,values:s,canEdit:a,setValues:n,onSubmit:r,setFieldValue:l,inEditMode:d}){const c=u.useContext(Qe),I=i.internalUser.id===0,g=i.internalUser.username!=="",y=t&&!c?.flags.selfServiceMfaManagement,S=!!c?.flags.selfServiceMfaManagement,w=ya(t),V=!I,O=a&&!t&&!I,[D,$]=u.useState(!1),[G,H]=u.useState(!1),{mutateAsync:C}=Es(),U=()=>{s.userEnabled?ve({title:"Archive User",content:"Archiving this User will disable their login and remove them from all Internal User lists on new jobs. You will be able to recover and re-activate any Archived Users.",okText:"Archive User",onOk:()=>{const re={...s,userEnabled:!1,loginEnabled:!1};n(re),r()}}):ve({title:"Confirm",content:"Unarchiving a user will allow them to reappear on future jobs. Activate their login on the Security & Login tab of Internal User Details.",okText:"Unarchive User",onOk:()=>{l("userEnabled",!0),r()}})};return e.jsx(j,{title:"Security & Login",className:"SecurityAndLoginsTab",extra:e.jsxs(f,{gutter:8,children:[y&&e.jsx(h,{children:e.jsx(yi,{userId:i.internalUser.userId})}),t&&e.jsx(h,{children:e.jsx(Ia,{isSelf:t})}),i.canChangeEmail&&e.jsx(h,{children:e.jsx(A,{type:"secondary","data-testid":"btnEditUsername",onClick:()=>$(!0),disabled:!d,children:"Edit username"})})]}),children:e.jsxs(Ce,{children:[e.jsx(f,{className:"margin-bottom-sm",children:e.jsxs(h,{children:[e.jsxs(f,{gutter:8,children:[e.jsx(h,{children:e.jsx(F,{level:3,children:"Login Access"})}),!t&&V&&e.jsx(h,{children:e.jsx(vt,{internalUserStatusData:i.internalUser})})]}),t&&V&&e.jsx(f,{children:e.jsx(h,{children:e.jsx(vt,{internalUserStatusData:i.internalUser})})}),!t&&e.jsx(f,{gutter:16,children:e.jsx(h,{xs:24,children:e.jsx(p,{id:"loginEnabled",label:"",className:"LoginEnabled",children:e.jsx(Bs,{id:"loginEnabled","data-testid":"loginEnabled",checked:s.loginEnabled,onCheckedChange:(re,he)=>{he?!s.primaryEmail||!s.primaryEmail.emailAddress?n({...s,primaryEmail:new kt,loginEnabled:!0}):l("loginEnabled",!0):n({...s,loginEnabled:!1,sendInvitation:!1})},label:"Active",disabled:!i.canView||!a||!s.userEnabled||!d})})})}),g&&e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"margin-top-md",children:e.jsx(h,{children:e.jsx(F,{level:3,children:"Username"})})}),e.jsx(f,{children:e.jsx(h,{children:e.jsx("span",{children:i.internalUser.username})})})]}),e.jsx(bi,{internalUserEntity:i,isSelf:t,loading:G,setLoading:H,showEditUsername:D,setShowEditUsername:$,mutateAsync:C}),O&&e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"margin-top-md",children:e.jsx(h,{children:e.jsx(F,{level:3,children:"Archive"})})}),e.jsx(f,{children:e.jsx(h,{children:e.jsx("span",{children:e.jsx(A,{"data-testid":"archive-user",onClick:U,disabled:!a||!d,children:s.userEnabled?"Archive User":"Unarchive"})})})})]})]})}),S&&e.jsx(f,{className:"margin-top-md",children:e.jsx(h,{xs:24,children:e.jsx(xa,{children:e.jsx(ja,{disabledReason:w,inEditMode:d,mfaRequirement:"adaptive"})})})})]})})}const ji="/app/static/BTTakeoffPoweredBySquareTakeoff-DvehDXUY.svg",Ii=({height:i,width:t})=>e.jsx("img",{alt:"Buildertrend Takeoff Logo",height:i?`${i}px`:"",width:t?`${t}px`:"",src:ji}),vi="Streamline estimating with Buildertrend Takeoff",Ci="Your plan comes with Buildertrend Takeoff, a full-featured takeoff tool that integrates line items and costs with the Buildertrend estimates and job proposal experiences. You'll be able to upload your digital blueprints and get accurate measurements for your line items in seconds using Buildertrend Takeoff. To get started, we'll open a new browser window and automatically set up your Buildertrend Takeoff account. ",Ai=({takeoffUserDetails:i,actionBeingPerformed:t,onDisconnect:s})=>e.jsxs(e.Fragment,{children:[e.jsx(f,{children:e.jsx(h,{xs:24,children:e.jsx(Ii,{height:72})})}),e.jsx(f,{className:"margin-vertical-lg",children:e.jsxs(h,{xs:24,children:[e.jsx(Ke,{statusType:"success",statusText:"Connected"}),e.jsx(Et,{children:e.jsxs("span",{className:"margin-left-sm",children:["Connected since"," ",e.jsx(X,{value:i.connectionDate,showTime:!0})]})})]})}),!i.isReadOnly&&e.jsx(f,{children:e.jsx(h,{xs:24,children:e.jsx(ce,{"data-testid":"disconnectTakeoff",actionBeingPerformed:t,onClick:s,children:"Disconnect"})})})]}),wi=({takeoffUserDetails:i,actionBeingPerformed:t,onInitiateConnection:s,onDisconnect:a,firstName:n,lastName:r})=>{const l=e.jsxs(e.Fragment,{children:["You do not have access to connect ",n," ",r," to Buildertrend Takeoff."," ",n," ",r," can connect their own Buildertrend account to Buildertrend Takeoff through their user preferences."]}),d=i.canConnect?Ci:l;return e.jsxs(j,{title:"Buildertrend Takeoff",children:[!i.isConnected&&e.jsx(Rn,{title:vi,details:d,showLearnMoreLink:!1,showConnectButton:i.canConnect,onClick:s}),i.isConnected&&e.jsx(Ai,{takeoffUserDetails:i,actionBeingPerformed:t,onDisconnect:a})]})}
1,Ui="Make purchasing supplies quick and easy",Si="Once connected to your The Home Depot Pro Xtra account, you can easily send items directly from Buildertrend to your online shopping cart at The Home Depot for quicker purchasing.",Ti=({vendorAccountUserDetails:i,actionBeingPerformed:t,onDisconnect:s})=>e.jsxs(e.Fragment,{children:[e.jsx(f,{children:e.jsx(h,{xs:24,children:e.jsx($n,{height:56})})}),e.jsx(f,{className:"margin-vertical-lg",children:e.jsxs(h,{xs:24,children:[e.jsx(Ke,{statusType:"success",statusText:"Connected"}),e.jsx(Et,{children:e.jsxs("span",{className:"margin-left-sm",children:["Connected since ",e.jsx(X,{value:i.connectionDate,showTime:!0})]})})]})}),!i.isReadOnly&&e.jsx(f,{children:e.jsx(h,{xs:24,children:e.jsx(ce,{"data-testid":"disconnectHomeDepot",actionBeingPerformed:t,onClick:s,children:"Disconnect"})})})]}),Di=({vendorAccountUserDetails:i,actionBeingPerformed:t,onInitiateConnection:s,onDisconnect:a,firstName:n,lastName:r})=>{const[l,d]=u.useState(!1),c=e.jsxs(e.Fragment,{children:["You do not have access to connect ",n," ",r," to The Home Depot. ",n," ",r," can connect their own Buildertrend account to The Home Depot through their user preferences."]}),I=i.canConnect?Si:c;return e.jsxs(j,{title:"The Home Depot",children:[!i.isConnected&&!l&&e.jsx(Mn,{title:Ui,details:I,showLearnMoreLink:!1,showConnectButton:i.canConnect,onClick:()=>{d(!0)}}),l&&e.jsx(Wn,{actionBeingPerformed:t,onClick:s}),i.isConnected&&e.jsx(Ti,{vendorAccountUserDetails:i,actionBeingPerformed:t,onDisconnect:a})]})};class ki extends u.Component{state={filterEntity:void 0,filterValues:void 0,sortSettings:void 0};componentDidMount=async()=>{await this.loadJobsites()};componentDidUpdate=async t=>{const{userId:s,values:a}=this.props;t.userId!==s?await this.loadJobsites():t.values.jobAccess!==null&&a.jobAccess===null&&await this.loadJobsites(this.state.filterValues)};loadJobsites=async t=>{try{let s;if(t)s=t;else{const n=await this.props.filterHandler.get(Me.InternalUserDetailsJobsList);s=Ms(n),this.setState({filterEntity:n})}let a=await this.props.handler.getJobsitesForUser(this.props.userId,s,this.props.values.addToAllExistingJobs);a=this.props.onJobAccessOnRoleChange(this.props.values.role,a),this.props.setFieldValue("jobAccess",a)}catch(s){this.setState(()=>{throw s})}};handleChangeSortSettings=t=>{this.setState({sortSettings:t})};handleFilterSubmit=async t=>{await this.loadJobsites(t),this.setState({filterValues:t}),B.success("Results updated")};setUnsavedAppliedFilter=(t,s)=>this.props.filterReducerDispatch(new Ws(t,s));handleGrantAccessToExistingJobs=(t,s)=>{this.props.setFieldValue("addToAllExistingJobs",s);const a={jobs:t.map(n=>(n.hasAccess=s,n.hasNotificationAccess!==void 0&&(n.hasNotificationAccess=s),n))};this.props.setFieldValue("jobAccess",a),this.props.onToggleAllJobAccess(t,s)};updateUnsavedChanges=(t,s,a)=>this.props.filterReducerDispatch(new $s(t,s,a));render(){const{values:t,setFieldValue:s,filterReducerState:a}=this.props,n=this.props.values.jobAccess&&Hs(this.props.values.jobAccess.jobs,r=>r.hasAccess===!0);return e.jsx("div",{children:e.jsxs(j,{className:"JobAccessTab",title:e.jsx(ia,{filterButton:this.state.filterEntity&&e.jsx(Ua,{filterId:Me.InternalUserDetailsJobsList,entity:this.state.filterEntity,onSubmit:this.handleFilterSubmit,filterTypeEntity:Me.InternalUserDetailsJobsList,showSavedFilters:!1,showSaveButton:!1,appliedFilter:a.appliedFilter,setUnsavedAppliedFilter:this.setUnsavedAppliedFilter,showHasUnsavedChanges:a.showHasUnsavedChanges,appliedFiltersFromSavedFilter:a.appliedFiltersFromSavedFilter,updateUnsavedChanges:this.updateUnsavedChanges})}),children:[!t.jobAccess&&e.jsx(ke,{displayMode:"absolute"}),t.jobAccess&&e.jsxs(e.Fragment,{children:[e.jsxs(f,{children:[this.props.userId===0&&e.jsx(h,{className:"padding-right-lg",children:e.jsx(Z,{label:"Existing Jobs:",tooltip:"Some Job Status may have restrictions based on the role",children:e.jsxs(Ie,{id:"userAccessExistingJobs","data-testid":"userAccessExistingJobs",disabled:this.props.disabled,checked:t.addToAllExistingJobs&&(n===mt.AllChecked||t.jobAccess.jobs.length===0),indeterminate:n!==mt.AllChecked&&t.addToAllE
1xistingJobs&&t.jobAccess.jobs.length>0,onChange:r=>this.handleGrantAccessToExistingJobs(t.jobAccess.jobs,r.target.checked),children:["Grant ",this.props.userName," access to all existing jobs and templates"]})})}),e.jsx(h,{children:e.jsx(Z,{label:"New Jobs:",id:"userAccessNewJobsFormItem",tooltip:"Some Job Status may have restrictions based on the role",children:e.jsx(Q,{disabled:!this.props.userIsArchived,content:e.jsx("span",{children:"This user is archived. They will not have access to new jobs."}),children:e.jsxs(Ie,{id:"userAccessNewJobs","data-testid":"userAccessNewJobs",disabled:this.props.disabled||this.props.userIsArchived,checked:t.userAccessNewJobs&&!this.props.userIsArchived,onChange:this.props.handleChange,children:["Grant ",this.props.userName," automatic access to new jobs and templates"]})})})})]}),e.jsx(f,{className:"margin-top-md",children:e.jsx(h,{flex:"auto",children:e.jsx(aa,{jobAccessEntity:t.jobAccess,setFieldValue:s,onJobAccessChanged:this.props.onJobAccessChanged,onToggleAllJobAccess:this.props.onToggleAllJobAccess,disabled:this.props.disabled,isSelf:this.props.isSelf,jobGroups:this.props.jobGroups,sortSettings:this.state.sortSettings,onChangeSortSettings:this.handleChangeSortSettings,roleJobStatusAccess:this.props.roleJobStatusAccess,inEditMode:this.props.inEditMode})})})]})]})})}}const Ni=i=>{const[t,s]=u.useReducer(Ls,Vs);return e.jsx(ki,{...i,filterReducerState:t,filterReducerDispatch:s})};function Fi({internalUserDetails:i,canEdit:t,isActive:s,inEditMode:a,...n}){const r=s&&i.internalUser.userEnabled&&i.internalUser.activationStatus===ne.ActiveInviteAccepted,l=!t&&!r||!a;return e.jsxs(j,{title:"Notifications",children:[e.jsx(Z,{children:e.jsx(Ca,{})}),e.jsx(la,{...n,disabled:l})]})}function Ei(i){const{internalUserEntity:t,values:s,isSelf:a,canEdit:n,handleChange:r,handleBlur:l,setFieldValue:d,setFieldTouched:c,onAddUpdateCalendarFeed:I,inEditMode:g}=i,{internalUser:y}=t,S=u.useContext(Qe),w=!n&&!a,V=t.canView||t.hasTimeClockCostViewing,O=y.id===0,D=O&&t.canAdd||!O&&t.canEdit,$=pt("toDos","canView"),G=pt("tasks","canView"),H=S?.flags.watchingForTasks??!1,C=u.useCallback(k=>{switch(k){case m.ScheduleItems:return(s.scheduleItemsFeed?.feedUrl??"")!=="";case m.LeadActivities:return(s.leadActivitesFeed?.feedUrl??"")!=="";case m.Todos:return(s.todosFeed?.feedUrl??"")!=="";case m.Tasks:return(s.tasksFeed?.feedUrl??"")!=="";default:{const N=k;throw new Error(`Unhandled calendar feed type: ${String(N)}`)}}},[s.scheduleItemsFeed,s.leadActivitesFeed,s.todosFeed,s.tasksFeed]),U=C(m.Tasks),re=u.useMemo(()=>(t.internalUser.calendarFeedOptions?.tasksFeedOptions??[]).filter(N=>H||!gt(Number(N.id))||(s.tasksFeed?.feedOptions??[]).includes(Number(N.id))),[t.internalUser.calendarFeedOptions,s.tasksFeed,H]),he=u.useCallback((k,N)=>{d(k,N),H||d("tasks",s.tasks.filter(le=>!gt(le)))},[H,d,s.tasks]),z=u.useCallback(k=>{switch(k){case m.ScheduleItems:return s.scheduleItemsFeed?.feedId;case m.LeadActivities:return s.leadActivitesFeed?.feedId;case m.Todos:return s.todosFeed?.feedId;case m.Tasks:return s.tasksFeed?.feedId;default:{const N=k;throw new Error(`Unhandled calendar feed type: ${String(N)}`)}}},[s.scheduleItemsFeed,s.leadActivitesFeed,s.todosFeed,s.tasksFeed]),oe=u.useCallback(async k=>{let N;switch(k){case m.ScheduleItems:N=s.scheduleItems;break;case m.LeadActivities:N=s.leadActivities;break;case m.Todos:N=s.todos;break;case m.Tasks:N=s.tasks;break;default:{const le=k;throw new Error(`Unhandled calendar feed type: ${String(le)}`)}}I(t.internalUser.id,k,N,C(k),d,z(k))},[C,z,t.internalUser.id,I,d,s.leadActivities,s.scheduleItems,s.todos,s.tasks]);return e.jsx(j,{title:"Other",children:e.jsxs(Ce,{className:"flex flex-col gap-2",children:[e.jsxs("div",{children:[e.jsx(F,{children:"Schedule"}),e.jsxs(f,{align:"middle",gutter:8,children:[e.jsx(h,{children:e.jsx(p,{id:"enableConflictAlert",children:e.jsx(Ie,{id:"enableConflictAlert","data-testid":"enableConflictAlert",onChange:r,checked:s.enableConflictAlert,disabled:w||!g,children:"Notify me when"})})}),e.jsx(h,{children:e.jsx(p,{id:"conflictAlertMaxCount",children:e.jsx(Sa,{id:"conflictAlertMaxCount","data-testid":"conflictAlertMaxCount",value:s.conflictAlertMaxCount,style:Ta,onChange:d,onBlur:l,min:2,max:100,roundToDecimalPlaces:0,disabled:!s.enableConflictAlert||w||!g})})}),e.jsx(h,{className:"margin-bottom-sm",children:"or more schedule items conflict (minimum 2)."})]})]}),y.id>0&&y.calendarFeedOptions&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{children:[e.jsx(F,{children:"Exter
1nal Calendar Integrations"}),e.jsx(qs,{href:ae.help.getHelpCenterUrl(Gs.CalendarFeedGuide),children:"Learn how to create a feed for your iCal, Google Calendar, or Outlook"})]}),e.jsx(p,{id:"scheduleItems",useBds:!0,children:e.jsx(L,{id:"scheduleItems","data-testid":"scheduleItems",className:"margin-bottom-sm",style:{minWidth:"230px"},multiple:!0,notVisiblePlaceholder:"-- All Schedule Items Selected --",treeData:y.calendarFeedOptions.scheduleFeedOptions,value:s.scheduleItems,onChange:d,onBlur:l,disabled:!g})}),e.jsx(A,{id:"schedule-items-create-feed","data-testid":"schedule-items-create-feed",onClick:()=>oe(m.ScheduleItems),disabled:!g,type:"secondary",className:"margin-bottom-md",children:`${C(m.ScheduleItems)?"Update":"Create"} Feed`}),C(m.ScheduleItems)&&e.jsxs("div",{className:"flex flex-row",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(p,{id:"scheduleItemsFeed",useBds:!0,children:e.jsx(Se,{id:"scheduleItemsFeed","data-testid":"scheduleItemsFeed",disabled:!0,onChange:d,value:s.scheduleItemsFeed?.feedUrl??void 0,onBlur:c})})}),e.jsx("div",{className:"flex flex-col",children:e.jsx(A,{"data-testid":"remove-feed",className:"margin-left-sm",icon:e.jsx(xe,{}),type:"tertiary","aria-label":"Trash",onClick:()=>i.onDeleteCalendarFeed(y.id,m.ScheduleItems,d,z(m.ScheduleItems))})})]}),e.jsx(p,{id:"leadActivities",useBds:!0,children:e.jsx(L,{id:"leadActivities","data-testid":"leadActivities",className:"margin-bottom-sm",style:{minWidth:"230px"},multiple:!0,notVisiblePlaceholder:"-- All Lead Activities Selected --",treeData:y.calendarFeedOptions.leadActivitiesFeedOptions,value:s.leadActivities,onChange:d,onBlur:l,disabled:!g})}),e.jsx(A,{id:"lead-activities-create-feed","data-testid":"lead-activities-create-feed",onClick:()=>oe(m.LeadActivities),disabled:!g,type:"secondary",children:`${C(m.LeadActivities)?"Update":"Create"} Feed`}),C(m.LeadActivities)&&e.jsxs("div",{className:"flex flex-row margin-bottom-md",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(p,{id:"leadActivitesFeed",useBds:!0,children:e.jsx(Se,{id:"leadActivitesFeed","data-testid":"leadActivitesFeed",disabled:!0,onChange:d,value:s.leadActivitesFeed?.feedUrl??void 0,onBlur:c})})}),e.jsx("div",{className:"flex flex-col",children:e.jsx(A,{"data-testid":"remove-feed",className:"margin-left-sm",onClick:()=>i.onDeleteCalendarFeed(y.id,m.LeadActivities,d,z(m.LeadActivities)),icon:e.jsx(xe,{}),type:"tertiary","aria-label":"Trash"})})]}),$&&e.jsxs(e.Fragment,{children:[e.jsx(p,{id:"todos",useBds:!0,children:e.jsx(L,{id:"todos","data-testid":"todos",className:"margin-bottom-sm",style:{minWidth:"230px"},multiple:!0,notVisiblePlaceholder:"-- All ToDo's Selected --",treeData:y.calendarFeedOptions.todoFeedOptions,value:s.todos,onChange:d,onBlur:l,disabled:!g})}),e.jsx(A,{id:"todos-create-feed","data-testid":"todos-create-feed",onClick:()=>oe(m.Todos),disabled:!g,type:"secondary",children:`${C(m.Todos)?"Update":"Create"} Feed`})]}),$&&C(m.Todos)&&e.jsxs("div",{className:"flex flex-row",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(p,{id:"todosFeed",children:e.jsx(Se,{id:"todosFeed","data-testid":"todosFeed",disabled:!0,onChange:d,value:s.todosFeed?.feedUrl??void 0,onBlur:c})})}),e.jsx("div",{className:"flex flex-col",children:e.jsx(A,{"data-testid":"remove-feed",className:"margin-left-sm",onClick:()=>i.onDeleteCalendarFeed(y.id,m.Todos,d,z(m.Todos)),icon:e.jsx(xe,{}),type:"tertiary","aria-label":"Trash"})})]}),e.jsx(zs,{isEnabled:"tasksCalendarFeed",then:G&&e.jsxs(e.Fragment,{children:[e.jsx(p,{id:"tasks",useBds:!0,children:e.jsx(L,{id:"tasks","data-testid":"tasks",className:"margin-bottom-sm",style:{minWidth:"230px"},multiple:!0,notVisiblePlaceholder:"-- All Tasks Selected --",treeData:re,value:s.tasks,onChange:d,onBlur:l,disabled:!g})}),e.jsxs(A,{"data-testid":"tasks-create-feed",type:"secondary",onClick:()=>oe(m.Tasks),disabled:!g,children:[U?"Update":"Create"," Feed"]}),U&&e.jsxs("div",{className:"flex flex-row",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(p,{id:"tasksFeed",children:e.jsx(Se,{id:"tasksFeed","data-testid":"tasksFeed",disabled:!0,onChange:d,value:s.tasksFeed?.feedUrl??void 0,onBlur:c})})}),e.jsx("div",{className:"flex flex-col",children:e.jsx(A,{"data-testid":"remove-tasks-feed",type:"tertiary",className:"margin-left-sm",onClick:()=>i.onDeleteCalendarFeed(y.id,m.Tasks,he,z(m.Tasks)),disabled:!g||w,icon:e.jsx(xe,{}),"aria-label":"Trash"})})]})]})})]}),V&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{children:"Time Clock"}),t.canView&&e.jsx(p,{id:"geofencing",useBds:!0,children:e.jsxs(Ie,{id:"geofencing","data-testid":"geofencing",onCh
1ange:r,checked:s.geofencing,disabled:!n||!g,children:["Require location on mobile and track when"," ",y.firstName," clocks in or out beyond the geofence."]})}),t.canView&&t.hasCostCodesFeature&&e.jsx(p,{id:"defaultCostCodeId",useBds:!0,children:e.jsx(L,{id:"defaultCostCodeId","data-testid":"defaultCostCodeId",treeData:y.defaultCostCodes,onChange:d,onBlur:l,value:s.defaultCostCodeId,disabled:!n||!g})}),t.hasTimeClockCostViewing&&t.hasCostCodesFeature&&e.jsx(p,{id:"defaultLaborCost",useBds:!0,children:e.jsx(Ct,{onChange:d,onBlur:l,"data-testid":"defaultLaborCost",id:"defaultLaborCost",value:s.defaultLaborCost,disabled:y.byCostCodeHourlyTracking||!D||!n||!g})}),t.hasTimeClockCostViewing&&e.jsx(p,{id:"defaultBillRate",useBds:!0,help:"Used as the default billable rate when no job-specific rate is set",children:e.jsx(Ct,{onChange:d,onBlur:l,"data-testid":"defaultBillRate",id:"defaultBillRate",value:s.defaultBillRate,disabled:!D||!n||!g,showPlaceholder:!0,placeholder:"",allowNegative:!1})})]}),e.jsxs("div",{children:[e.jsx(F,{children:"Contact"}),e.jsx(p,{id:"contactInfo",useBds:!0,children:e.jsx(Ks,{id:"contactInfo","data-testid":"contactInfo",value:s.contactInfo,onChange:d,onBlur:c,disabled:!n||!g})})]}),e.jsx(Z,{children:e.jsx(Ys,{name:"customFieldContainer",component:Zn,disabled:!n||!g,fields:{...y,customFields:s.customFields,useBds:!0}})})]})})}function Bi({canEdit:i,values:t,onRoleChange:s,internalUserDetails:a,setFieldValue:n,setFieldTouched:r,initialValues:l,onChangeActiveKey:d,manageRolesLink:c,onInviteClick:I,inEditMode:g,...y}){const S=u.useCallback(U=>{d(U)},[d]),w=u.useCallback(U=>e.jsxs(e.Fragment,{children:["Primary Email ",U.isRequiredFieldIndicatorVisible&&e.jsx(Qs,{})]}),[]),{activationStatus:V}=a.internalUser,O=t.roleTreeData,D=O.find(U=>parseInt(U.id)===t.role),$=a.canView&&a.canEdit&&a.canAdd&&a.canDelete,G=a.canView,H=a.internalUser.id!==0&&V===ne.ActiveInviteAccepted,C=!G||!i||!g;return e.jsxs(j,{title:"Overview",className:"OverviewSection",extra:e.jsxs("div",{className:"flex flex-row flex align-items-center grow",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(ft,{value:t.sendInvitation?"Invite will be sent on save.":a.internalUser.inviteStatus})}),e.jsx("div",{className:"flex flex-col",children:i&&V===ne.ActiveInvitePending&&e.jsx(ra,{loginType:ze.BUILDER,placement:g?"top":"topLeft"})}),e.jsxs("div",{className:"flex flex-col",children:[!t.sendInvitation&&a.internalUser.inviteButtonText&&i&&g&&e.jsx(A,{type:"secondary","data-testid":"btn-InviteUser",className:"margin-left-xs",onClick:I,disabled:!t.loginEnabled,children:a.internalUser.inviteButtonText}),t.sendInvitation&&i&&e.jsx(A,{type:"secondary","data-testid":"btn-InviteUser",className:"margin-left-xs",onClick:I,disabled:!t.loginEnabled,children:"Cancel Invite"})]})]}),children:[e.jsx("div",{className:"@container",children:e.jsxs("div",{id:"nameSection","data-testid":"nameSection",className:"grid grid-cols-1 gap-x-8 gap-y-4 @md:grid-cols-2",children:[e.jsx(fe,{className:"p-0",children:e.jsx(p,{id:"firstName",useBds:!0,children:e.jsx(He,{id:"firstName","data-testid":"firstName",onChange:n,onBlur:r,readOnly:C,value:t.firstName})})}),e.jsx(fe,{className:"p-0",children:e.jsx(p,{id:"lastName",useBds:!0,children:e.jsx(He,{id:"lastName","data-testid":"lastName",onChange:n,onBlur:r,readOnly:C,value:t.lastName})})})]})}),e.jsx(sa,{...y,useBds:!0,values:t,setFieldValue:n,setFieldTouched:r,initialValues:l,inputFieldReadOnly:C||H,showPrimaryEmailField:!0,maxCount:6,primaryEmailInputLabel:w,readOnly:C,innerGutterWidth:8}),e.jsx("div",{className:"@container",children:e.jsxs("div",{id:"phoneSection","data-testid":"phoneSection",className:"grid grid-cols-1 gap-x-8 gap-y-4 @md:grid-cols-2",children:[e.jsx(fe,{className:"p-0",children:e.jsx(p,{id:"phone",useBds:!0,children:!C||!t.phone?e.jsx(He,{id:"phone","data-testid":"phone",onChange:n,onBlur:r,readOnly:C,value:t.phone}):e.jsx(At,{value:t.phone,testIdBase:"phoneActions",defaultCountryCode:a.internalUser.countryCode})})}),e.jsx(fe,{className:"p-0",children:!C||!t.phoneCell?e.jsx(Kn,{defaultCountryCode:a.internalUser.countryCode,values:t,initialValues:l,onChange:n,onBlur:r,onPreferencesClicked:()=>S(v.Notifications),readOnly:!g,useBds:!0}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-xs",children:[e.jsx(p,{id:"phoneCell",label:"Cell phone",useBds:!0,children:e.jsx(At,{value:t.phoneCell,testIdBase:"cellPhoneActions",defaultCountryCode:a.internalUser.countryCode})}),t.smsOptInStatus!==Ge.None&&e.jsx(p,{id:"smsOptInStatus",label:"Receive text messages",useBds:!0,children:e.jsx(Yn,{smsOptInStatus:t.smsOptInStatus,useBds:!0})})]})})]})}),e.jsx("div",{className:"@container",children:e.jsxs("div",{id:"roleSection","data-testid":"roleSection",className:"grid grid-cols-1 gap-x-8 gap-y-4 @md:grid-cols-2 padding-top-xs",children:[e.jsxs(fe,{className:"p-0",children:[e.jsx(p,{id:"role",useBds:!0,children:e.jsx(Bt,{id:"role",treeData:O,onChange:s,onBlur:r,readOnly:C,disabled:C,value:t.role,"data-testid":"role",bds:!0,addonAfter:$&&e.jsx(A,{href:`${ae.appBase}${c}`,target:"_blank","data-testid":"manage-roles","aria-label":"Manage Roles",type:"tertiary",icon:e.jsx(Pt,{})})})}),G&&i&&e.jsx("div",{className:"flex flex-row",children:e.jsx("div",{className:"flex flex-col",children:parseInt(D.id)!==-1&&e.jsx("div",{className:"flex flex-row py-4",style:{maxWidth:"var(--bui-token-spacing-160)"},children:e.jsx("div",{className:"flex flex-col",children:e.jsx(_s,{to:"",isUnderline:!1,onClick:()=>S(v.Permissions),children:e.jsx(Xs,{size:"small",children:e.jsxs("div",{className:"flex flex-row",children:[e.jsxs("div",{className:"flex flex-col grow",children:[e.jsx(F,{bold:!0,level:4,children:e.jsx("div",{children:`${D.title} Permissions`})}),D?.extraData?.description&&e.jsx(ft,{value:D.extraData.description})]}),e.jsx("div",{className:"flex flex-col RightArrowContainer",children:e.jsx(Da,{size:"large"})})]})})})})})})})]}),e.jsx("div",{})]})})]})}function Pi({setFieldTouched:i,values:t,canEdit:s,onRoleChange:a,internalUserDetails:n,isMfaEnabled:r,manageRolesLink:l,inEditMode:d}){const c=n.internalUser.roles.find(y=>y.id===t.role),I=n.canView&&n.canEdit&&n.canAdd&&n.canDelete,g=!s||!d;return e.jsxs(j,{title:"Permissions",children:[e.jsx(p,{id:"role",useBds:!0,children:e.jsx(Bt,{id:"role","data-testid":"role",treeData:t.roleTreeData,onChange:a,onBlur:i,value:t.role,readOnly:g,disabled:g,bds:!0,addonAfter:I&&e.jsx(A,{href:`${ae.appBase}${l}`,target:"_blank","data-testid":"manage-roles",type:"tertiary","aria-label":"Manage Roles",icon:e.jsx(Pt,{})})})}),c&&t.role!==-1&&e.jsx(Aa,{id:"roles",readOnly:!0,readOnlyMessage:!1,hideName:!0,role:c,setFieldValue:a,setFieldTouched:i,isMfaEnabled:r,useBds:!0})]})}class Oi extends u.Component{getAdditionalInfo=()=>{const{isMfaEnabled:t}=this.props;return e.jsxs(e.Fragment,{children:["Multi-factor authentication is turned ",e.jsx("b",{children:Zs(t,"on","off")})," ","for this user."]})};render(){return e.jsx(wa,{isMfaEnabled:this.props.isMfaEnabled,className:"padding-top-md",renderAdditionalInfo:this.getAdditionalInfo})}}function Ri(i){const{isInEditMode:t,enterEditMode:s,exitEditMode:a}=Gn(),{entity:n,handler:r,actionBeingPerformed:l,onCloseDeleteConflicts:d,values:c,errors:I,match:g,initialTab:y,submitCount:S,onReassignItemsForUserDeletion:w,onReassignJobsitesForUserDeletion:V,onSubmit:O,getDirtyTrackingProps:D,onSaveAndNew:$,onDelete:G,onReloadUser:H,onInitiateHomeDepotConnection:C,setFieldValue:U,onDisconnectHomeDepot:re,onInitiatePartnerAccountConnection:he,onDisconnectPartnerAccount:z,deleteConflicts:oe,onJobAccessChanged:k,onToggleAllJobAccess:N,setSubmitting:le,resetForm:Ae,handleSubmit:Xe,validateForm:Ze,setErrors:Ne,permissionWizardUserId:Vt,jobAccessIds:Mt,shouldRenderAddUserToJobModal:Wt,onCloseAddUsersToJobModal:$t,onDoNotUpdateUserPermissions:et,modalConfig:K,getRoles:tt,shouldRenderTextVerificationAlert:Ht,setValues:st,initialEditMode:qt}=i;u.useEffect(()=>{qt&&s()},[]);const[nt,Gt]=u.useState(y??v.Overview),[Fe,Ee]=u.useState(!1),[zt,Kt]=u.useState(),Yt=![v.Accounting,v.Payroll,v.Vendors,v.Takeoff].includes(nt),Be=u.useCallback(async()=>{const b=document.hidden;if(b!==void 0&&!b){const x=await tt();if(x.roles.length>0&&x.roleTreeData.length>0){const P=De(x.roleTreeData);st({...c,role:P??nn,roles:x.roles,roleTreeData:x.roleTreeData})}}},[tt,st,c]);u.useEffect(()=>(document.addEventListener("visibilitychange",Be,!1),()=>{document.removeEventListener("visibilitychange",Be)}),[Be]);const Y=u.useCallback(b=>{Gt(b)},[]),at=u.useCallback(async()=>{U("sendInvitation",!0)},[U]),it=u.useCallback(async()=>{U("sendInvitation",!1)},[U]),Qt=u.useCallback(()=>{c.sendInvitation?it():at()},[it,at,c.sendInvitation]),me=u.useCallback(async(b="update")=>{let x=!1;le(!0),Xe();const P=await Ze();Object.keys(P).length===0&&(b==="saveAndNew"?(x=await $(c,Ne),x&&Ae()):x=await O(c,b,Ne)),le(!1),b==="saveAndClose"&&x&&K?.beforeClose(),b==="update"&&x&&a(),Fe&&Ee(!1)},[le,Xe,Ze,$,c,Ne,Ae,O,Fe,K,a]),de=u.useCallback(async b=>{const{dirtyKeys:x}=D(),P=c.roles.find(M=>M.name.toLowerCase()==="org owner"&&M.isSystemDefault)?.id;P!==void 0&&x.includes("role")&&c.role===P&&n.orgOwnerCount>=2?(Ee(!0),Kt(b)):await me(b)},[n.orgOwnerCount,D,me,c.role,c.roles]),Pe=u.useCallback(async()=>{await de("saveAndClose")},[de]),we=u.useCallback(async()=>{await de(n.internalUser.id===0?"save":"update")},[n.internalUser.id,de]),_t=u.useCallback(async()=>{await de("saveAndNew")},[de]),Xt=u.useCallback(async()=>{const{isOnlyConnectedUser:b}=n.vendorAccountUserDetails;ve({title:"Disconnect from The Home Depot?",content:b?"By disconnecting this user, this will disconnect Buildertrend from The Home Depot and will no longer sync information from past purchases and saved products.":"By disconnecting, this user will no longer be able to send items to The Home Depot from Buildertrend.",okText:"Disconnect",okType:"danger",onOk:async()=>{await re(),Y(v.Overview)}})},[n.vendorAccountUserDetails,re,Y]),Zt=u.useCallback(async()=>{const{internalUser:b,takeoffUserDetails:x}=n,P=b.isSelf?"You":`${b.firstName} ${b.lastName}
1`,R=b.isSelf?"your":"their",M="By disconnecting this user, this will disconnect Buildertrend from Buildertrend Takeoff. Internal users will no longer be able to launch or use Buildertrend Takeoff with their Buildertrend accounts.",ms=`${P} will no longer be able to launch or use Buildertrend Takeoff with ${R} Buildertrend account.`;ve({title:"Disconnect from Buildertrend Takeoff?",content:x?.isOnlyConnectedUser?M:ms,okText:"Disconnect",okType:"danger",onOk:async()=>{await z(),Y(v.Overview)}})},[n,z,Y]),Oe=u.useCallback((b,x)=>{if(x===void 0&&(x=c.jobAccess),b<0)return x;const P=n.internalUser.roles.find(R=>R.id===b).jobStatusAccess;return x.jobs=x.jobs.map(R=>{const M=an(R.jobStatus);return M===rn.Template||P.includes(M)||(R.hasAccess=!1,R.hasNotificationAccess=!1),R}),x},[n.internalUser.roles,c.jobAccess]),rt=u.useCallback((b,x)=>{const P=c.roles.find(M=>M.id===x),R=ca(c.notificationPreferences,P);if(c.jobAccess!==null){const M=Oe(x);U("jobAccess",M)}U("notificationPreferences",R),U(b,x)},[Oe,U,c.jobAccess,c.notificationPreferences,c.roles]),es=u.useCallback(()=>on(D,{onCloseWithSave:Pe,onCloseWithoutSave:K?.beforeClose},K?.parentRoute),[D,Pe,K?.beforeClose,K?.parentRoute]),ts=u.useCallback(()=>{const b=D();b.isDirty?ln(b.dirtyKeys,{onCloseWithSave:async()=>{await me(n.internalUser.id===0?"save":"update")},onCloseWithoutSave:()=>{Ae(),a()}}):n.internalUser.id===0?K?.beforeClose():a()},[n.internalUser.id,a,D,me,K,Ae]),ee=n.internalUser.isSelf,ot=n.canView,Re=n.canAdd,te=n.canEdit&&n.internalUser.id!==0||n.internalUser.id===0&&Re,ss=c.notificationPreferences.filter(b=>!b.isCategoryRow&&!b.isGroupRow&&b.canView),ns=n.canViewNotifications&&ss.length,pe=n.internalUser.id===0,as=pe&&Re||!pe&&te,lt=c.loginEnabled,Je=as||ee,is=Re&&(y!==v.Other&&y!==v.Notifications||!ee),dt=n.canDelete&&n.internalUser.id!==0&&!ee,ct={history:i.history,location:i.location,match:i.match},Ue={mouseEnterDelay:.2,disabled:!t,placement:"topLeft",content:"Enter view mode to make changes to this tab"},Le=`${n.internalUser.firstName} ${n.internalUser.lastName}`,rs=!pe&<&&!n.internalUser.invitationDate&&!c.sendInvitation&&c.primaryEmail,os="This user has not been invited. Invite this user to allow them to start using Buildertrend.",ls=c.loginEnabled&&(c.sendInvitation||n.internalUser.activationStatus===ne.ActiveInviteAccepted||n.internalUser.activationStatus===ne.ActiveInvitePending||n.internalUser.accountConfirmationDate!==void 0&&n.internalUser.accountConfirmationDate!==null),ds=pe?"Add Internal User":`${n.internalUser.firstName} ${n.internalUser.lastName}`;let Ve=ae.internalUsers.getInternalUserRoleDetailsLink(c.role);c.role===-1&&(Ve=ae.settings.settings+ae.internalUsers.getInternalUserSettingsLink());let ut=dn([]);c.role>0&&(ut=n.internalUser.roles.find(b=>b.id===c.role).jobStatusAccess);const cs=Je&&e.jsx(A,{id:"InternalUserSaveExistingButtonId",type:"primary","data-testid":"save-edit-existing",hotkey:"save",onClick:we,loading:l==="update",disabled:!!l,value:"save",children:"Save"}),us=Je&&e.jsx(qn,{"data-testid":"internalUserPresentationalSaveGroup",type:"primary",disabled:!!l,actionBeingPerformed:l==="update"?"save":l,loadingAction:"save",buttonAction:{"data-testid":"save-edit",content:"Save",onClick:we,hotkey:"save"},menuItems:[{"data-testid":"saveAndClose-edit",content:"Save and close",onClick:Pe,hotkey:"saveAndClose"},...is?[{"data-testid":"saveAndNew-edit",content:"Save and new",onClick:_t}]:[]]}),hs=t?e.jsxs("div",{className:"flex w-full flex-row gap-2","data-testid":"InternalUserPresentationalEditFooter",children:[e.jsx("div",{className:"flex grow flex-row flex-wrap items-center justify-end gap-2","data-testid":"internalUserPresentationalCancelGroup",children:e.jsx(A,{"data-testid":"cancel-edit",type:"secondary",disabled:!!l,onClick:ts,children:"Cancel"})}),pe?us:cs]}):Yt&&e.jsxs("div",{className:"InternalUserView flex w-full flex-row gap-2","data-testid":"InternalUserPresentationalViewFooter",children:[dt&&e.jsx(cn,{...un("delete"),disabled:!!l,onCommand:G}),e.jsxs(We,{testid:"internalUserPresentationalFooterActions",className:"InternalUserPresentationalFooterActions grow justify-end",children:[e.jsx(We.Menu,{testid:"internalUserPresentationalButtonGroupMenu",ids:[],children:dt&&e.jsx(hn.Item,{eventKey:"delete",testid:"delete-menu-item",children:e.jsx(A,{"data-testid":"delete-rollup",type:"secondarydanger",loading:l==="delete",disabled:!!l,onClick:G,children:"Delete"})},"delete")}),(te||ee)&&e.jsx(We.Item,{id:"edit",pinned:!0,children:e.jsx(A,{"data-testid":"edit",type:"secondary",icon:e.jsx(mn,{}),"aria-label":"Edit Internal User",disabled:!!l,onClick:()=>s()})},"edit")]})]});return e.jsxs(e.Fragment,{children:[oe&&e.jsx(hi,{loginId:n.internalUser.id,internalUserName:Le,entity:oe,onReassignJobsitesForUserDeletion:V,onReassignItemsForUserDeletion:w,modalConfig:{parentRoute:ct.match.url,beforeClose:d},...ct}),e.jsx(wt,{title:K?ds:void 0,footerContent:hs,modalConfig:es(),className:"InternalUserModalLayout",children:e.jsxs(Ce,{children:[e.jsxs(Ut,{children:[Wt&&e.jsx(pn,{jobIds:Mt,internalUserIds:[Vt],onComplete:$t,onCancel:et,modalConfig:{parentRoute:g.url,beforeClose:et},useBds:!0}
1),rs&&e.jsx(Ye,{type:"info",message:os,"data-testid":"invitedUserMessage",showIcon:!0,closable:!0}),Ht&&e.jsx(ua,{handlePreferencesClicked:()=>Y(v.Notifications)}),e.jsx(Ft,{errors:I,values:c,showAfterSubmit:S,scheme:Lt(i)}),n.internalUser.id!==0&&e.jsxs(j,{children:[e.jsx(f,{gutter:8,children:e.jsx(gn,{globalUserId:n.internalUser.id,displayName:Le,showManageUser:!1,userProfile:{name:Le,userType:ze.BUILDER,title:"",email:n.internalUser.primaryEmail?.fullEmail??"",phone:n.internalUser.phone,cellPhone:n.internalUser.cell,primaryContact:"",canStartChatConversation:n.canStartChatConversation},hideAvatar:!0})}),e.jsx(Oi,{isMfaEnabled:n.isMfaEnabled})]}),e.jsxs(J,{"data-testid":"internal-user-tabs",activeKey:nt,onTabClick:Y,className:"InternalUserTabs",children:[e.jsx(J.TabPane,{tab:"Overview",children:e.jsx(Bi,{internalUserDetails:n,canEdit:te,onChangeActiveKey:Y,onRoleChange:rt,onInviteClick:Qt,isEmailRequired:ls,manageRolesLink:Ve,inEditMode:t,...i})},v.Overview),ot&&e.jsx(J.TabPane,{tab:"Permissions",children:e.jsx(Pi,{internalUserDetails:n,canEdit:te,onChangeActiveKey:Y,onRoleChange:rt,isMfaEnabled:n.isMfaEnabled,manageRolesLink:Ve,inEditMode:t,...i})},v.Permissions),ns&&e.jsx(J.TabPane,{tab:"Notifications",children:e.jsx(Fi,{internalUserDetails:n,onChangeActiveKey:Y,canEdit:te,isActive:lt,inEditMode:t,...i})},v.Notifications),e.jsx(J.TabPane,{tab:"Messaging",children:e.jsx(gi,{...i,internalUserEntity:n,isSelf:ee,canEdit:Je,inEditMode:t})},v.Messaging),e.jsx(J.TabPane,{tab:`Job Access (${n.internalUser.jobAccessCount})`,children:e.jsx(Ni,{...i,userId:n.internalUser.id,handler:r,onJobAccessChanged:k,onToggleAllJobAccess:N,disabled:!te||!n.canEditJobAccess||!t,userIsArchived:n.internalUser.activationStatus===ne.Archived,inEditMode:t,isSelf:ee,jobGroups:n.jobGroups,userName:n.internalUser.firstName,onJobAccessOnRoleChange:Oe,roleJobStatusAccess:ut})},v.JobAccess),e.jsx(J.TabPane,{tab:"Security & Login",children:e.jsx(xi,{...i,internalUserEntity:n,isSelf:ee,canEdit:te,onSubmit:we,inEditMode:t})},v.SecurityLogins),e.jsx(J.TabPane,{tab:"Other",children:e.jsx(Ei,{...i,internalUserEntity:n,isSelf:ee,canEdit:te,onSubmit:we,inEditMode:t})},v.Other),ot&&n.accountingEntity&&e.jsx(J.TabPane,{tab:e.jsx(Q,{"data-testid":"accounting-tooltip",...Ue,children:e.jsx("span",{children:"Accounting"})}),children:t?e.jsx(j,{title:"Accounting","data-testid":"accounting-tab-unavailable",children:"Enter view mode to make changes to this tab."}):e.jsx(pi,{...i,entity:n,onReloadUser:H})},v.Accounting),n.payrollSettingsEntity&&n.payrollSettingsEntity.canView&&e.jsx(J.TabPane,{tab:e.jsx(Q,{"data-testid":"payroll-tooltip",...Ue,children:e.jsx("span",{children:"Payroll"})}),children:t?e.jsx(j,{title:"Payroll","data-testid":"payroll-tab-unavailable",children:"Enter view mode to make changes to this tab."}):e.jsx(fi,{...i,entity:n.payrollSettingsEntity,id:n.internalUser.id,firstName:n.internalUser.firstName})},v.Payroll),n.vendorAccountUserDetails?.isBuilderConnected&&e.jsx(J.TabPane,{tab:e.jsx(Q,{"data-testid":"thd-tooltip",...Ue,children:e.jsx("span",{children:"The Home Depot"})}),children:t?e.jsx(j,{title:"The Home Depot","data-testid":"vendors-tab-unavailable",children:"Enter view mode to make changes to this tab."}):e.jsx(Di,{vendorAccountUserDetails:n.vendorAccountUserDetails,actionBeingPerformed:l,onInitiateConnection:C,onDisconnect:Xt,firstName:n.internalUser.firstName,lastName:n.internalUser.lastName})},v.Vendors),n.takeoffUserDetails?.isBuilderConnected&&e.jsx(J.TabPane,{tab:e.jsx(Q,{"data-testid":"takeoff-tooltip",...Ue,children:e.jsx("span",{children:"Buildertrend Takeoff"})}),children:t?e.jsx(j,{title:"Buildertrend Takeoff","data-testid":"takeoff-tab-unavailable",children:"Enter view mode to make changes to this tab."}):e.jsx(wi,{takeoffUserDetails:n.takeoffUserDetails,actionBeingPerformed:l,onInitiateConnection:he,onDisconnect:Zt,firstName:n.internalUser.firstName,lastName:n.internalUser.lastName})},v.Takeoff)]})]}),e.jsx(mi,{visible:Fe,onConfirm:()=>me(zt),onCancel:()=>{Ee(!1)},userName:c.firstName+" "+c.lastName,actionBeingPerformed:l}),e.jsx(fn,{modalConfig:{parentRoute:g.url,beforeClose:()=>{window.location.assign(window.location.href)}}})]})})]})}const Lt=i=>o.object().shape({firstName:o.string().max(24).required().label("First Name"),lastName:o.string().max(24).required().label("Last Name"),phone:o.string().max(25).label("Phone Number").nullable(),cell:Qn,userEnabled:o.bool(),role:o.number().notOneOf([-1],"Required").label("Role").required(),roles:o.array().of(sn),loginEnabled:o.boolean().label("User Status"),addToAllE
1xistingJobs:o.boolean(),userAccessNewJobs:o.boolean().required(),sendInvitation:o.boolean().required(),notificationPreferences:oa,jobAccess:o.object().shape({jobs:o.array().label("Jobs").of(o.object().shape({hasAccess:o.bool().label("Has Access"),jobId:o.number().label("Job Id"),jobStatus:o.mixed().label("Job Status"),jobName:o.string().label("Job Name"),groupNames:o.array().nullable().label("Group Names"),dateCreated:o.mixed().label("Date Opened")}))}).nullable().label("Job Access"),accountingEntityLinkingType:o.number().label("Accounting Jobsite Linking Type"),createNewAccountingEntityOption:o.number().label("Accounting Connection"),username:o.string().label("Username"),enableConflictAlert:o.bool(),conflictAlertMaxCount:o.number().when("enableConflictAlert",{is:!0,then:o.number().min(2).max(100)}),scheduleItems:o.array().label("Schedule Items"),scheduleItemsFeed:o.object().shape({feedId:o.number(),feedType:o.number(),feedUrl:o.string(),feedOptions:o.array()}),leadActivities:o.array().label("Lead Activities"),leadActivitesFeed:o.object().shape({feedId:o.number(),feedType:o.number(),feedUrl:o.string(),feedOptions:o.array()}),todos:o.array().label("To-Do's"),todosFeed:o.object().shape({feedId:o.number(),feedType:o.number(),feedUrl:o.string(),feedOptions:o.array()}),tasks:o.array().label("Tasks"),tasksFeed:o.object().shape({feedId:o.number(),feedType:o.number(),feedUrl:o.string(),feedOptions:o.array()}),geofencing:o.bool(),defaultCostCodeId:o.number().label("Default labor cost code"),defaultLaborCost:o.number().label("Default labor cost"),defaultBillRate:o.number().nullable().label("Default billable rate"),messageSignature:o.string().nullable().label("Message Signature"),messageSignatureImage:o.string().nullable().label("Message Signature Image"),signatureImageTempId:o.number().nullable().label("Signature Image Temp Id"),signatureImage:o.string().label("Message Signature Image"),tempFile:o.mixed(),contactInfo:o.string().max(150).label("Contact Information"),customFields:i.entity.canEdit?ta:o.mixed(),payrollEmployeeId:o.string().nullable(),payrollJobID:o.string().nullable().label("Selected Payroll Job"),defaultPayrollItem:o.string().nullable().label("Default Payroll Item"),isOutOfOffice:o.bool(),primaryEmail:ge.nullable().label("Primary Email").when("sendInvitation",(t,s)=>t?ge.nullable().map({emailAddress:a=>a.required("Email address is required for invitations.").label("Primary Email"),friendlyName:a=>a.label("Primary Email Label")}):s).when("loginEnabled",(t,s)=>t&&(i.entity.internalUser.username!==""||i.entity.internalUser.activationStatus===ne.ActiveInviteAccepted)?ge.nullable().map({emailAddress:a=>a.required("Email Address is required for active accounts.").label("Primary Email"),friendlyName:a=>a.label("Primary Email Label")}):s).when("loginEnabled",(t,s)=>t&&i.entity.internalUser.activationStatus===ne.ActiveInvitePending?ge.nullable().map({emailAddress:a=>a.required("Email address is required for invitations.").label("Primary Email"),friendlyName:a=>a.label("Primary Email Label")}):s),additionalEmails:na.of(ge.map({emailAddress:t=>t.required().label("Additional Email"),friendlyName:t=>t.label("Additional Email Label")})).max(6),roleTreeData:o.mixed(),phoneCell:Xn,smsOptInStatus:o.number(),verificationRequest:o.number()}),Ji=en({mapPropsToValues:i=>{const{entity:t}=i,{internalUser:s}=t,a=De(s.role),n=()=>t.notificationPreferences?da(t.notificationPreferences,s.roles.find(r=>r.id===a)):[];return{firstName:s.firstName,lastName:s.lastName,primaryEmail:s.primaryEmail??new kt(void 0,"1"),additionalEmails:s.additionalEmails,cell:s.cell,phone:s.phone,role:a,loginEnabled:s.loginEnabled,userAccessNewJobs:s.autoAddJobsites,addToAllExistingJobs:s.addToAllExistingJobs,sendInvitation:s.id===0,userEnabled:s.userEnabled,roles:s.roles,roleTreeData:s.role,notificationPreferences:n(),jobAccess:i.jobAccess,accountingEntityLinkingType:t.accountingEntity&&De(t.accountingEntity.linkingOptions),createNewAccountingEntityOption:t.accountingEntity?t.accountingEntity.createNewAccountingEntityOption:zn.None,username:s.username,enableConflictAlert:s.enableConflictAlert,conflictAlertMaxCount:s.conflictAlertMaxCount,scheduleItems:s.calendarFeedOptions?Te(s.calendarFeedOptions.scheduleFeedOptions):[],scheduleItemsFeed:s.calendarFeedOptions?.calendarFeedItems.find(r=>r.feedType===m.ScheduleItems)??void 0,leadActivities:s.calendarFeedOptions?Te(s.calendarFeedOptions.leadActivitiesFeedOptions):[],leadActivitesFeed:s.calendarFeedOptions?.calendarFeedItems.find(r=>r.feedType===m.LeadActivities)??void 0,todos:s.calendarFeedOptions?Te(s.calendarFeedOptions.todoFeedOptions):[],todosFeed:s.calendarFeedOptions?.calendarFeedItems.find(r=>r.feedType===m.Todos)??void 0,tasks:s.calendarFeedOptions?Te(s.calendarFeedOptions.tasksFeedOptions):[],tasksFeed:s.calendarFeedOptions?.calendarFeedItems.find(r=>r.feedType===m.Tasks)??void 0,geofencing:s.geofencingEnabled,defaultCostCodeId:s.defaultCostCodeId??Number(s.defaultCostCodes.find(r=>r.title==="Buildertrend Flat Rate").id),defaultLaborCost:s.defaultLaborCost,defaultBillRate:s.defaultBillRate,messageSignature:s.messageSignature,messageSignatureImage:s.messageSignatureImage,signatureImage:s.signatureImage,contactInfo:s.contactInfo,customFields:ea(s),payrollEmployeeId:t.payrollSettingsEntity?.payrollEmployeeId,payrollJobID:t.payrollSettingsEntity?.payrollJobID,defaultPayrollItem:t.payrollItems?De(t.payrollItems.treeData):null,tempFile:s.signatureImage!==Dt?new tn({fileName:"",url:s.signatureImage,tempId:0,hasChanged:!1}):void 0,condensedEmail:void 0,isOutOfOffice:s.isOutOfOffice,phoneCell:_n(s.cellPhoneNumber,s.countryCode,t.canEdit),smsOptInStatus:s.smsOptInStatus,verificationRequest:Bn.None}},validationSchema:i=>Lt(i),validateOnChange:!0,validateOnBlur:!0,enableReinitialize:!0,ignoreDirtyValues:["jobAccess"],handleSubmit:async()=>{}})(Ri);class Li extends u.Component{static defaultProps={handler:new Ha,filterHandler:new yn,homeDepotSettingsHandler:new Hn,takeoffSettingsHandler:new Jn,accountingHandler:new En};state={actionBeingPerformed:void 0,lastActionSaveAndNew:!1,permissionWizardUserId:0,jobAccessIds:[],shouldRenderAddUserToJobModal:!1,closeAfterSave:!1,jobAccess:null,shouldRenderTextVerificationAlert:!1};static contextType=xn;componentDidMount=async()=>{await this.loadUserSetInState(),this.props.thdConnected?B.success("Connected"):this.props.error&&(this.props.initialTab&&this.props.initialTab===v.Takeoff?bt(On(this.props.error)):bt(Vn(Ln.TheHomeDepot,this.props.error)))};loadUserSetInState=async()=>{const[t,s,a]=await Promise.all([this.load(),this.loadAccounting(),this.loadPayrollSettings()]);t&&(t.accountingEntity=s,t.payrollSettingsEntity=a),this.setState(n=>({data:t,permissionWizardUserId:n.shouldRenderAddUserToJobModal?n.permissionWizardUserId:t?.internalUser.id??0}))};reloadPayrollTab=async()=>{const[t]=await Promise.all([this.loadPayrollSettings()]),s=this.state.data;
1s&&s.canView&&(s.payrollSettingsEntity=t),this.setState({data:s})};load=async()=>{try{let t;return this.props.id===0?t=await this.props.handler.getDefault():t=await this.props.handler.get(this.props.id),t}catch(t){this.setState(()=>{throw t});return}};getRoles=async()=>{const t=await this.load();return t?{roleTreeData:t.internalUser.role,roles:t.internalUser.roles}:{roleTreeData:[],roles:[]}};redirectInternalUserDetails=(t,s)=>{this.props.modalConfig&&(s==="save"?this.props.history.replace(this.props.modalConfig.parentRoute+ae.internalUsers.getInternalUserDetailsLink(t,v.Overview)):s==="saveAndNew"&&this.props.history.replace(jn(this.props.modalConfig.parentRoute+ae.internalUsers.getInternalUserDetailsLink(t,v.Overview))))};loadAccounting=async()=>{try{const{id:t}=this.props;if(t!==0){const s=await this.props.handler.getAccountingInfo(t);return s.canViewAccountingTab?new In(t,s):void 0}else return}catch(t){this.setState(()=>{throw t});return}};loadPayrollSettings=async()=>{try{const{id:t}=this.props;return t!==0?await this.props.handler.getPayrollSettingsInfo(t):void 0}catch{return}};handleUpdateAccounting=async t=>{const s=await this.props.handler.syncEmployee(t),a=vn[this.state.data?.accountingEntity?.accountingIntegrationType??0];return s.methodSuccessful&&s.message===""&&(s.message=`${a} ${this.state.data?.accountingEntity?.primaryAccountingTerm} has been successfully updated!`),!s.methodSuccessful&&s.message===""&&(s.message=`There was a problem updating your ${a} ${this.state.data?.accountingEntity?.primaryAccountingTerm} data. Please try again in a few minutes.`),new Cn({accountingSuccess:s.methodSuccessful,accountingMessage:s.message})};handleUnlinkAccounting=async t=>await this.props.handler.unlinkAccountingVendor(t);handleLinkUserToAccounting=async t=>{await W(this,{actionBeingPerformed:"saveAndClose",callback:async()=>{try{t===An.toString()?await this.props.accountingHandler.createAccountingEntity({numericEntityID:this.props.id,idType:yt.EmployeeID}):await this.props.accountingHandler.saveAccountingEntity({accountingEntityID:t,numericEntityID:this.props.id,idType:yt.EmployeeID}),await this.loadUserSetInState()}catch(s){E(s)}}})};handleCloseAfterSave=()=>{this.setState({closeAfterSave:!0})};handleClose=()=>{this.props.modalConfig?.beforeClose()};handleSubmit=async(t,s,a)=>{let n=!1;return await W(this,{actionBeingPerformed:s,callback:async()=>{try{const r=await this.saveInternalUser(t);if(!r)return;n=this.handlePostSaveActions(r,t,s)}catch(r){this.handleSaveError(r,a)}}}),n};async saveInternalUser(t){const s=new xt(t,this.state.data);if(this.props.id===0)return await this.props.handler.create(s);{const[a,n,r]=await Promise.all([this.props.handler.update(this.props.id,s),this.loadAccounting(),this.loadPayrollSettings()]);return a&&(a.accountingEntity=n,a.payrollSettingsEntity=r),await this.reloadGlobalInfo(t),a}}handlePostSaveActions(t,s,a){this.fireToastMessage(),this.props.onSave&&this.props.onSave(t.internalUser.id),this.props.onAddInternalUserToViewingAccess&&this.props.id===0&&this.props.onAddInternalUserToViewingAccess(t.internalUser.id,`${s.firstName} ${s.lastName}`,t.internalUser.roleJobStatusAccess),this.props.id===0&&this.redirectInternalUserDetails(t.internalUser.id,a);const n=this.state.jobAccessIds.length>0,r=this.state.data?.internalUser.smsOptInStatus!==Ge.RequestedOptIn&&t.internalUser.smsOptInStatus===Ge.RequestedOptIn;return this.setState({data:t,permissionWizardUserId:t.internalUser.id,shouldRenderAddUserToJobModal:n,jobAccess:s.jobAccess,shouldRenderTextVerificationAlert:r}),a==="saveAndClose"&&n?(this.handleCloseAfterSave(),!1):!0}handleSaveError(t,s){if(t instanceof jt)this.setState(()=>{throw t});else if(t instanceof wn)E(t);else if(t.response?.data?.failedFields){const a=this.parseErrors(t.response.data);!ps(a)&&s&&s(a)}else t.response?.data?this.setState({data:new ye(t.response.data)}):E(t)}reloadGlobalInfo=async t=>{this.state.data?.internalUser.isSelf&&this.state.data?.internalUser.role.filter(s=>s.selected)[0].id&&parseInt(this.state.data.internalUser.role.filter(s=>s.selected)[0].id)!==t.role&&await this.context?.reloadGlobalInfo()};handleSaveAndNew=async t=>new Promise(s=>{W(this,{actionBeingPerformed:"saveAndNew",callback:async()=>{try{const a=new xt(t,this.state.data);let n;this.props.id===0?n=await this.props.handler.create(a):n=await this.props.handler.update(this.props.id,a),this.props.onSave&&this.props.onSave(n.internalUser.id),this.fireToastMessage(),this.props.onAddInternalUserToViewingAccess&&n&&this.props.onAddInternalUserToViewingAccess(n.internalUser.id,`${t.firstName} ${t.lastName}`,n.internalUser.roleJobStatusAccess),await this.reloadGlobalInfo(t),this.redirectInternalUserDetails(0,"s
1aveAndNew");const r=await this.load();this.setState(l=>({data:r,permissionWizardUserId:n.internalUser.id,shouldRenderAddUserToJobModal:l.jobAccessIds.length>0})),s(!0)}catch(a){s(!1),a instanceof jt?this.setState(()=>{throw a}):E(a)}}})});handleAddUpdateCalendarFeed=async(t,s,a,n,r,l)=>{let d;switch(n?d=(await Nn({loginId:t,options:a,type:s,calendarFeedId:l})).data:d=(await Fn({loginId:t,options:a,type:s})).data,s){case m.ScheduleItems:r("scheduleItemsFeed",d);break;case m.LeadActivities:r("leadActivitesFeed",d);break;case m.Todos:r("todosFeed",d);break;case m.Tasks:r("tasksFeed",d);break;default:{const c=s;throw new Error(`Unhandled calendar feed type: ${String(c)}`)}}B.success("Schedule Feed Saved!")};handleDeleteCalendarFeed=(t,s,a,n)=>{It({title:"Confirm Delete",content:"If this is deleted, this link will no longer work for any users who are currently synchronizing their schedules",okText:"Delete",onOk:async()=>{switch(n&&await this.props.handler.deleteCalendarFeed(t,n),s){case m.ScheduleItems:a("scheduleItemsFeed","");break;case m.LeadActivities:a("leadActivitesFeed","");break;case m.Todos:a("todosFeed","");break;case m.Tasks:a("tasksFeed","");break;default:{const r=s;throw new Error(`Unhandled calendar feed type: ${String(r)}`)}}B.success("Schedule Feed Deleted!")}})};handleDelete=async()=>{await this.handleGetDeleteConflicts()||It({entityName:"Internal User",onOk:async()=>{await W(this,{actionBeingPerformed:"delete",callback:async()=>{try{await this.props.handler.delete(this.props.id),this.handleClose(),Dn(kn.InternalUsers,this.props.id)}catch(s){E(s)}}})}})};handleGetDeleteConflicts=async()=>{let t=!0;return await W(this,{actionBeingPerformed:"delete",callback:async()=>{try{const s=await this.props.handler.getDeleteConflicts(this.props.id);s.hasConflicts&&this.setState({deleteConflicts:s}),t=s.hasConflicts}catch(s){E(s)}}}),t};handleCloseDeleteConflicts=()=>{this.setState({deleteConflicts:void 0})};handleReassignJobsitesForUserDeletion=async t=>{try{const s=this.state.data.internalUser.id,a=await this.props.handler.reassignJobsitesForUserDeletion(s,t);B.success("Jobsites successfully reassigned."),a.hasConflicts?this.setState({deleteConflicts:a}):this.setState({deleteConflicts:void 0})}catch(s){E(s)}};handleReassignItemsForUserDeletion=async t=>{try{const s=await this.props.handler.reassignItemsForUserDeletion(t);B.success("Items successfully reassigned."),s.hasConflicts?this.setState({deleteConflicts:s}):this.setState({deleteConflicts:void 0})}catch(s){E(s)}};parseErrors=t=>{let s={};if(t.failedFields&&t.failedFields.length>0){const a=t.failedFields.find(n=>n.key==="role.value");a&&(Un({content:a.message[0]}),s.role=a.message[0]),Array.from(t.failedFields).forEach(n=>{s=s||{},s[n.key]=n.message[0]})}return s};fireToastMessage=()=>{B.success("Saved Successfully")};handleInitiateHomeDepotConnection=async()=>{await W(this,{actionBeingPerformed:"connect",callbackNavigates:!0,callback:async()=>{try{const t=await this.props.homeDepotSettingsHandler.getRedirectInfo(this.props.id);window.parent.location.assign(t.authorizationUrl)}catch(t){E(t)}}})};handleDisconnectHomeDepot=async()=>{await W(this,{actionBeingPerformed:"disconnect",callback:async()=>{try{await this.props.homeDepotSettingsHandler.disconnectUser(this.props.id),await this.loadUserSetInState(),B.success("Disconnected")}catch(t){E(t)}}})};handleInitiatePartnerAccountConnection=async()=>{await W(this,{actionBeingPerformed:"connect",callbackNavigates:!0,callback:async()=>{try{const t=await this.props.takeoffSettingsHandler.getRedirectInfo(this.state.data?.takeoffUserDetails?.partnerId,window.parent.location.href,this.props.id);window.parent.location.assign(t.authorizationUrl)}catch(t){E(t)}}})};handleDisconnectPartnerAccount=async()=>{await W(this,{actionBeingPerformed:"disconnect",callback:async()=>{try{const t=this.state.data?.takeoffUserDetails?.partnerId;await this.props.takeoffSettingsHandler.disconnectUser(t,this.props.id),await this.loadUserSetInState(),B.success("Disconnected")}catch(t){E(t)}}})};handleJobAccessChanged=t=>{if(t.hasAccess)this.setState({jobAccessIds:this.state.jobAccessIds.filter(s=>s!==t.jobId)});else{const s=Sn(this.state.jobAccessIds);s.push(t.jobId),this.setState({jobAccessIds:s})}};handleToggleAllJobAccess=(t,s)=>{s?this.setState({jobAccessIds:t.map(a=>a.jobId)}):this.setState({jobAccessIds:[]})};handleCloseAddUsersToJobModal=()=>{if(this.state.closeAfterSave){this.handleClose();return}this.setState(t=>({shouldRenderAddUserToJobModal:!1,permissionWizardUserId:t.data?.internalUser.id??0,jobAccessIds:[]}))};handleDoNotUpdateUserPermissions=async()=>{await new Tn().updateUserPermissions(this.state.jobAccessIds,[],void 0,[this.state.permissionWizardUserId]),this.handleCloseAddUsersToJobModal()};
1render(){if(!this.state||!this.state.data)return e.jsx(ke,{});const t={history:this.props.history,location:this.props.location,match:this.props.match},s=e.jsx(Ji,{initialTab:this.props.initialTab,entity:this.state.data,handler:this.props.handler,filterHandler:this.props.filterHandler,actionBeingPerformed:this.state.actionBeingPerformed,onSubmit:this.handleSubmit,onSaveAndNew:this.handleSaveAndNew,onAddUpdateCalendarFeed:this.handleAddUpdateCalendarFeed,onDeleteCalendarFeed:this.handleDeleteCalendarFeed,onDelete:this.handleDelete,onReloadUser:this.loadUserSetInState,onUpdateAccounting:this.handleUpdateAccounting,onUnlinkAccounting:this.handleUnlinkAccounting,onLinkEntityToAccounting:this.handleLinkUserToAccounting,onReload:this.reloadPayrollTab,onInitiateHomeDepotConnection:this.handleInitiateHomeDepotConnection,onDisconnectHomeDepot:this.handleDisconnectHomeDepot,onInitiatePartnerAccountConnection:this.handleInitiatePartnerAccountConnection,onDisconnectPartnerAccount:this.handleDisconnectPartnerAccount,deleteConflicts:this.state.deleteConflicts,onCloseDeleteConflicts:this.handleCloseDeleteConflicts,onReassignJobsitesForUserDeletion:this.handleReassignJobsitesForUserDeletion,onReassignItemsForUserDeletion:this.handleReassignItemsForUserDeletion,lastActionSaveAndNew:this.state.lastActionSaveAndNew,onJobAccessChanged:this.handleJobAccessChanged,onToggleAllJobAccess:this.handleToggleAllJobAccess,jobAccess:this.state.jobAccess,permissionWizardUserId:this.state.permissionWizardUserId,jobAccessIds:this.state.jobAccessIds,shouldRenderAddUserToJobModal:this.state.shouldRenderAddUserToJobModal,onCloseAddUsersToJobModal:this.handleCloseAddUsersToJobModal,onDoNotUpdateUserPermissions:this.handleDoNotUpdateUserPermissions,modalConfig:this.props.modalConfig,getRoles:this.getRoles,shouldRenderTextVerificationAlert:this.state.shouldRenderTextVerificationAlert,initialEditMode:this.state.data.internalUser.isSelf,...t},this.props.id);return this.props.modalConfig?e.jsx(Tt,{"data-testid":"btModalInternalUser",visible:!0,removeBodyPadding:!0,title:"Internal User",className:"InternalUserModal",width:"1200px",beforeClose:this.props.modalConfig.beforeClose,useModalLayout:!0,children:s}):s}}const Vi=bn.track({})(Li),Mi=Pn(Vi)(),Uo=St(Mi)("Could not load Internal User");export{Uo as InternalUser,Uo as default}; 2//# sourceMappingURL=InternalUser-no6jSUTk.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.