import{j as e,S as u,M as h,B as g,c as j}from"./vendor-mui-CBBEb17G.js";import{B as k}from"./index-BkhbTDKf.js";import{bL as p,ao as I,aT as D,aX as S,z as b,e as y,dP as v,R as P}from"./index-IP_FWtso.js";import{j as w,a as d,N as T,u as E}from"./vendor-react-BBazpZul.js";import{u as x}from"./index-CYDUrP02.js";import"./vendor-utils-BveVE6Uf.js";import{S as N}from"./index-D7-0uPSw.js";import"./vendor-charts-tGnAgELZ.js";const _=()=>e.jsx(e.Fragment,{}),R=()=>{const{states:{nationalCode:a,trackingCode:s},handlers:{setNationalCode:i,setTrackingCode:n},functions:{getTaminDeliverPrescribeList:o}}=x(),[t,c]=w(),[f,m]=d.useState(!1),C=async()=>{!a.length||!s.length||(m(!0),c(r=>(r.set("nationalCode",a),r.set("trackingCode",s),r)),o(a,s))};return d.useEffect(()=>{if(!t)return;if(f){m(!1);return}const r=t.get("nationalCode"),l=t.get("trackingCode");!r||!l||(i(r),n(l),o(r,l))},[t]),e.jsxs(u,{className:"relative",children:[e.jsx(h,{container:!0,spacing:1,children:e.jsx(h,{xs:12,sm:6,children:e.jsxs(u,{direction:"row",justifyContent:"flex-start",alignItems:"end",spacing:1,px:1,children:[e.jsx(p,{labelText:"کد ملی",variant:"outlined",fullWidth:!0,required:!0,inputProps:{maxLength:12},value:a,onChange:i}),e.jsx(p,{labelText:"کد رهگیری",variant:"outlined",fullWidth:!0,required:!0,value:s,onChange:n}),e.jsx(I,{variant:"contained",color:"primary",onClick:()=>C(),children:e.jsx(D,{})})]})})}),e.jsx("span",{className:"absolute !top-6 left-2 z-10 p-1 !text-sm border rounded-lg border-blue-400",children:e.jsx(T,{to:"deliverd-paraclinics",children:"نسخه های ثبت شده"})})]})},L=()=>{const{states:{taminDeliverPrescribeList:a,loading:s}}=x(),i=E(),n=t=>{i(`${t.eprsC_ID}`)},o=[{key:"eprsC_ID",dataIndex:"eprsC_ID",title:"شناسه نسخه",width:100,render:t=>b(t)??"-"},{key:"prescdate",dataIndex:"prescdate",title:"تاریخ موثرانجام",width:100,render:t=>`${t.slice(0,4)}/${t.slice(4,6)}/${t.slice(6)}`},{key:"partypedesc",dataIndex:"partypedesc",title:"نوع پاراکلینیک",width:100},{key:"nationalcode",dataIndex:"nationalcode",title:"کد ملی بیمار",width:100},{key:"doC_MDID",dataIndex:"doC_MDID",title:"کد نظام پزشک معالج",width:150},{key:"doC_NAME",dataIndex:"doC_NAME",title:"نام پزشک معالج",width:150},{key:"doC_SPEC",dataIndex:"doC_SPEC",title:"تخصص پزشک معالج",width:150},{key:"comments",dataIndex:"comments",title:"توضیحات",width:150},{key:"refeR_REASON",dataIndex:"refeR_REASON",title:"دلیل ارجاع",width:100},{key:"details",dataIndex:"details",title:"جزئیات",width:120,render:(t,c)=>e.jsx(g,{size:"small",color:"info",variant:"contained",onClick:()=>n(c),children:"جزییات"})}];return e.jsx(S,{rowKey:"eprsC_ID",loading:s,columns:o,data:a||[],boxProps:{sx:{height:"75vh"}}})},A=()=>e.jsxs(u,{spacing:1,children:[e.jsx(R,{}),e.jsx(L,{}),e.jsx(_,{})]}),M=()=>{const[a,s]=d.useState(!1),{functions:{isLoggedIn:i}}=x(),{taminAuthStatus:n}=y(t=>t.doctorData),o=async()=>{if(!n)return await i();if(new Date(n.sessionExpireDate)<new Date)return await i()};return d.useEffect(()=>{a||(s(!0),o().then(()=>s(!1)))},[]),a?e.jsx(j,{className:"min-h-[200px] fixed inset-0",children:e.jsx(v,{})}):e.jsx(A,{})},W=()=>e.jsxs(N,{children:[e.jsx("div",{className:"",children:e.jsx(k,{prevRoutes:[{path:"/",title:"داشبورد"},{path:`/${P.deliverPrescription.home}`,title:"نسخه پیچی"}],currentRoute:"نسخه پیچی تامین اجتماعی"})}),e.jsx(M,{})]});export{W as default};
