var p=(k,d,u)=>new Promise((t,m)=>{var f=c=>{try{v(u.next(c))}catch(i){m(i)}},b=c=>{try{v(u.throw(c))}catch(i){m(i)}},v=c=>c.done?t(c.value):Promise.resolve(c.value).then(f,b);v((u=u.apply(k,d)).next())});import{b6 as o}from"./bootstrap-Bqxdt4iG.js";import{u as A}from"./inventory-details-CyykCtw9.js";import{f as y}from"./format-DSCuLcwt.js";import{C as w}from"./index-0OckuOQU.js";import{D as n}from"./index--N1ITuK7.js";import{S as h}from"./index-D0CahMPl.js";import{a1 as C,L as D,U as x,E as S,ai as T,aj as g,a9 as e,ak as a,p as l,ap as I,an as Q,ax as s,ay as r}from"../jse/index-index-BUJ_4tQs.js";import{u as O}from"./use-drawer-CLDmRz16.js";const N={key:0},V={key:1,class:"text-center text-gray-500"},q=C({__name:"inventory-detail-item-drawer",setup(k){const d=D(""),u=D(!1),t=D(null),m=A(),[f,b]=O({title:o("page.inventoryDetails.drawer.detailTitle"),footer:!1,onOpenChange:i=>p(null,null,function*(){if(i){const _=b.getData();_&&(d.value=_.inventoryDetailId)}}),onClosed:()=>{d.value="",t.value=null}});x(()=>d.value,i=>p(null,null,function*(){i&&(yield v())}));const v=()=>p(null,null,function*(){if(d.value){u.value=!0;try{const i=yield m.getDetail(d.value);t.value=i}catch(i){console.error("Failed to fetch inventory detail:",i)}finally{u.value=!1}}}),c=S(()=>1);return(i,_)=>(g(),T(e(f),{class:"w-[520px]"},{default:a(()=>[l(e(h),{spinning:u.value},{default:a(()=>[t.value?(g(),I("div",N,[l(e(w),null,{default:a(()=>[l(e(n),{column:c.value,bordered:"",size:"small"},{default:a(()=>[l(e(n).Item,{label:e(o)("page.inventoryDetails.table.inventory")},{default:a(()=>[s(r(t.value.inventoryName||t.value.inventoryTdSku||"-"),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.location")},{default:a(()=>[s(r(t.value.locationCode||"-"),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.stockedInAt")},{default:a(()=>[s(r(e(y)(t.value.stockedInAt)),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.preAlertQty")},{default:a(()=>[s(r(t.value.preAlertQty),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.estimatedArrivalTime")},{default:a(()=>[s(r(e(y)(t.value.estimatedArrivalTime)),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.stockInQty")},{default:a(()=>[s(r(t.value.stockInQty),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.toPackQty")},{default:a(()=>[s(r(t.value.toPackQty),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.packedQty")},{default:a(()=>[s(r(t.value.packedQty),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.toStockOutQty")},{default:a(()=>[s(r(t.value.toStockOutQty),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.inventoryDetails.table.stockOutQty")},{default:a(()=>[s(r(t.value.stockOutQty),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.table.common.createdAt")},{default:a(()=>[s(r(e(y)(t.value.createdAt)),1)]),_:1},8,["label"]),l(e(n).Item,{label:e(o)("page.table.common.updatedAt")},{default:a(()=>[s(r(e(y)(t.value.updatedAt)),1)]),_:1},8,["label"])]),_:1},8,["column"])]),_:1})])):Q("",!0),!t.value&&!u.value?(g(),I("div",V,r(e(o)("page.inventoryDetails.detail.notFound")),1)):Q("",!0)]),_:1},8,["spinning"])]),_:1}))}});export{q as _};
