import{F as O,ai as P,aw as W,b8 as E,P as r,Q as _,_ as u,e,R as n,T as i,X as a,a1 as o,a2 as p,a0 as l,W as m,a5 as R,a6 as H}from"./vendor-Di1tOLi3.js";import{h as S,x as U}from"./index-BrdDZgk2.js";import{u as X}from"./useBreadcrumbs-BjNgYg8O.js";import{_ as V}from"./address-info.vue_vue_type_script_setup_true_lang-q2Fc891s.js";import{u as j,_ as G}from"./quote-line-items.vue_vue_type_style_index_0_lang-C-rWDaSE.js";import{d as J}from"./index-A7nVgOjB.js";import{_ as K}from"./quote-status.vue_vue_type_style_index_0_lang-CDU8TVqz.js";import{_ as M}from"./quote-summary.vue_vue_type_script_setup_true_lang-C6cdSKU5.js";import"./address-type.enum-CGCAFS3X.js";import"./getQuotesQuery-CPIkBavz.js";import"./configuration-items.vue_vue_type_script_setup_true_lang-DQFfVJJ9.js";const Y={key:0},Z={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=O({__name:"view-quote",props:{quoteId:{}},setup($){const f=$,{t:c}=P(),{quote:s,billingAddress:h,approveItem:k,declineItem:w,shippingAddress:b,fetchQuote:y}=j(),g=U(),x=W();S({title:c("quote_details.title",[s.value?.number])});async function B(){try{const t=await k(s.value.id);await x.push({name:"OrderDetails",params:{orderId:t.orderId}})}catch{g.error({text:c("quote_details.error.approve")})}}async function I(){try{await w(s.value.id),await y({id:f.quoteId})}catch{g.error({text:c("quote_details.error.decline")})}}const C=X(()=>[{title:c("common.links.account"),route:{name:"Account"}},{title:c("quotes.navigation.route_name"),route:{name:"Quotes"}},{title:c("quote_details.title",[s?.value?.number])}]);E(async()=>{await y({id:f.quoteId})});function F(t){return{...t,status:"attached"}}function L(t){J(t.url,t.name)}return(t,lt)=>{const N=r("VcBreadcrumbs"),z=r("VcTypography"),v=r("VcButton"),q=r("VcLayout"),d=r("VcWidget"),D=r("VcFile"),Q=r("VcLoaderOverlay");return e(s)?(n(),_("div",Y,[i("div",Z,[a(N,{items:e(C)},null,8,["items"])]),a(q,{"sidebar-position":"right"},{sidebar:o(()=>[e(s).status==="Proposal sent"?(n(),_("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:B},{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(M,{quote:e(s),class:"mb-5 max-md:mt-5"},null,8,["quote"]),a(d,{title:t.$t("quote_details.quote_data"),class:"mb-5 max-md:order-first"},{default:o(()=>[i("div",at,[i("div",ot,[i("span",nt,l(t.$t("quote_details.created"))+":",1),i("span",null,l(t.$d(e(s).createdDate)),1)]),i("div",it,[i("span",rt,l(t.$t("quote_details.status"))+":",1),a(K,{size:"sm",status:e(s).status},null,8,["status"])])])]),_:1},8,["title"]),e(b)?(n(),u(d,{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)?(n(),u(d,{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(d,{size:"lg"},{default:o(()=>[a(G,{items:e(s).items,readonly:""},null,8,["items"])]),_:1}),e(s).comment?(n(),u(d,{key:0,title:t.$t("quote_details.comment"),"prepend-icon":"document-text",size:"lg",class:"mt-5"},{default:o(()=>[i("div",et,l(e(s).comment),1)]),_:1},8,["title"])):m("",!0),e(s).attachments?.length?(n(),u(d,{key:1,title:t.$t("quote_details.files"),size:"lg","prepend-icon":"document-text",class:"mt-5"},{default:o(()=>[i("ul",st,[(n(!0),_(R,null,H(e(s).attachments,(T,A)=>(n(),_("li",{key:A},[a(D,{file:F(T),onDownload:L},null,8,["file"])]))),128))])]),_:1},8,["title"])):m("",!0)]),_:1})])):(n(),u(Q,{key:1,"no-bg":""}))}}});export{vt as default};
//# sourceMappingURL=view-quote-BPVZCqDR.js.map
