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