import{b as D,c as p,a as g}from"./vendor-redux-a1f00e6b.js";import{f as u,b as f}from"./UserService-047aef51.js";import{ab as m,Z as y,F as S}from"./index-c62ac197.js";const w="users",l=D(w+"/getUsers",async a=>{var r,n,d,i;const{auth:e}=m.getState(),s=((n=(r=e==null?void 0:e.session)==null?void 0:r.tenantId)==null?void 0:n.toString())??"",t=await u({fromDate:"",role:"",searchString:"",toDate:""},s,a.isActive,a==null?void 0:a.roleName);return{data:(d=t==null?void 0:t.data)==null?void 0:d.values,totalCount:((i=t==null?void 0:t.data)==null?void 0:i.values.length)||[]}}),v=async a=>(await f(a)).success,I={total:0,pageIndex:1,pageSize:10,query:"",sort:{order:"",key:""}},C={loading:!1,deleteConfirmation:!1,usersList:[],tableData:I,filterData:{id:"",accountId:""},IsDrawerOpen:!1,IsDetailsOpen:!1,type:"Add",accountsList:[],metricData:{},selectedUser:[],loadingDetails:!1,grossInvestmentVolumeData:[],grossInvestmentVolumeStackedData:[],incrementAFBRData:[],netGrowthABRData:[],pipelinePieChartData:[],projectStagePieChartData:[]},c=p({name:"users",initialState:C,reducers:{setTableData:(a,e)=>{a.tableData=e.payload},setFilterData:(a,e)=>{a.filterData=e.payload},toggleDeleteConfirmation:(a,e)=>{a.deleteConfirmation=e.payload},setSelectedUser:(a,e)=>{a.selectedUser=e.payload},toggleDrawer:(a,e)=>{a.IsDrawerOpen=e.payload.IsDrawerOpen,a.type=e.payload.type},toggleViewDrawer:(a,e)=>{a.IsDetailsOpen=e.payload}},extraReducers:a=>{a.addCase(l.fulfilled,(e,s)=>{var t,o;console.log("shhsh",s==null?void 0:s.payload),e.usersList=(o=(t=s==null?void 0:s.payload)==null?void 0:t.data)==null?void 0:o.map(r=>({...r,createdDate:r.createdDate?y(r.createdDate).format("MM/DD/YYYY"):""})),e.loading=!1}).addCase(l.pending,e=>{e.loading=!0}).addCase(l.rejected,e=>{e.loading=!1})}}),{setTableData:O,setFilterData:F,toggleDeleteConfirmation:L,toggleDrawer:R,toggleViewDrawer:T,setSelectedUser:V}=c.actions,b=c.reducer,Y=g({data:b}),j=S;export{v as d,l as g,Y as r,V as s,L as t,j as u};
