import{j as t,c as z,S as U,aN as W,o as R}from"./vendor-mui-CBBEb17G.js";import{a as r}from"./vendor-react-BBazpZul.js";import{P as v}from"./index-DrXn43TP.js";import{v as E,fp as L,e as O,aX as T,iQ as A,z as m,a_ as B}from"./index-DdWwwZXu.js";import{B as M}from"./index-DQbmBtLN.js";import{W as $}from"./Wallet-CwUA1jDd.js";import{U as G}from"./userWalletModal-DeqiaOTX.js";import{S as H}from"./index-CDArk_1r.js";import"./vendor-utils-BveVE6Uf.js";import"./vendor-charts-tGnAgELZ.js";const K=({fullName:l,onClose:u,picture:d})=>t.jsx(E,{onClose:u,title:l,maxWidth:"xs",children:t.jsx(z,{className:"m-1 !p-1",children:t.jsx("img",{src:`data:image/png;base64,${d}`,className:"w-full"})})}),Q=()=>{const{GetCenterUsersDetail:l}=L(),{clinicId:u,officeId:d}=O(e=>e.doctorData);r.useRef(null);const[y,p]=r.useState(!1),[b,f]=r.useState(!1),[j,x]=r.useState(!1),[i,I]=r.useState(null),[s,g]=r.useState(null),[a,C]=r.useState(null),[h,k]=r.useState(1),[N,w]=r.useState(50),S=async()=>{try{p(!0);const{data:e}=await l({ClinicId:u,OfficeId:d,PageNumber:h,PageSize:N});if(!e)return;I(e)}finally{p(!1)}},P=async e=>{if(!i)return;const n=i.list.filter(c=>c.fullName.includes(e)||c.mobile.includes(e)||c.nationalCode.includes(e)),o={...i,list:n};g(o)};r.useEffect(()=>{S()},[h,N]),r.useEffect(()=>{g(i)},[i]);const D=[{title:t.jsx(A,{}),key:"picture",dataIndex:"picture",render:(e,n)=>t.jsx(W,{src:`data:image/png;base64,${e}`,sx:{width:35,height:35},onClick:()=>x(!0)}),width:48},{title:"نام و نام خانوادگی",key:"fullName",dataIndex:"fullName",width:200},{title:"نام کاربری",key:"userName",dataIndex:"userName"},{title:"نقش",key:"userType",dataIndex:"userType",width:70},{title:"کد ملی",key:"nationalCode",dataIndex:"nationalCode",render:(e,n,o)=>m(e)},{title:"جنسیت",key:"gender",dataIndex:"gender",width:70},{title:"شماره همراه",key:"mobile",dataIndex:"mobile",render:(e,n,o)=>m(e)},{title:"شماره تلفن",key:"phoneNumber",dataIndex:"phoneNumber",render:(e,n,o)=>m(e)},{title:"تاریخ تولد",key:"birthDate",dataIndex:"birthDate",render:e=>B(e)},{title:"نام پدر",key:"fatherName",dataIndex:"fatherName"},{title:"حساب",key:"userId",dataIndex:"userId",width:70,render:e=>t.jsx(R,{size:"small",color:"warning",className:"!m-0 !p-0",onClick:()=>f(!0),children:t.jsx($,{})})}];return t.jsxs(H,{className:"!space-y-3 !px-4 !py-2 bg-white",children:[t.jsx(M,{prevRoutes:[{path:"/",title:"داشبورد"}],currentRoute:"کاربران مرکز"}),t.jsx(v,{onRefresh:S,onSearch:P,title:"کاربران مرکز"}),t.jsx(U,{className:"h-[75vh]",children:t.jsx(T,{rowKey:"userId",data:(s==null?void 0:s.list)??[],columns:D,loading:y,onClick:e=>C(e),totalCount:(s==null?void 0:s.pagination.totalCount)??0,pageNumber:((s==null?void 0:s.pagination.pageNumber)??1)-1,pageSize:(s==null?void 0:s.pagination.pageSize)??25,onPaginationLoad:(e,n)=>{k(e+1),w(n)}})}),a&&j&&t.jsx(K,{onClose:()=>x(!1),fullName:a==null?void 0:a.fullName,picture:a==null?void 0:a.picture}),b&&a&&t.jsx(G,{userId:a==null?void 0:a.userId,userName:a==null?void 0:a.fullName,onClose:()=>f(!1)})]})},ae=()=>t.jsx(Q,{});export{ae as default};
