import{j as e,S as i,M as m}from"./vendor-mui-CBBEb17G.js";import{B as Y}from"./index-BkhbTDKf.js";import{S as M}from"./sidebar-BIaM705d.js";import{e as k,y as h,gM as L,go as p,r as j,aX as v,z as f,aY as w,dY as D}from"./index-IP_FWtso.js";import{a as s}from"./vendor-react-BBazpZul.js";import"./vendor-utils-BveVE6Uf.js";import{S as C}from"./index-DanJwJbd.js";import{m as T}from"./monthItems-DfL7pbng.js";import"./vendor-charts-tGnAgELZ.js";const y=s.createContext(void 0),P=({children:t})=>{const{serverDate:a}=k(d=>d.doctorData),[r,n]=s.useState(!1),[c,u]=s.useState(h(a).format("jYYYY")),[l,o]=s.useState(h(a).format("jM")),[b,g]=s.useState(null),{getInsuredListAsync:I}=new C,N={states:{loading:r,selectedYear:c,selectedMonth:l,data:b},actions:{setSelectedYear:u,setSelectedMonth:o},handlers:{fetchData:async()=>{try{n(!0);const{data:d}=await I({Year:+c,Month:+l});d&&g(d)}finally{n(!1)}}}};return e.jsx(y.Provider,{value:N,children:t})},S=()=>s.useContext(y),A=()=>{const{states:{loading:t,selectedYear:a,selectedMonth:r},handlers:{fetchData:n},actions:{setSelectedYear:c,setSelectedMonth:u}}=S(),l=L({});return e.jsx(M,{loading:t,onSearch:n,children:e.jsxs(e.Fragment,{children:[e.jsxs(i,{spacing:1,children:[e.jsx(p,{children:"انتخاب سال"}),e.jsx(j,{items:l,value:a,onchange:o=>c(o)})]}),e.jsxs(i,{spacing:1,children:[e.jsx(p,{children:"انتخاب ماه"}),e.jsx(j,{items:T,value:r,onchange:o=>u(o)})]})]})})},B=[{title:"نام و نام خانوادگی",key:"fullName",dataIndex:"fullName",width:150},{title:"نوع قرارداد",key:"employmentType",dataIndex:"employmentType",width:120},{title:"شماره پرسنلی",key:"personnelNumber",dataIndex:"personnelNumber",width:120,render:t=>f(t??"0")},{title:"شماره بیمه",key:"insuranceNumber",dataIndex:"insuranceNumber",width:120,render:t=>f(t??"0")},{title:"مبلغ بیمه",key:"amount",dataIndex:"amount",width:120,render:t=>w(t??0)}],x=({data:t})=>e.jsx(i,{className:"!h-full",children:e.jsx(v,{columns:B,data:t,rowKey:"id"})}),K=()=>{const{states:{data:t}}=S(),[a,r]=s.useState("1"),n=[{key:"1",title:"پزشکان",component:e.jsx(x,{data:(t==null?void 0:t.doctors)??[]})},{key:"2",title:"دستیاران/پرستاران",component:e.jsx(x,{data:(t==null?void 0:t.assistants)??[]})},{key:"3",title:"منشی ها",component:e.jsx(x,{data:(t==null?void 0:t.secretaries)??[]})}];return e.jsx(i,{className:"h-full p-1 ",children:e.jsx(D,{tabValue:a,data:n,handleChange:r})})},R=()=>e.jsxs(m,{container:!0,className:"!h-full",children:[e.jsx(m,{item:!0,xs:.5,md:2.5,className:"!h-full !pb-10",children:e.jsx(A,{})}),e.jsx(m,{item:!0,xs:11.5,md:9.5,paddingX:2,className:"!h-full !pb-10 ",children:e.jsx(K,{})})]}),J=()=>e.jsxs(i,{className:"!px-4 !py-2 !space-y-2 h-full",children:[e.jsx(Y,{prevRoutes:[{path:"/",title:"داشبورد"}],currentRoute:"لیست بیمه"}),e.jsx(P,{children:e.jsx(R,{})})]});export{J as default};
