import{P as n,_,R as f,a1 as e,a2 as l,a0 as r,X as p,F as Q,at as $,aw as B,as as N,W as x,e as F,T as M,r as y,m as D}from"./vendor-Dd8T34zR.js";import{_ as A,b8 as P,b9 as W,ba as I,a6 as R,o as T,x as E,g as G,bb as O}from"./index-Vd7lvnU9.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=E(),{cart:s,refetch:m}=P(),u=y(!1),{client:C}=$(),g=B(),{openModal:v}=T(),V=D(()=>s.value?.items?.some(t=>!t.product)),{mutate:h}=N(I,{refetchQueries:()=>W(C,[O.Query.GetFullCart])}),{isAuthenticated:k}=R();async function q(){if(V.value){v({component:X});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:G.i18n.global.t("quotes.errors.creating_quote_error"),duration:15e3,single:!0}),await m(),a("unlockCart"),u.value=!1}return(t,i)=>{const b=n("VcButton"),w=n("VcWidget");return F(k)?(f(),_(w,{key:0,title:t.$t("quotes.cart_widget.title"),class:"print:hidden"},{default:e(()=>[M("p",j,r(t.$t("quotes.cart_widget.quote_request_hint")),1),p(b,{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{J as default};
//# sourceMappingURL=create-quote-from-cart-5WoR8W6g.js.map
