var v=Object.defineProperty,q=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var x=(a,t,e)=>t in a?v(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,d=(a,t)=>{for(var e in t||(t={}))M.call(t,e)&&x(a,e,t[e]);if(T)for(var e of T(t))N.call(t,e)&&x(a,e,t[e]);return a},n=(a,t)=>q(a,L(t));var D=(a,t,e)=>new Promise((f,c)=>{var g=s=>{try{u(e.next(s))}catch(l){c(l)}},k=s=>{try{u(e.throw(s))}catch(l){c(l)}},u=s=>s.done?f(s.value):Promise.resolve(s.value).then(g,k);u((e=e.apply(a,t)).next())});import{u as B,d as h,a as G,b as R}from"./vxe-table-D0Ytu0oZ.js";import{b6 as o}from"./bootstrap-Bqxdt4iG.js";import{u as E,T as F}from"./data-refresh-BZ1_-6mk.js";import{u as V}from"./stock-out-details-D39WA4nf.js";import{s as P,S as m}from"./stock-outs-C0w9Kwsh.js";import{a as w}from"./format-DSCuLcwt.js";import{_ as K}from"./customer-detail-drawer.vue_vue_type_script_setup_true_lang-D9QK3ME6.js";import{a1 as j,U as z,ap as U,aj as $,p as _,a9 as I}from"../jse/index-index-BUJ_4tQs.js";import{u as H}from"./use-drawer-CLDmRz16.js";const J={class:"flex h-full flex-col"},ie=j({name:"StockOutDetailList",__name:"stock-out-detail-list",props:{embedded:{type:Boolean,default:!1},expandMode:{type:Boolean,default:!1},stockOutId:{default:""}},setup(a,{expose:t}){const e=a,f=V(),c=E(),[g,k]=H({connectedComponent:K}),u=r=>{r.customerId&&k.setData({customerId:r.customerId}).open()},s=[...P],l=({cellValue:r,row:i})=>i.sourceType===m.DIRECT&&r||"-",C=({cellValue:r,row:i})=>i.sourceType===m.PACKING&&r||"-";let O=F.STOCK_OUT_DETAIL_LIST;e.expandMode?O="expand-stock-out-detail-list":e.embedded&&(O="embedded-stock-out-detail-list");const[A,S]=B(n(d({},R),{formOptions:n(d({},G),{schema:e.embedded?[]:[]}),gridOptions:n(d({},h),{id:O,height:e.embedded?350:void 0,maxHeight:e.expandMode?500:void 0,toolbarConfig:e.expandMode?{enabled:!1}:n(d({},h.toolbarConfig),{buttons:[]}),pagerConfig:e.expandMode?void 0:h.pagerConfig,columns:[...e.expandMode?[]:[{type:"seq",field:"_seq",title:o("page.table.common.seq"),width:"auto",align:"center"}],{field:"sourceType",title:o("page.stockOutDetails.table.sourceType"),width:"auto",align:"center",cellRender:{name:"CellStatus",props:{options:s}}},{field:"customerName",title:o("page.stockOuts.table.customer"),width:"auto",align:"left",cellRender:{name:"CellFkLink",props:{nameField:"customerName",onClick:u}}},{field:"inventoryOriginalSku",title:o("page.stockOutDetails.table.inventoryOriginalSku"),width:"auto",align:"left",formatter:l},{field:"inventoryTdSku",title:o("page.stockOutDetails.table.inventoryTdSku"),width:"auto",sortable:!0,align:"left",formatter:l},{field:"inventoryName",title:o("page.stockOutDetails.table.inventoryName"),width:"auto",align:"left",formatter:l},{field:"locationCode",title:o("page.stockOutDetails.table.locationCode"),width:"auto",sortable:!0,align:"center",formatter:l},{field:"qty",title:o("page.stockOutDetails.table.qty"),width:"auto",align:"center",formatter:l},{field:"packingOrderCode",title:o("page.stockOutDetails.table.packingOrderCode"),width:"auto",align:"left",formatter:C},{field:"packingOrderType",title:o("page.stockOutDetails.table.packingOrderType"),width:"auto",align:"center",formatter:C},{field:"createdAt",title:o("page.table.common.createdAt"),width:"auto",sortable:!0,align:"center",formatter:w},{field:"updatedAt",title:o("page.table.common.updatedAt"),width:"auto",sortable:!0,align:"center",formatter:w}],sortConfig:{remote:!0,trigger:"default",defaultSort:{field:"createdAt",order:"desc"}},proxyConfig:{autoLoad:!e.embedded&&!e.expandMode,ajax:{query:de=>D(null,[de],function*({page:r,sort:i}){const p={page:r.currentPage,pageSize:r.pageSize};e.stockOutId&&(p.stockOutId=e.stockOutId),i!=null&&i.field&&(p.sortBy=i.field,p.sortOrder=i.order);const y=yield f.getList(p);return y.items=y.items.map(b=>n(d({},b),{sourceType:b.sourceType||(b.packingOrderId?m.PACKING:m.DIRECT)})),y})},sort:!0}})}));return t({query:()=>D(null,null,function*(){return S.query()})}),z(()=>c.stockOutDetailsVersion,()=>{S.query()}),(r,i)=>($(),U("div",J,[_(I(A),{class:"flex-1"}),_(I(g))]))}});export{ie as _};
