import{aa as y,K as F,aI as k,bz as D,ag as B,ac as C,S as a,P as $,M as b,T as P,U as s,aq as v,b as o,L as w,V as u,W as l,X as I,N,Q as T}from"./vendor-bSWkQivH.js";import{g as W}from"./index-Dqv5IkpS.js";import{u as z,C as O}from"./usePurchaseRequestDocuments-BbQkBP-v.js";function j(){const{files:x,fetchFileOptions:V,fileOptions:m,processing:p,processDocuments:d}=z(),{storeId:_,cultureName:f,currencyCode:c,userId:h}=W,{mutate:g}=y(O);async function e(r){return await d(r,async q=>{var n,i;const t=await g({command:{documentUrls:q,storeId:_,cultureName:f,currencyCode:c,userId:h}});return(i=(n=t==null?void 0:t.data)==null?void 0:n.createPurchaseRequestFromDocuments)==null?void 0:i.id})}return{creatingPurchaseRequest:p,files:x,fileOptions:m,fetchFileOptions:V,createPurchaseRequestFromDocuments:e}}const L={key:0},M={class:"mb-3 text-sm"},U={class:"flex justify-end border-t py-3"},E={class:"text-sm max-md:text-center"},S={class:"row-span-2"},A={class:"mb-3 hidden text-sm md:block"},K={class:"items-stretch"},H=F({__name:"from-file",setup(x){const m=k(D).smaller("lg"),p=B(),{files:d,fileOptions:_,fetchFileOptions:f,creatingPurchaseRequest:c,createPurchaseRequestFromDocuments:h}=j();async function g(e){const r=await h(e);p.push({name:"PurchaseRequest",params:{purchaseRequestId:r}})}return C(async()=>{await Promise.all([f()])}),(e,r)=>{const q=a("VcLoaderWithText"),t=a("VcButton"),n=a("VcImage"),i=a("VcFileUploader"),R=a("VcWidget");return b(),$(R,{title:o(m)?void 0:e.$t("purchase_request.from_file.title"),size:"md"},{default:P(()=>[s("div",{class:v({"grid gap-4 md:grid-cols-[auto_290px]":!o(c)})},[o(c)?(b(),w("section",L,[s("p",M,l(e.$t("purchase_request.from_file.processing.message")),1),u(q,{centered:"",text:e.$t("purchase_request.from_file.processing.loading_message"),class:"mb-6 min-h-[230px] w-full border border-neutral-200 bg-neutral-50"},null,8,["text"]),s("nav",U,[u(t,{"min-width":"9rem"},{default:P(()=>[I(l(e.$t("purchase_request.from_file.processing.cancel")),1)]),_:1})])])):(b(),w(N,{key:1},[s("header",E,l(e.$t("purchase_request.from_file.upload.message")),1),s("aside",S,[s("figure",null,[s("figcaption",A,l(e.$t("purchase_request.from_file.upload.examples.title")),1),u(n,{id:"example",src:"documents-example.webp",alt:e.$t("purchase_request.from_file.upload.examples.alt"),class:"h-[230px] md:object-cover md:object-left",lazy:""},null,8,["alt"])])]),s("section",K,[u(i,T({class:"h-full"},o(_),{files:o(d),onAddFiles:g}),null,16,["files"])])],64))],2)]),_:1},8,["title"])}}});export{H as _};
//# sourceMappingURL=from-file.vue_vue_type_style_index_0_lang-gredbb71.js.map
