import{M as P,$ as T,ad as W,N as _,R as u,e,W as n,X as a,U as r,V as o,Z as p,Y as l,a8 as m,P as E,Q as R,ai as U,O as i}from"./vendor-CsGITfgk.js";import{w as H,f as M}from"./index-GCDRvGOr.js";import{u as S}from"./useBreadcrumbs-CLanN9FL.js";import{u as X,_ as Y}from"./quote-line-items.vue_vue_type_style_index_0_lang-C3LLIqc9.js";import{_ as V}from"./address-info.vue_vue_type_script_setup_true_lang-D8cGR64v.js";import{d as Z}from"./index-yOwfcyfN.js";import{_ as j}from"./quote-status.vue_vue_type_style_index_0_lang-DNamRT-B.js";import{_ as G}from"./quote-summary.vue_vue_type_script_setup_true_lang-Bj5mqbyo.js";import"./address-type.enum-CGCAFS3X.js";import"./getQuotesQuery-B5J9JsS9.js";import"./configuration-items.vue_vue_type_script_setup_true_lang-C3vgTvzN.js";const J={key:0},K={class:"space-y-3"},tt={key:0,class:"flex flex-wrap gap-3 max-md:mt-5"},et={class:"text-base"},st={class:"space-y-2 rounded-[--vc-radius] border border-neutral-200 px-3 py-4"},at={class:"space-y-1"},ot={class:"flex text-base"},nt={class:"mr-2 font-bold"},it={class:"flex items-center gap-2"},rt={class:"text-base font-bold"},vt=P({__name:"view-quote",props:{quoteId:{}},setup($){const f=$,{t:d}=T(),{quote:s,billingAddress:h,approveItem:k,declineItem:w,shippingAddress:b,fetchQuote:y}=X(),g=H(),B=U();M({title:d("quote_details.title",[s.value?.number])});async function x(){try{const t=await k(s.value.id);await B.push({name:"OrderDetails",params:{orderId:t.orderId}})}catch{g.error({text:d("quote_details.error.approve")})}}async function I(){try{await w(s.value.id),await y({id:f.quoteId})}catch{g.error({text:d("quote_details.error.decline")})}}const C=S(()=>[{title:d("common.links.account"),route:{name:"Account"}},{title:d("quotes.navigation.route_name"),route:{name:"Quotes"}},{title:d("quote_details.title",[s?.value?.number])}]);W(async()=>{await y({id:f.quoteId})});function N(t){return{...t,status:"attached"}}function F(t){Z(t.url,t.name)}return(t,lt)=>{const L=r("VcBreadcrumbs"),z=r("VcTypography"),v=r("VcButton"),q=r("VcLayout"),c=r("VcWidget"),D=r("VcFile"),O=r("VcLoaderOverlay");return e(s)?(i(),_("div",J,[n("div",K,[a(L,{items:e(C)},null,8,["items"])]),a(q,{"sidebar-position":"right"},{sidebar:o(()=>[e(s).status==="Proposal sent"?(i(),_("div",tt,[a(v,{class:"grow",variant:"outline",onClick:I},{default:o(()=>[p(l(t.$t("common.buttons.decline")),1)]),_:1}),a(v,{class:"grow",onClick:x},{default:o(()=>[p(l(t.$t("common.buttons.approve")),1)]),_:1})])):m("",!0)]),default:o(()=>[a(z,{tag:"h1"},{default:o(()=>[p(l(t.$t("quote_details.title",[e(s).number])),1)]),_:1})]),_:1}),a(q,{"sidebar-position":"right"},{sidebar:o(()=>[a(G,{quote:e(s),class:"mb-5 max-md:mt-5"},null,8,["quote"]),a(c,{title:t.$t("quote_details.quote_data"),class:"mb-5 max-md:order-first"},{default:o(()=>[n("div",at,[n("div",ot,[n("span",nt,l(t.$t("quote_details.created"))+":",1),n("span",null,l(t.$d(e(s).createdDate)),1)]),n("div",it,[n("span",rt,l(t.$t("quote_details.status"))+":",1),a(j,{size:"sm",status:e(s).status},null,8,["status"])])])]),_:1},8,["title"]),e(b)?(i(),u(c,{key:0,title:t.$t("quote_details.shipping_address"),class:"mb-5"},{default:o(()=>[a(e(V),{address:e(b)},null,8,["address"])]),_:1},8,["title"])):m("",!0),e(h)?(i(),u(c,{key:1,title:t.$t("quote_details.billing_address")},{default:o(()=>[a(e(V),{address:e(h)},null,8,["address"])]),_:1},8,["title"])):m("",!0)]),default:o(()=>[a(c,{size:"lg"},{default:o(()=>[a(Y,{items:e(s).items,readonly:""},null,8,["items"])]),_:1}),e(s).comment?(i(),u(c,{key:0,title:t.$t("quote_details.comment"),"prepend-icon":"document-text",size:"lg",class:"mt-5"},{default:o(()=>[n("div",et,l(e(s).comment),1)]),_:1},8,["title"])):m("",!0),e(s).attachments?.length?(i(),u(c,{key:1,title:t.$t("quote_details.files"),size:"lg","prepend-icon":"document-text",class:"mt-5"},{default:o(()=>[n("ul",st,[(i(!0),_(E,null,R(e(s).attachments,(Q,A)=>(i(),_("li",{key:A},[a(D,{file:N(Q),onDownload:F},null,8,["file"])]))),128))])]),_:1},8,["title"])):m("",!0)]),_:1})])):(i(),u(O,{key:1,"no-bg":""}))}}});export{vt as default};
//# sourceMappingURL=view-quote-D9A-gZWf.js.map
