import{g as W}from"./vendor-utils-BveVE6Uf.js";import{r as A}from"./vendor-charts-tGnAgELZ.js";import{Y as H,dl as Y,e as U,fR as V,g4 as J,r as N,dm as d,dn as u,z as K,aQ as R,a_ as Q,cr as X}from"./index-DdWwwZXu.js";import{r as Z,j as e,D as ee,b as te,c as ae,M as m,S as se,b7 as re,b8 as ie}from"./vendor-mui-CBBEb17G.js";import{a as s}from"./vendor-react-BBazpZul.js";import{F as le}from"./fullScreenImage-C5N4_sbA.js";import{a as oe,b as ne}from"./index-CGlH1Rd8.js";var o={},P;function ce(){if(P)return o;P=1;var g=A();Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var x=g(H()),p=Z(),f=(0,x.default)((0,p.jsx)("path",{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4 2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}),"Collections");return o.default=f,o}var de=ce();const je=W(de),ue=[{label:"نام-صعودی",value:`${d.FileName}-${u.ASC}`},{label:"نام-نزولی",value:`${d.FileName}-${u.DESC}`},{label:"تاریخ-صعودی",value:`${d.CreateDate}-${u.ASC}`},{label:"تاریخ-نزولی",value:`${d.CreateDate}-${u.DESC}`}],Ce=({onClose:g,patientId:x})=>{var S,b,y;const{GetGalleriesAsync:p,GetGalleryImageTypes:f}=Y(),{doctorId:E,clinicId:T,officeId:w}=U(t=>t.doctorData),[a,_]=s.useState(null),[z,B]=s.useState(void 0),[h,v]=s.useState(null),[F,j]=s.useState(null),[O,$]=s.useState(!0),[n,q]=s.useState(0),[i,C]=s.useState(1),[r,G]=s.useState(),I=()=>{$(!1),g()},M=async()=>{j(!0);try{const t=r?r.split("-")[0]:void 0,l=r?r.split("-")[1]:void 0,c=await p({ClinicId:T??void 0,OfficeId:w??void 0,DoctorId:E,ImageTypeId:n===0?void 0:n,PatientId:x,OrderBy:t?+t:void 0,OrderType:l?+l:void 0,PageNumber:i,PageSize:6});_(c.data)}finally{j(!1)}},k=()=>{a&&(i>=a.pagination.totalPages||C(t=>t+1))},L=()=>{a&&(i<=1||C(t=>t-1))};return s.useEffect(()=>{(async()=>{var l,c;const t=(c=(l=await f())==null?void 0:l.data)==null?void 0:c.map(D=>({label:D.title,value:D.id}));t&&t.unshift({label:"همه",value:0}),B(t)})()},[]),s.useEffect(()=>{i&&M()},[i,n,r]),e.jsxs(e.Fragment,{children:[e.jsxs(ee,{open:O,onClose:I,fullWidth:!0,maxWidth:"lg",fullScreen:!0,children:[e.jsxs(te,{id:"alert-dialog-title-2",justifyContent:"flex-start",alignItems:"center",display:"flex",borderBottom:1,borderColor:"#e6e6e6",sx:{fontSize:14,padding:"8px 24px"},children:[e.jsx(V,{color:"primary",sx:{marginRight:1}}),"مشاهده آخرین تصاویر بیمار",e.jsx("span",{style:{marginRight:"auto"},children:e.jsx(J,{onClick:I})})]}),e.jsx(ae,{className:"relative",children:e.jsxs(m,{container:!0,spacing:4,sx:{padding:"1rem"},children:[e.jsx(m,{item:!0,xs:12,children:e.jsxs(se,{direction:"row",alignItems:"center",gap:2,children:[e.jsx(N,{label:"نوع تصویر",items:z||[],value:n,onchange:t=>q(+t),sx:{maxWidth:300}}),e.jsx(N,{label:"ترتیب بر اساس",items:ue,value:r,onchange:G,sx:{maxWidth:300}}),e.jsxs("div",{className:"flex items-center gap-1 w-full",children:[e.jsx("span",{children:"تعداد تصویر :"}),e.jsx("div",{className:"p-1 px-4 border rounded-lg",children:K(((S=a==null?void 0:a.pagination)==null?void 0:S.totalCount)??0)})]})]})}),e.jsx(oe,{children:e.jsx(R,{size:"large",className:"navigate-btn",onClick:k,children:e.jsx("span",{className:"right-arrow"})})}),e.jsx(ne,{children:e.jsx(R,{size:"large",className:"navigate-btn",onClick:L,children:e.jsx("span",{className:"left-arrow"})})}),(b=a==null?void 0:a.list)==null?void 0:b.map(t=>e.jsx(m,{item:!0,sm:6,md:4,onClick:()=>v(t.image),position:"relative",children:e.jsxs(re,{sx:{maxWidth:"100%",height:300},children:[e.jsx(ie,{component:"img",src:"data:image/png;base64,"+t.image,height:300,className:"!w-full !h-full object-fill"}),e.jsxs("span",{style:{position:"absolute",bottom:-28,color:"#084173",right:"49%"},children:[Q(t.takePictureDate),"  ",t.comment]})]})})),!((y=a==null?void 0:a.list)!=null&&y.length)&&e.jsx(m,{item:!0,xs:12,children:e.jsx("div",{className:"flex justify-center items-center h-[50vh] w-full border-t ",children:"تصویری برای نمایش وجود ندارد"})}),F&&e.jsx(X,{})]})})]}),e.jsx(le,{open:h!=null,onClose:()=>v(null),base64Image:h})]})};export{je as C,Ce as L};
