import{P as n,_,R as f,a1 as e,a2 as l,a0 as r,X as p,F as Q,r as b,ar as B,aw as N,m as F,aq as M,W as x,e as y,T as D}from"./vendor-d3O24IFR.js";import{d as A,w as P,a_ as W,e as I,a4 as R,g as T,a$ as E,b0 as G,b1 as O}from"./index-BVlIyij2.js";const S={};function U(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 X=A(S,[["render",U]]),j={class:"mb-5 text-xs font-normal text-neutral-400"},J=Q({__name:"create-quote-from-cart",emits:["lockCart","unlockCart"],setup(o,{emit:d}){const a=d,c=P(),{cart:s,refetch:m}=W(),u=b(!1),{client:C}=B(),g=N(),{openModal:q}=I(),v=F(()=>s.value?.items?.some(t=>!t.product)),{mutate:V}=M(E,{refetchQueries:()=>G(C,[O.Query.GetFullCart])}),{isAuthenticated:h}=R();async function k(){if(v.value){q({component:X});return}u.value=!0,a("lockCart");const i=(await V({command:{cartId:s.value.id,comment:""}}))?.data?.createQuoteFromCart;i?await g.push({name:"EditQuote",params:{quoteId:i.id}}):c.error({text:T.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(h)?(f(),_($,{key:0,title:t.$t("quotes.cart_widget.title"),class:"print:hidden"},{default:e(()=>[D("p",j,r(t.$t("quotes.cart_widget.quote_request_hint")),1),p(w,{loading:u.value,"full-width":"",variant:"outline",onClick:k},{default:e(()=>[l(r(t.$t("quotes.cart_widget.create_quote_button")),1)]),_:1},8,["loading"])]),_:1},8,["title"])):x("",!0)}}});export{J as default};
//# sourceMappingURL=create-quote-from-cart-DU7nhOSP.js.map
