var v=(y,f,s)=>new Promise((i,l)=>{var S=a=>{try{u(s.next(a))}catch(c){l(c)}},n=a=>{try{u(s.throw(a))}catch(c){l(c)}},u=a=>a.done?i(a.value):Promise.resolve(a.value).then(S,n);u((s=s.apply(y,f)).next())});import{J as B}from"./JsBarcode-DY0UjFhn.js";import{cG as L}from"./bootstrap-Bqxdt4iG.js";import{u as N}from"./inventories-FA5wVZqN.js";import T from"./index-BfzlM1cI.js";import{S as U}from"./index-D0CahMPl.js";import{a1 as D,L as g,aa as I,U as b,ap as p,aj as d,az as r,p as _,ay as m,a9 as x,ak as K,ai as O,F as z,aq as E}from"../jse/index-index-BUJ_4tQs.js";import"./upload-CodF4Wan.js";import"./index-BsjhuR3T.js";import"./Trigger-CftQioxV.js";import"./ResizeObserver.es-CDE7jhPe.js";import"./index-BZQGaz5w.js";import"./hasIn-DSO9yTkt.js";import"./isSymbol-sd7i9LG0.js";import"./isPlainObject-DJcwgk9A.js";import"./responsiveObserve-EPi7c3G5.js";import"./useFlexGapSupport-D8tKQOva.js";import"./_arrayIncludes-B8uzE354.js";import"./debounce-CYGc35EV.js";import"./index-BF1oQ5ik.js";import"./colors-CU1bIFfE.js";import"./roundedArrow-EYTrNAJt.js";import"./collapseMotion-DHKv0-UU.js";import"./FormItemContext-DjC4AFm9.js";import"./EyeOutlined-CSPqLYav.js";import"./CheckOutlined-CyOADmg7.js";import"./useRefs-BqD5DJTx.js";import"./useMergedState-mzgb8Um4.js";import"./statusUtils-BYtfCLmZ.js";import"./BaseInput-hWv8kcd0.js";import"./css-BPcmMxJM.js";import"./index-BgJpmtO-.js";import"./SearchOutlined-D1HVVwei.js";import"./index-BNdxtbnh.js";const V={class:"p-5"},F={class:"mb-4 flex items-center gap-3"},J={class:"text-sm text-gray-500"},R={key:1,class:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"},W={class:"flex flex-col gap-2"},j={class:"grid grid-cols-[90px_1fr] gap-y-1 border-t pt-2 text-sm"},q={class:"font-medium"},be=D({name:"InventoryBarcodesTest",__name:"inventory-barcodes-test",setup(y){const f=N(),s=g(!1),i=g([]),l=g("");I(()=>v(null,null,function*(){s.value=!0;try{const t=yield f.getList({pageSize:9999});i.value=t.items}finally{s.value=!1}}));const n=g([]);b([i,l],()=>{const t=l.value.trim().toLowerCase();n.value=t?i.value.filter(e=>{var o,w,k,h,C;return((o=e.originalSku)==null?void 0:o.toLowerCase().includes(t))||((w=e.tdSku)==null?void 0:w.toLowerCase().includes(t))||((k=e.name)==null?void 0:k.toLowerCase().includes(t))||((h=e.customerName)==null?void 0:h.toLowerCase().includes(t))||((C=e.warehouseCode)==null?void 0:C.toLowerCase().includes(t))}):i.value},{immediate:!0});const u=(t,e)=>{if(!(!t||!e))try{B(t,e,{format:"CODE128",width:1.6,height:50,displayValue:!0,fontSize:12,margin:4})}catch(o){console.error("Barcode render failed:",e,o)}},a=t=>e=>{e&&t.originalSku&&u(e,t.originalSku)},c=t=>e=>{e&&t.tdSku&&u(e,t.tdSku)};return b(n,()=>v(null,null,function*(){})),(t,e)=>(d(),p("div",V,[r("div",F,[e[1]||(e[1]=r("h2",{class:"text-xl font-semibold"},"Inventory Barcodes (Test)",-1)),r("span",J," Total: "+m(i.value.length)+" · Showing: "+m(n.value.length),1)]),_(x(T).Search,{value:l.value,"onUpdate:value":e[0]||(e[0]=o=>l.value=o),placeholder:"Search Original SKU / TD SKU / Name / Client / Warehouse","allow-clear":"",class:"mb-4 max-w-[500px]"},null,8,["value"]),_(x(U),{spinning:s.value},{default:K(()=>[!s.value&&n.value.length===0?(d(),O(x(L),{key:0,description:"No inventories"})):(d(),p("div",R,[(d(!0),p(z,null,E(n.value,o=>(d(),p("div",{key:o.id,class:"flex flex-col gap-3 rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900"},[r("div",W,[r("div",null,[e[2]||(e[2]=r("div",{class:"mb-1 text-xs font-medium uppercase text-gray-500"}," Original SKU ",-1)),(d(),p("svg",{ref_for:!0,ref:a(o),class:"w-full"},null,512))]),r("div",null,[e[3]||(e[3]=r("div",{class:"mb-1 text-xs font-medium uppercase text-gray-500"}," TD SKU ",-1)),(d(),p("svg",{ref_for:!0,ref:c(o),class:"w-full"},null,512))])]),r("div",j,[e[4]||(e[4]=r("div",{class:"text-gray-500"},"Name",-1)),r("div",q,m(o.name||"-"),1),e[5]||(e[5]=r("div",{class:"text-gray-500"},"Description",-1)),r("div",null,m(o.description||"-"),1),e[6]||(e[6]=r("div",{class:"text-gray-500"},"Warehouse",-1)),r("div",null,m(o.warehouseCode||"-")+m(o.warehouseName?` - ${o.warehouseName}`:""),1),e[7]||(e[7]=r("div",{class:"text-gray-500"},"Client",-1)),r("div",null,m(o.customerName||"-"),1)])]))),128))]))]),_:1},8,["spinning"])]))}});export{be as default};
