import{j as e,S as i,W as f,M as d}from"./vendor-mui-CBBEb17G.js";import{B as j}from"./index-BkhbTDKf.js";import{u as m,a as b,R}from"./addModal-CoJrFm-_.js";import{dD as S,c4 as C,et as I,bx as g,aX as k,z as u,bc as y,e as N,c$ as T,aP as w,ao as h,I as x}from"./index-IP_FWtso.js";import{a as p}from"./vendor-react-BBazpZul.js";import{T as F}from"./index-Dz6vPtCj.js";import"./vendor-utils-BveVE6Uf.js";import{S as v}from"./index-D7-0uPSw.js";import"./vendor-charts-tGnAgELZ.js";const D=()=>{const{handlers:{handleDelete:r},states:{selectedItem:t},actions:{setSelectedItem:a}}=m(),[o,s]=p.useState(!1),l=()=>{s(!1),a(void 0)},n=[{id:1,label:"افزودن",icon:e.jsx(C,{fontSize:"large",color:"success"}),onClick:()=>s(!0),disabled:!1,className:""},{id:2,label:"ویرایش",icon:e.jsx(I,{fontSize:"large",color:t?"primary":"inherit"}),onClick:()=>s(!0),disabled:!t,className:""},{id:3,label:"حذف",icon:e.jsx(g,{fontSize:"large",color:t?"error":"inherit"}),onClick:r,disabled:!t,className:""}];return e.jsxs(i,{direction:"row",paddingY:1,spacing:1,children:[n.map(c=>e.jsx(S,{onClick:c.onClick,disabled:c.disabled,children:e.jsx(f,{title:c.label,placement:"top",children:c.icon})},c.id)),o&&e.jsx(b,{onClose:l})]})},E=()=>{const{states:{dataList:r,loading:t},actions:{setSelectedItem:a}}=m(),o=[{title:"ردیف",key:"index",width:30,render:(s,l,n)=>u(n+1)},{title:"کد",key:"customId",dataIndex:"customId",width:50,render:s=>s?u(s):"-"},{title:"عنوان",key:"title",dataIndex:"title",width:200},{title:"توضیحات",key:"comment",dataIndex:"comment",width:200,render:s=>s?e.jsx(y,{title:s,maxLengthValue:20}):"-"}];return e.jsx(i,{className:"!h-[78dvh]",children:e.jsx(k,{columns:o,data:r,rowKey:"id",loading:t,onClick:s=>a(s)})})},P=()=>{const{userType:r}=N(n=>n.user),{handlers:{fetchData:t}}=m(),[a,o]=p.useState(""),s=()=>{t(a)},l=()=>{o(""),t("")};return e.jsxs(i,{className:"h-full overflow-y-auto p-2 pb-10 border-l",spacing:1,children:[e.jsx(F,{className:+r===T.accountant?"!bg-[#b0d8e7]":"",children:"نام"}),e.jsx(w,{label:"علت ...",value:a,onChange:o}),e.jsxs(i,{component:"form",direction:"row",justifyContent:"center",gap:1,children:[e.jsx(h,{fullWidth:!0,startIcon:e.jsx(x.SearchIcon,{}),onClick:s,children:"جستجو"}),e.jsx(h,{fullWidth:!0,startIcon:e.jsx(x.RefreshIcon,{}),onClick:l,children:"بازنشانی"})]})]})},B=()=>e.jsxs(d,{container:!0,xs:12,spacing:1,className:"!h-full",children:[e.jsx(d,{item:!0,xs:12,sm:2,children:e.jsx(P,{})}),e.jsxs(d,{item:!0,xs:12,sm:10,spacing:1,children:[e.jsx(D,{}),e.jsx(E,{})]})]}),X=()=>e.jsxs(v,{className:"!px-4 !py-2",children:[e.jsx(j,{prevRoutes:[{path:"/",title:"داشبورد"}],currentRoute:"علت مراجعه"}),e.jsx(R,{children:e.jsx(B,{})})]});export{X as default};
