import{U as n,R as _,O as f,V as e,Z as l,Y as r,X as p,M as Q,r as B,ac as M,E as N,aa as b,a8 as x,e as y,W as F,ai as D}from"./vendor-CsGITfgk.js";import{d as A,w as W,aY as E,e as I,a4 as O,aZ as P,g as R,a_ as U,a$ as Y}from"./index-GCDRvGOr.js";const Z={};function G(o,d){const a=n("VcButton"),c=n("VcModal");return f(),_(c,{title:o.$t("common.titles.remove_products"),variant:"danger",icon:"warning"},{actions:e(({close:s})=>[p(a,{class:"mx-auto",onClick:m=>s()},{default:e(()=>[l(r(o.$t("common.buttons.ok")),1)]),_:1},8,["onClick"])]),default:e(()=>[l(" "+r(o.$t("common.messages.cart_contains_deleted_products")),1)]),_:1},8,["title"])}const S=A(Z,[["render",G]]),T={class:"mb-5 text-xs font-normal text-neutral-400"},z=Q({__name:"create-quote-from-cart",emits:["lockCart","unlockCart"],setup(o,{emit:d}){const a=d,c=W(),{cart:s,refetch:m}=E(),u=B(!1),{client:C}=M(),g=D(),{openModal:V}=I(),v=N(()=>s.value?.items?.some(t=>!t.product)),{mutate:h}=b(P,{refetchQueries:()=>U(C,[Y.Query.GetFullCart])}),{isAuthenticated:k}=O();async function q(){if(v.value){V({component:S});return}u.value=!0,a("lockCart");const i=(await h({command:{cartId:s.value.id,comment:""}}))?.data?.createQuoteFromCart;i?await g.push({name:"EditQuote",params:{quoteId:i.id}}):c.error({text:R.i18n.global.t("quotes.errors.creating_quote_error"),duration:15e3,single:!0}),await m(),a("unlockCart"),u.value=!1}return(t,i)=>{const w=n("VcButton"),$=n("VcWidget");return y(k)?(f(),_($,{key:0,title:t.$t("quotes.cart_widget.title"),class:"print:hidden"},{default:e(()=>[F("p",T,r(t.$t("quotes.cart_widget.quote_request_hint")),1),p(w,{loading:u.value,"full-width":"",variant:"outline",onClick:q},{default:e(()=>[l(r(t.$t("quotes.cart_widget.create_quote_button")),1)]),_:1},8,["loading"])]),_:1},8,["title"])):x("",!0)}}});export{z as default};
//# sourceMappingURL=create-quote-from-cart-D7FhUT_2.js.map
