import{R as r,l as O,k as R,o as l,aR as y,b as j,a4 as x,g as V,h as b,i as A,j as t,G as L}from"./app-BgLa5dit.js";import{O as P}from"./BZQd390p.chunk.js";import{C as E,a as F}from"./8iu0vnCW.chunk.js";import{C as I}from"./B20c1N-e.chunk.js";import{S}from"./DeGPZXe2.chunk.js";function v(s){var d;const[p,a]=r.useState(!1),[f,o]=r.useState(!1),n=O(),h=R(),i=l(y.currentUser()),e=l(i.hasCompleted&&S.customerSettings(s.id)),{hasPermissions:g,isLoading:u}=j(),c=g(x.UserOptions);r.useEffect(()=>{!c&&!u&&V.trigger({application:A.CRM_STUDIO,action:b.CrmStudio.USER_OVERVIEW,args:[s.id]})},[u,c]);async function C(U){try{a(!0);const m=Object.values(U);await h(S.updateSettings(s.id,m)),a(!1),n.success(s.successMessage)}catch{n.error(s.errorMessage)}finally{o(!1)}}const w=e.hasCompleted&&i.hasCompleted&&e.hasCompleted;return t.jsx(E,{view:F.Users,children:t.jsx(I,{title:"Options",id:s.id,loading:!w,currentTabId:s.currentTabId,children:t.jsx(L,{onSubmit:()=>{},initialValues:e.data,children:t.jsx(P,{settings:e.data,showSpinner:p,showPopup:f,userGroups:(d=i.data)==null?void 0:d.groups,setShowPopup:o,setShowSpinner:a,onSubmit:C,filterKind:s.filterKind,title:s.title,rowClassname:"none"})})})})}export{v as U};
//# sourceMappingURL=BzwKxf6k.chunk.js.map
