import{a6 as F,C as y,aA as k,bt as D,ac as C,a8 as B,N as a,K as $,E as b,O as R,P as s,am as v,u as o,D as V,Q as u,R as l,S as N,F as I,L as O}from"./vendor-BGtMsOoo.js";import{g as T}from"./index-CRze-aDK.js";import{u as W,C as j}from"./usePurchaseRequestDocuments-Ccsx5AI0.js";function z(){const{files:x,fetchFileOptions:P,fileOptions:m,processing:p,processDocuments:d}=W(),{storeId:_,cultureName:f,currencyCode:c,userId:h}=T,{mutate:g}=F(j);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:P,createPurchaseRequestFromDocuments:e}}const E={key:0},L={class:"mb-3 text-sm"},A={class:"flex justify-end border-t py-3"},M={class:"text-sm max-md:text-center"},S={class:"row-span-2"},U={class:"mb-3 hidden text-sm md:block"},K={class:"items-stretch"},J=y({__name:"from-file",setup(x){const m=k(D).smaller("lg"),p=C(),{files:d,fileOptions:_,fetchFileOptions:f,creatingPurchaseRequest:c,createPurchaseRequestFromDocuments:h}=z();async function g(e){const r=await h(e);p.push({name:"PurchaseRequest",params:{purchaseRequestId:r}})}return B(async()=>{await Promise.all([f()])}),(e,r)=>{const q=a("VcLoaderWithText"),t=a("VcButton"),n=a("VcImage"),i=a("VcFileUploader"),w=a("VcWidget");return b(),$(w,{title:o(m)?void 0:e.$t("purchase_request.from_file.title"),size:"md"},{default:R(()=>[s("div",{class:v({"grid gap-4 md:grid-cols-[auto_290px]":!o(c)})},[o(c)?(b(),V("section",E,[s("p",L,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",A,[u(t,{"min-width":"9rem"},{default:R(()=>[N(l(e.$t("purchase_request.from_file.processing.cancel")),1)]),_:1})])])):(b(),V(I,{key:1},[s("header",M,l(e.$t("purchase_request.from_file.upload.message")),1),s("aside",S,[s("figure",null,[s("figcaption",U,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,O({class:"h-full"},o(_),{files:o(d),onAddFiles:g}),null,16,["files"])])],64))],2)]),_:1},8,["title"])}}});export{J as _};
//# sourceMappingURL=from-file.vue_vue_type_style_index_0_lang-DtTPVP8O.js.map
