import{F as O,ag as P,aw as W,as 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,a6 as R,a7 as H}from"./vendor-CB-jpi5M.js";import{v as S,f as U}from"./index-B-IqqSSt.js";import{u as X}from"./useBreadcrumbs-C3iwaFYZ.js";import{_ as V}from"./address-info.vue_vue_type_script_setup_true_lang-DdpOBfmx.js";import{u as j,_ as G}from"./quote-line-items.vue_vue_type_style_index_0_lang-CINj6s_Y.js";import{d as J}from"./index-UTlpq3_r.js";import{_ as K}from"./quote-status.vue_vue_type_style_index_0_lang-CbVHE2xa.js";import{_ as M}from"./quote-summary.vue_vue_type_script_setup_true_lang-B4arSEck.js";import"./address-type.enum-CGCAFS3X.js";import"./getQuotesQuery-3jtYLbXH.js";import"./configuration-items.vue_vue_type_script_setup_true_lang-DuB_iofl.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=S(),B=W();U({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 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: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(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-rKodj2RD.js.map
