import{j as e,p as m,S as y,M as d}from"./vendor-mui-CBBEb17G.js";import{u as b,e as j,b3 as N,aX as k,Z as v,R as o,jv as w,j4 as R,jw as P,b6 as A,dP as C,jz as L}from"./index-IP_FWtso.js";import{a as r}from"./vendor-react-BBazpZul.js";import"./vendor-utils-BveVE6Uf.js";import{u as S}from"./index-BpUE8Op0.js";import"./vendor-charts-tGnAgELZ.js";const f=r.createContext(void 0),F=({children:s})=>{const{materialsReachedOrderLimitAsync:a}=S();b();const{userType:c}=j(l=>l.user),[i,n]=r.useState([]),[u,x]=r.useState(!1),h=async()=>{try{x(!0);const{data:l}=await a({IsDelete:!1});l&&n(l.map(p=>({...p,id:N()})))}finally{x(!1)}};r.useEffect(()=>{h()},[]);const t={states:{loading:u,materialsReachedOrderLimit:i}};return e.jsx(f.Provider,{value:t,children:s})},g=()=>r.useContext(f),H=()=>{const{states:{materialsReachedOrderLimit:s,loading:a}}=g(),c=[{title:"نام کالا",key:"materilName",dataIndex:"materilName",width:100,headprops:{className:"!bg-[#40849d] !text-slate-100 !text-sm"}},{title:"نام انبار",key:"wareHouseName",dataIndex:"wareHouseName",width:100,headprops:{className:"!bg-[#40849d] !text-slate-100 !text-sm"}},{title:"حد سفارش",key:"orderLimit",dataIndex:"orderLimit",width:100,headprops:{className:"!bg-[#40849d] !text-slate-100 !text-sm"}},{title:"موجودی",key:"inventoryCount",dataIndex:"inventoryCount",width:100,headprops:{className:"!bg-[#40849d] !text-slate-100 !text-sm"}}];return e.jsxs(m,{className:"h-full ml-2 rounded-md bg-slate-100",children:[e.jsx("h6",{className:"py-2 w-full text-center text-[0.9rem] font-bold bg-[#175369] text-slate-100 rounded-t-md ",children:"مواد مصرفی به حد سفارش رسیده"}),e.jsx(m,{className:"h-[full] p-1",children:e.jsx(k,{columns:c,data:s,rowKey:"id",loading:a,boxProps:{sx:{minHeight:250}}})})]})},M=()=>{const[s,a]=r.useState(!1),[c,i]=r.useState(!1),{isInRole:n,isModuleAccessible:u}=v(),x=t=>{const l=t.expectedRoles?n(void 0,t.expectedRoles):!0,p=t.expectedModule?u(t.expectedModule):!0;return l&&p},h=[{id:1,title:"فاکتور فروش",icon:e.jsx(e.Fragment,{}),color:"#b940f1",link:o.warehouse.saleFactors},{id:2,title:"رسید انبار",icon:e.jsx(e.Fragment,{}),color:"#b940f1",link:o.warehouse.bill},{id:3,title:"رسید دریافت",icon:e.jsx(e.Fragment,{}),color:"#b940f1",link:o.Accounting.receiptReceived},{id:4,title:"اعلامیه پرداخت",icon:e.jsx(e.Fragment,{}),color:"#b940f1",link:o.Accounting.paymentNotice},{id:5,title:"فهرست اسناد حسابداری",icon:e.jsx(e.Fragment,{}),color:"#b940f1",link:o.Accounting.DocumentsList},{id:6,title:"مرور حساب",icon:e.jsx(e.Fragment,{}),color:"#b940f1",link:o.Accounting.Review},{id:7,title:"گزارش",icon:e.jsx(e.Fragment,{}),color:"#b940f1",link:o.doctors.report}];return e.jsxs(e.Fragment,{children:[e.jsx(m,{className:"h-full p-4 border border-gray-200 rounded-md shadow-sm",children:e.jsx("div",{className:"w-full grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 gap-y-[41px] justify-start items-start mt-[21px]",children:h.map(t=>x(t)&&e.jsx(w,{title:t.title,style:{color:t.color},iconBox:t.icon,link:t.link,click:t!=null&&t.click?t==null?void 0:t.click:null},t.id))})}),e.jsxs(R,{children:[c&&e.jsx(P,{onClose:()=>i(!1)}),s&&e.jsx(A,{onClose:()=>a(!1)})]})]})},O=()=>{const[{userInfo:s,userType:a},{centerInfo:c}]=j(n=>[n.user,n.data]),{states:{loading:i}}=g();return e.jsxs(y,{className:"h-full overflow-y-auto scrollbar-none",children:[i&&e.jsx(C,{}),e.jsxs(d,{container:!0,className:"h-full p-1",spacing:1,children:[e.jsx(d,{item:!0,xs:12,md:4,children:e.jsxs(m,{className:"relative h-full shadow-sm rounded-xl space-y-5 p-4",children:[e.jsx("h3",{className:"hidden sm:block",children:"به نرم افزار حسابداری پارسیز خوش آمدید"}),e.jsx("h3",{className:"block sm:hidden text-sm",children:"پارسیز"}),e.jsx("p",{className:"text-xs",children:`${s==null?void 0:s.firstName} ${s==null?void 0:s.lastName} (${L(+a)})`})]})}),e.jsx(d,{item:!0,xs:12,md:8,children:e.jsx(m,{className:"flex justify-center items-center h-full bg-slate-600 text-slate-100 rounded-md min-h-[140px] shadow-sm",children:"اطلاعیه شما"})}),e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(H,{})}),e.jsx(d,{item:!0,xs:12,md:6,children:e.jsx(M,{})})]})]})},z=()=>e.jsx(F,{children:e.jsx(O,{})});export{z as default};
