import{P as n,_,R as f,a1 as e,a2 as l,a0 as r,X as p,F as Q,r as $,ar as B,aw as N,m as F,aq as M,W as x,e as y,T as D}from"./vendor-CYDnlB7m.js";import{d as A,v as P,b6 as W,e as I,a3 as R,g as T,b7 as E,b8 as G,b9 as O}from"./index-Dbx5Evda.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=$(!1),{client:C}=B(),g=N(),{openModal:v}=I(),q=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(q.value){v({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"),b=n("VcWidget");return y(h)?(f(),_(b,{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-CJ29epnn.js.map
