import{r as g,b as n,ao as A,T as I,j as o,C as E,H as N,a6 as S}from"./index-BiWH3VAt.js";import{a as x}from"./StockTransferApi-BLRQFWGd.js";const L=["DISPATCHED","IN_TRANSIT","PARTIALLY_RECEIVED"],C=({value:t,onChange:p,statusFilter:a=L,branchId:u,disabled:T,required:i,label:m="Transfer Number",size:f="small"})=>{const{data:s,isLoading:c,isFetching:d}=x({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 A("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(I,{...e,label:m,required:i,error:i&&!t,InputProps:{...e.InputProps,endAdornment:o(N,{children:[c||d?n(E,{size:16}):null,e.InputProps.endAdornment]})}})})};export{C as T};
