import{r as p,j as t,b as r,Q as v,B as o,q as i,_ as k,$ as a,C as A,G as m,E as N,a7 as C,H as w}from"./index-ktJf6c6X.js";import{d as u}from"./FactCheckOutlined-227Jsj7W.js";import{a as I,b as j,d as W,A as T}from"./ArtDesignApi-B1-lHZIT.js";import{d as R}from"./PersonOutline-CqOBkkml.js";import"./CloseRounded-B2Rs8i4L.js";import"./AutorenewRounded-qgqBmVPt.js";function _(){const[s,h]=p.useState(""),{data:l=[],isLoading:x}=I({kind:s||void 0,size:200}),{lightboxProps:f,openAt:g}=j(),c=p.useMemo(()=>l.filter(e=>!!e.publicUrl).map(e=>({src:e.publicUrl,fileName:e.fileName,status:e.kind,caption:[e.artNumber,e.customerName||e.leadName].filter(Boolean).join(" · ")})),[l]);return t(o,{sx:{p:{xs:1.5,md:2},width:"100%"},children:[t(v,{children:[t(o,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:1.5,mb:2},children:[t(i,{variant:"h6",fontWeight:800,sx:{display:"flex",alignItems:"center",gap:1},children:[r(u,{color:"primary"})," Approval Acknowledgement Images"]}),t(k,{size:"small",exclusive:!0,value:s,onChange:(e,n)=>h(n??""),children:[r(a,{value:"",children:"All"}),r(a,{value:"APPROVAL",children:"Approvals"}),r(a,{value:"REJECTION",children:"Rejections"})]})]}),x?r(o,{sx:{display:"flex",justifyContent:"center",py:6},children:r(A,{})}):l.length===0?t(o,{sx:{py:6,textAlign:"center",color:"text.secondary"},children:[r(u,{sx:{fontSize:48,opacity:.35,mb:1}}),r(i,{children:"No acknowledgement proof images found."})]}):r(m,{container:!0,spacing:2,children:l.map((e,n)=>{const d=e.kind!=="REJECTION",b=c.findIndex(y=>y.src===e.publicUrl);return r(m,{item:!0,xs:12,sm:6,md:4,lg:3,children:t(o,{sx:{borderRadius:2,overflow:"hidden",border:"1px solid",borderColor:"divider",height:"100%","&:hover .aa-overlay":{opacity:1}},children:[t(o,{sx:{position:"relative",height:170,bgcolor:"#f4f6f8"},children:[e.publicUrl?r(o,{component:"img",src:e.publicUrl,alt:e.fileName||"acknowledgement proof",sx:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):r(o,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:r(i,{variant:"caption",color:"text.secondary",children:"No preview"})}),e.publicUrl&&r(o,{className:"aa-overlay",onClick:()=>g(c,Math.max(0,b)),sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"rgba(15,20,28,0.42)",opacity:0,transition:"opacity .18s",cursor:"pointer"},children:r(W,{sx:{color:"#fff",fontSize:34}})}),r(N,{label:d?"Approval":"Rejection",size:"small",color:d?"success":"error",sx:{position:"absolute",top:8,left:8,fontWeight:700}})]}),t(o,{sx:{p:1.25},children:[r(i,{variant:"body2",fontWeight:700,noWrap:!0,title:e.artNumber,children:e.artNumber||`ART #${e.artDesignId??""}`}),t(i,{variant:"caption",color:"text.secondary",sx:{display:"flex",alignItems:"center",gap:.5},noWrap:!0,children:[r(R,{sx:{fontSize:14}})," ",e.customerName||e.leadName||"—"]}),e.leadNumber&&r(i,{variant:"caption",color:"text.secondary",display:"block",noWrap:!0,children:e.leadNumber}),e.salesPersonName&&t(i,{variant:"caption",color:"text.secondary",display:"block",noWrap:!0,children:["Sales: ",e.salesPersonName]}),e.remarks&&r(C,{title:e.remarks,children:t(i,{variant:"caption",color:"text.secondary",display:"block",noWrap:!0,children:["“",e.remarks,"”"]})}),e.createdAt&&r(i,{variant:"caption",color:"text.disabled",display:"block",children:w(e.createdAt)})]})]})},e.id??n)})})]}),r(T,{...f})]})}export{_ as default};
