import{bQ as A,bR as N,ao as j,r as h,j as r,b as t,Q as C,B as o,q as i,_ as I,$ as n,C as R,G as x,E as w,a3 as z,H as _}from"./index-DlNZgIG9.js";import{s as W,c as E,l as T,A as P}from"./ArtDesignApi-xMaPHw7i.js";import{d as S}from"./PersonOutline-Zh9Ye6JU.js";import"./CloseRounded-DVE_IeBy.js";import"./CancelRounded-CCHjO5d1.js";import"./AutorenewRounded-BmzbbvAo.js";var d={},H=A;Object.defineProperty(d,"__esModule",{value:!0});var c=d.default=void 0,M=H(N()),s=j;c=d.default=(0,M.default)((0,s.jsxs)("g",{fillRule:"evenodd",children:[(0,s.jsx)("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H4V5h16z"}),(0,s.jsx)("path",{d:"M19.41 10.42 17.99 9l-3.17 3.17-1.41-1.42L12 12.16 14.82 15zM5 7h5v2H5zm0 4h5v2H5zm0 4h5v2H5z"})]}),"FactCheckOutlined");function G(){const[p,f]=h.useState(""),{data:a=[],isLoading:g}=W({kind:p||void 0,size:200}),{lightboxProps:b,openAt:v}=E(),u=h.useMemo(()=>a.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(" · ")})),[a]);return r(o,{sx:{p:{xs:1.5,md:2},width:"100%"},children:[r(C,{children:[r(o,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:1.5,mb:2},children:[r(i,{variant:"h6",fontWeight:800,sx:{display:"flex",alignItems:"center",gap:1},children:[t(c,{color:"primary"})," Approval Acknowledgement Images"]}),r(I,{size:"small",exclusive:!0,value:p,onChange:(e,l)=>f(l??""),children:[t(n,{value:"",children:"All"}),t(n,{value:"APPROVAL",children:"Approvals"}),t(n,{value:"REJECTION",children:"Rejections"})]})]}),g?t(o,{sx:{display:"flex",justifyContent:"center",py:6},children:t(R,{})}):a.length===0?r(o,{sx:{py:6,textAlign:"center",color:"text.secondary"},children:[t(c,{sx:{fontSize:48,opacity:.35,mb:1}}),t(i,{children:"No acknowledgement proof images found."})]}):t(x,{container:!0,spacing:2,children:a.map((e,l)=>{const m=e.kind!=="REJECTION",y=u.findIndex(k=>k.src===e.publicUrl);return t(x,{item:!0,xs:12,sm:6,md:4,lg:3,children:r(o,{sx:{borderRadius:2,overflow:"hidden",border:"1px solid",borderColor:"divider",height:"100%","&:hover .aa-overlay":{opacity:1}},children:[r(o,{sx:{position:"relative",height:170,bgcolor:"#f4f6f8"},children:[e.publicUrl?t(o,{component:"img",src:e.publicUrl,alt:e.fileName||"acknowledgement proof",sx:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):t(o,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:t(i,{variant:"caption",color:"text.secondary",children:"No preview"})}),e.publicUrl&&t(o,{className:"aa-overlay",onClick:()=>v(u,Math.max(0,y)),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:t(T,{sx:{color:"#fff",fontSize:34}})}),t(w,{label:m?"Approval":"Rejection",size:"small",color:m?"success":"error",sx:{position:"absolute",top:8,left:8,fontWeight:700}})]}),r(o,{sx:{p:1.25},children:[t(i,{variant:"body2",fontWeight:700,noWrap:!0,title:e.artNumber,children:e.artNumber||`ART #${e.artDesignId??""}`}),r(i,{variant:"caption",color:"text.secondary",sx:{display:"flex",alignItems:"center",gap:.5},noWrap:!0,children:[t(S,{sx:{fontSize:14}})," ",e.customerName||e.leadName||"—"]}),e.leadNumber&&t(i,{variant:"caption",color:"text.secondary",display:"block",noWrap:!0,children:e.leadNumber}),e.salesPersonName&&r(i,{variant:"caption",color:"text.secondary",display:"block",noWrap:!0,children:["Sales: ",e.salesPersonName]}),e.remarks&&t(z,{title:e.remarks,children:r(i,{variant:"caption",color:"text.secondary",display:"block",noWrap:!0,children:["“",e.remarks,"”"]})}),e.createdAt&&t(i,{variant:"caption",color:"text.disabled",display:"block",children:_(e.createdAt)})]})]})},e.id??l)})})]}),t(P,{...b})]})}export{G as default};
