1import{j as e}from"./vendor-query-CniT1WJL.js";import{bk as j,B as N,bl as y,q as u,bm as f,M as m,t as i,P as g,G as v,bn as k}from"./index-KjAD5lCC.js";import{r as x,k as C,L as q}from"./vendor-react-69GsFwrV.js";import{b as p}from"./AccountSection-B7Ueu1lP.js";import{u as w,C as Q,a as h}from"./CompanyPortalShell-S13F8qfG.js";import{C as P}from"./CompanyPdfButton-BRIsZWze.js";import{c as A}from"./customer-error-copy-BMVNH5_E.js";import{aE as T,ao as I,bc as L,a8 as S,a3 as E}from"./vendor-ui-Ad3ANzF6.js";import"./vendor-forms-q6h4WU-p.js";import"./AccountNav-CGK2802V.js";const O=new Set(["sent","viewed","accepted"]);function z(a){return O.has(a.status)&&a.convertedOrderId===null&&a.itemCount>0&&a.totalQuoteCents>0}function B({quoteId:a,canCreateOrders:t,quote:d}){const r=j({mutation:{gcTime:0}}),c=x.useRef(!1),[l,s]=x.useState(null);return z(d)?t?e.jsxs("div",{className:"mt-4",children:[e.jsx(N,{type:"button",className:"w-full",disabled:r.isPending,onClick:async()=>{if(!c.current){c.current=!0,s(null);try{const o=await r.mutateAsync({quoteId:a});r.reset(),window.location.href=o.payUrl}catch(o){c.current=!1,s(A(o,"We could not open the secure quote page. Please try again or contact VidaPeps support.")),r.reset()}}},children:r.isPending?"Openingâ¦":"Continue with this quote"}),l?e.jsx("p",{className:"mt-2 text-caption text-destructive",role:"alert",children:l}):null]}):e.jsx("p",{className:"mt-4 rounded-xl bg-muted p-3 text-caption text-ink-3",children:"A company owner, manager, or purchaser
1can continue with this quote."}):e.jsx("p",{className:"mt-4 rounded-xl bg-muted p-3 text-caption text-ink-3",children:"This quote is not currently open for checkout."})}function b({label:a,address:t}){return e.jsxs("div",{className:"rounded-xl bg-muted p-3",children:[e.jsx("p",{className:"text-overline uppercase text-ink-3",children:a}),t?e.jsxs("address",{className:"mt-1 text-caption not-italic leading-relaxed text-ink-2",children:[t.attention?e.jsxs("span",{className:"block",children:["Attn: ",t.attention]}):null,e.jsx("span",{className:"block",children:t.line1}),t.line2?e.jsx("span",{className:"block",children:t.line2}):null,e.jsxs("span",{className:"block",children:[t.city,", ",t.state," ",t.zip]}),e.jsx("span",{className:"block",children:t.country})]}):e.jsx("p",{className:"mt-1 text-caption text-ink-3",children:"Not captured"})]})}function W(){const[,a]=C("/account/company/quotes/:quoteId"),t=Number(a?.quoteId),d=Number.isSafeInteger(t)&&t>0,{enabled:r,capabilities:c}=w(),l=y(t,{query:{enabled:r&&d,queryKey:k(t)}}),s=l.data;return e.jsx(Q,{title:s?.quoteNumber??"Quote detail",children:d?l.isLoading?e.jsxs("div",{className:"space-y-4","aria-busy":"true",children:[e.jsx(u,{className:"h-32 rounded-card"}),e.jsx(u,{className:"h-72 rounded-card"})]}):l.isError||!s?e.jsx(h,{message:"This quote is unavailable for the selected company."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs(q,{href:"/account/company/quotes",className:"inline-flex items-center gap-1 text-sm font-semibold text-primary hover:text-primary/80",children:[e.jsx(T,{className:"size-4","aria-hidden":"true"}),"All quotes"]}),e.jsx(P,{load:()=>f(s.id,{theme:"color"}),fileName:`${s.quoteNumber.replaceAll("/","-")}.pdf`,label:"Download current PDF"})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-3 lg:items-start",children:[e.jsxs(p,{icon:I,overline:`Version ${s.currentVersion}`,title:s.quoteNumber,action:e.jsx(g,{variant:s.status==="accepted"||s.status==="converted"?"mint":"neutral",className:"capitalize",children:s.status.replaceAll("_"," ")}),className:"lg:col-span-2",children:[e.jsxs("dl",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-xl bg-muted p-3",children:[e.jsx("dt",{className:"text-overline uppercase text-ink-3",children:"Issued"}),e.jsx("dd",{className:"mt-1 text-sm font-semibold text-ink",children:m(s.issuedAt)})]}),e.jsxs("div",{className:"rounded-xl bg-muted p-3",children:[e.jsx("dt",{className:"text-overline uppercase text-ink-3",children:"Valid through"}),e.jsx("dd",{className:"mt-1 text-sm font-semibold text-ink",children:s.validUntil?m(s.validUntil):"No expiration"})]}),e.jsxs("div",{className:"rounded-xl bg-muted p-3",children:[e.jsx("dt",{className:"text-overline uppercase text-ink-3",children:"Purchase order"}),e.jsx("dd",{className:"mt-1 text-sm font-semibold text-ink",children:s.purchaseOrderNumber||"Not supplied"})]})]}),e.jsx("div",{className:"mt-5 overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[620px] text-left text-sm",children:[e.jsx("thead",{className:"border-b border-card-border text-overline uppercase text-ink-3",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-2 py-2 font-semibold",children:"Item"}),e.jsx("th",{className:"px-2 py-2 text-right font-semibold",children:"Qty"}),e.jsx("th",{className:"px-2 py-2 text-right font-semibold",children:"Unit price"}),e.jsx("th",{className:"px-2 py-2 text-right font-semibold",children:"Line total"})]})}),e.jsx("tbody",{className:"divide-y divide-card-border",children:s.items.map((n,o)=>e.jsxs("tr",{children:[e.jsxs("td",{className:"px-2 py-3",children:[e.jsx("p",{className:"font-semibold text-ink",children:n.productName}),e.jsxs("p",{className:"text-caption text-ink-3",children:[n.sku,n.sizeLabel?` · ${n.sizeLabel}`:""]})]}),e.jsx("td",{className:"px-2 py-3 text-right text-ink-2 tabular-nums",children:n.quantity}),e.jsx("td",{className:"px-2 py-3 text-right text-ink-2 tabular-nums",children:i(n.unitQuotePriceCents)}),e.jsx("td",{className:"px-2 py-3 text-right font-semibold text-ink tabular-nums",children:i(n.lineQuoteCents)})]},`${n.sku}-${o}`))})]})}),s.customerNotes?e.jsxs("div",{className:"mt-5 rounded-xl border border-card-border p-3",children:[e.jsx("p",{className:"text-overline uppercase text-ink-3",children:"Notes"}),e.jsx("p",{className:"mt-1 whitespace-pre-line text-sm text-ink-2",children:s.customerNotes})]}):null]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[e.jsx(L,{className:"size-4","aria-hidden":"true"}),e.jsx("p",{className:"text-overline uppercase",children:"Totals"})]}),e.jsxs("dl",{className:"mt-3 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-3 text-ink-2",children:[e.jsx("dt",{children:"List subtotal"}),e.jsx("dd",{className:"tabular-nums",children:i(s.totals.subtotalListCents)})]}),e.jsxs("div",{className:"flex justify-between gap-3 text-ink-2",children:[e.jsx("dt",{children:"Quoted subtotal"}),e.jsx("dd",{className:"tabular-nums",children:i(s.totals.subtotalQuoteCents)})]}),e.jsxs("div",{className:"flex justify-between gap-3 text-ink-2",children:[e.jsx("dt",{children:"Shipping"}),e.jsx("dd",{className:"tabular-nums",children:i(s.totals.shippingCents)})]}),e.jsxs("div",{className:"flex justify-between gap-3 border-t border-card-border pt-2 font-semibold text-ink",children:[e.jsx("dt",{children:"Total"}),e.jsx("dd",{className:"font-mono tabular-nums",children:i(s.totals.totalQuoteCents)})]})]}),e.jsx(B,{quoteId:s.id,canCreateOrders:c.canCreateOrders,quote:{status:s.status,convertedOrderId:s.convertedOrderId,itemCount:s.items.length,totalQuoteCents:s.totals.totalQuoteCents}})]}),s.business?e.jsx(p,{icon:S,overline:s.business.account.accountNumber,title:s.business.account.dbaName||s.business.account.legalName,sub:s.business.account.dbaName?s.business.account.legalName:void 0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(b,{label:"Billing",address:s.business.billingAddress}),e.jsx(b,{label:"Shipping",address:s.business.shippingAddress}),e.jsxs("div",{className:"flex items-start gap-2 rounded-xl bg-muted p-3 text-caption text-ink-2",children:[e.jsx(E,{className:"mt-0.5 size-3.5 shrink-0 text-primary","aria-hidden":"true"}),e.jsxs("span",{children:[s.business.paymentTermsDays===0?"Due on receipt":`Net ${s.business.paymentTermsDays}`,s.business.poRequired?" · Purchase order required":""]})]})]})}):null]})]})]}
1):e.jsx(h,{message:"This quote link is invalid."})})}export{W as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.