import{C as T,V as R,ac as S,a8 as W,N as r,D as _,K as u,u as e,E as n,P as i,Q as a,O as o,S as p,R as l,a3 as m,F as H,J}from"./vendor-BGtMsOoo.js";import{y as K,i as U}from"./index-CRze-aDK.js";import{u as j}from"./useBreadcrumbs-DdGLvHNR.js";import{u as G,_ as M,d as X}from"./quote-line-items.vue_vue_type_style_index_0_lang-DO8jHetc.js";import{_ as k}from"./address-info.vue_vue_type_script_setup_true_lang-BOsZGilH.js";import"./constants-55usBUX1.js";import{_ as Y}from"./quote-status.vue_vue_type_script_setup_true_lang-DHqaotW1.js";import{_ as Z}from"./quote-summary.vue_vue_type_script_setup_true_lang-GPtJ755r.js";import"./address-type.enum-CGCAFS3X.js";import"./getQuotesQuery-cLyGE1OM.js";import"./address-line.vue_vue_type_script_setup_true_lang-C5lgR6Et.js";const tt={key:0},et={class:"space-y-3"},st={key:0,class:"flex flex-wrap gap-3 max-md:mt-5"},at={class:"text-base"},ot={class:"space-y-2 rounded border border-neutral-200 px-3 py-4"},nt={class:"space-y-1"},it={class:"flex text-base"},rt={class:"mr-2 font-bold"},lt={class:"flex items-center gap-2"},ct={class:"text-base font-bold"},Vt=T({__name:"view-quote",props:{quoteId:{}},setup(w){var v;const f=w,{t:c}=R(),{quote:s,billingAddress:h,approveItem:B,declineItem:x,shippingAddress:y,fetchQuote:b}=G(),g=K(),I=S();U({title:c("quote_details.title",[(v=s.value)==null?void 0:v.number])});async function C(){try{const t=await B(s.value.id);await I.push({name:"OrderDetails",params:{orderId:t.orderId}})}catch{g.error({text:c("quote_details.error.approve")})}}async function F(){try{await x(s.value.id),await b({id:f.quoteId})}catch{g.error({text:c("quote_details.error.decline")})}}const N=j(()=>{var t;return[{title:c("common.links.account"),route:{name:"Account"}},{title:c("quotes.navigation.route_name"),route:{name:"Quotes"}},{title:c("quote_details.title",[(t=s==null?void 0:s.value)==null?void 0:t.number])}]});W(async()=>{await b({id:f.quoteId})});function D(t){return{...t,status:"attached"}}function L(t){X(t.url,t.name)}return(t,dt)=>{const O=r("VcBreadcrumbs"),Q=r("VcTypography"),q=r("VcButton"),V=r("VcLayout"),d=r("VcWidget"),z=r("VcFile"),A=r("VcLoaderOverlay");return e(s)?(n(),_("div",tt,[i("div",et,[a(O,{items:e(N)},null,8,["items"])]),a(V,{"sidebar-position":"right"},{sidebar:o(()=>[e(s).status==="Proposal sent"?(n(),_("div",st,[a(q,{class:"grow",variant:"outline",onClick:F},{default:o(()=>[p(l(t.$t("common.buttons.decline")),1)]),_:1}),a(q,{class:"grow",onClick:C},{default:o(()=>[p(l(t.$t("common.buttons.approve")),1)]),_:1})])):m("",!0)]),default:o(()=>[a(Q,{tag:"h1"},{default:o(()=>[p(l(t.$t("quote_details.title",[e(s).number])),1)]),_:1})]),_:1}),a(V,{"sidebar-position":"right"},{sidebar:o(()=>[a(Z,{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",nt,[i("div",it,[i("span",rt,l(t.$t("quote_details.created"))+":",1),i("span",null,l(t.$d(e(s).createdDate)),1)]),i("div",lt,[i("span",ct,l(t.$t("quote_details.status"))+":",1),a(Y,{class:"min-w-[7.785rem]",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(k),{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(k),{address:e(h)},null,8,["address"])]),_:1},8,["title"])):m("",!0)]),default:o(()=>{var $;return[a(d,{size:"lg"},{default:o(()=>[a(M,{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"},{default:o(()=>[i("div",at,l(e(s).comment),1)]),_:1},8,["title"])):m("",!0),($=e(s).attachments)!=null&&$.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",ot,[(n(!0),_(H,null,J(e(s).attachments,(E,P)=>(n(),_("li",{key:P},[a(z,{file:D(E),onDownload:L},null,8,["file"])]))),128))])]),_:1},8,["title"])):m("",!0)]}),_:1})])):(n(),u(A,{key:1,"no-bg":""}))}}});export{Vt as default};
//# sourceMappingURL=view-quote-D8fis9pk.js.map
