import{j as i,S as s,o as w,B as S}from"./vendor-mui-CBBEb17G.js";import{B as v}from"./index-BkhbTDKf.js";import{at as _,aP as R,be as p,aA as x,aQ as T,I as u,aX as N,ao as $,z as o,J as B,R as m}from"./index-IP_FWtso.js";import{u as b,a as r}from"./vendor-react-BBazpZul.js";import{u as A}from"./index-BO-Np-or.js";import{S as U}from"./index-D7-0uPSw.js";import"./vendor-utils-BveVE6Uf.js";import"./vendor-charts-tGnAgELZ.js";const E=()=>{const{getDeliveredParaclinicsAsync:g,deleteRegisteredPrescAsync:h}=A(),l=b(),y=_(),[I,d]=r.useState(!1),[f,C]=r.useState([]),[t,n]=r.useState(),c=async()=>{try{d(!0);const{data:e}=await g({nationalCode:t==null?void 0:t.nationalCode,from:t==null?void 0:t.from,upTo:t==null?void 0:t.upTo});e&&C(e)}finally{d(!1)}},j=e=>{l(`${e.registeR_ID}`)},D=e=>{y({content:"آیا از حذف این نسخه اطمینان دارید؟"}).then(async()=>{const{data:a}=await h(e);a!=null&&a.data&&(B.success("نسخه با موفقیت حذف شد"),c())}).catch(()=>{})},k=[{key:"registeR_ID",dataIndex:"registeR_ID",title:"شماره ثبت نسخه",render:e=>o(e)??"-",width:100},{key:"eprsC_ID",dataIndex:"eprsC_ID",title:"شناسه نسخه",render:e=>o(e)??"-",width:100},{key:"partypedesc",dataIndex:"partypedesc",title:"نوع نسخه",width:150},{key:"prescdate",dataIndex:"prescdate",title:"تاریخ تجویز نسخه",width:100,render:e=>e?`${e.slice(0,4)}/${e.slice(4,6)}/${e.slice(6)}`:"-"},{key:"regdate",dataIndex:"regdate",title:"تاریخ ثبت نسخه",width:100,render:e=>e?`${e.slice(0,4)}/${e.slice(4,6)}/${e.slice(6)}`:"-"},{key:"nationalCode",dataIndex:"nationalCode",title:"کد ملی بیمار",width:100,render:e=>o(e)??"-"},{key:"doC_FULL_NAME",dataIndex:"doC_FULL_NAME",title:"نام پزشک معالج",width:150},{key:"delete",dataIndex:"registeR_ID",title:"حذف نسخه",width:100,render:e=>i.jsx(w,{color:"error",size:"small",className:"!m-0 !p-0",onClick:()=>D(e),children:i.jsx(u.CloseIcon,{})})},{key:"details",dataIndex:"details",title:"جزئیات",width:120,render:(e,a)=>i.jsx(S,{size:"small",color:"info",variant:"contained",onClick:()=>j(a),children:"جزییات"})}];return i.jsxs(s,{className:"h-[80vh]",spacing:1,children:[i.jsxs(s,{direction:"row",alignItems:"center",spacing:1,children:[i.jsx(R,{label:"کد ملی بیمار",value:(t==null?void 0:t.nationalCode)??"",onChange:e=>n(a=>({...a,nationalCode:e})),fullWidth:!1,focused:!0,className:"!w-48"}),i.jsx(p,{label:"از تاریخ",value:t==null?void 0:t.from,onChange:e=>n(a=>({...a,from:x(e)}))}),i.jsx(p,{label:"تا تاریخ",value:t==null?void 0:t.upTo,onChange:e=>n(a=>({...a,upTo:x(e)}))}),i.jsx(T,{color:"primary",onClick:()=>c(),children:i.jsx(u.SearchIcon,{})})]}),i.jsx(N,{rowKey:"registeR_ID",columns:k,data:f,loading:I}),i.jsx(s,{direction:"row",alignItems:"center",justifyContent:"center",spacing:1,children:i.jsx($,{color:"primary",className:"!w-32",onClick:()=>l(-1),children:"بازگشت"})})]})},P=()=>i.jsxs(U,{children:[i.jsx("div",{className:"",children:i.jsx(v,{prevRoutes:[{path:"/",title:"داشبورد"},{path:`/${m.deliverPrescription.home}`,title:"نسخه پیچی"},{path:`/${m.deliverPrescription.taminDeliverPrescribe}`,title:"نسخه پیچی تامین اجتماعی"}],currentRoute:"نسخه های ثبت شده"})}),i.jsx(E,{})]});export{P as default};
