import{F as O,aj as P,ay as W,av 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 j}from"./vendor-sJIIH5Cr.js";import{v as H,f as S}from"./index-BGo1APpE.js";import{u as U}from"./useBreadcrumbs-m4lwMW3p.js";import{_ as V}from"./address-info.vue_vue_type_script_setup_true_lang-C_NuuEy7.js";import{u as X,_ as G}from"./quote-line-items.vue_vue_type_style_index_0_lang-BZ5dK_bN.js";import{d as J}from"./index-hI1sfMXz.js";import{_ as K}from"./quote-status.vue_vue_type_style_index_0_lang-DQ0wWNJ7.js";import{_ as M}from"./quote-summary.vue_vue_type_script_setup_true_lang-BQV8pijw.js";import"./address-type.enum-CGCAFS3X.js";import"./getQuotesQuery-BNo6ikIw.js";import"./configuration-items.vue_vue_type_script_setup_true_lang-CnyzzoEd.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:y,fetchQuote:b}=X(),g=H(),B=W();S({title:c("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:c("quote_details.error.approve")})}}async function I(){try{await w(s.value.id),await b({id:f.quoteId})}catch{g.error({text:c("quote_details.error.decline")})}}const C=U(()=>[{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 b({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: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(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(y)?(n(),u(d,{key:0,title:t.$t("quote_details.shipping_address"),class:"mb-5"},{default:o(()=>[a(e(V),{address:e(y)},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,j(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-DAtSn2a-.js.map
