import{r as g,b as n,T as A,j as o,C as I,J as E,aL as N,Q as S}from"./index-CYy8zBsj.js";import{a as L}from"./StockTransferApi-Dyk9jtsn.js";const x=["DISPATCHED","IN_TRANSIT","PARTIALLY_RECEIVED"],C=({value:t,onChange:p,statusFilter:a=x,branchId:u,disabled:T,required:i,label:m="Transfer Number",size:f="small"})=>{const{data:s,isLoading:c,isFetching:d}=L({page:0,size:200,toBranch:u,sort:"created_date,desc"}),h=g.useMemo(()=>{const e=new Set(a);return((s==null?void 0:s.content)??[]).filter(r=>!!r.status&&e.has(r.status))},[s,a]);return n(S,{size:f,options:h,loading:c||d,disabled:T,getOptionLabel:e=>e.transferNo??`#${e.id}`,isOptionEqualToValue:(e,r)=>e.id===r.id,value:t,onChange:(e,r)=>p(r),renderOption:(e,r)=>{var l;return N("li",{...e,key:r.id},o("div",{children:[n("div",{style:{fontWeight:600},children:r.transferNo}),o("div",{style:{fontSize:11,color:"#64748B"},children:[r.fromBranchName??"—"," → ",r.toBranchName??"—"," · ",(l=r.status)==null?void 0:l.replace(/_/g," ")]})]}))},renderInput:e=>n(A,{...e,label:m,required:i,error:i&&!t,InputProps:{...e.InputProps,endAdornment:o(E,{children:[c||d?n(I,{size:16}):null,e.InputProps.endAdornment]})}})})};export{C as T};
