PageSourceSearch

https://nwfloors.co.uk/assets/QuoteAccept-7fGkH3Xe.js

js nwfloors.co.uk collected 2026-10-08 17:36:19 UTC 6,920 bytes, 1 lines download raw bytes

1import{a9 as k,Q as P,aZ as _,u as Q,r as p,j as e,I as v,B as D,b as I}from"./index-D2rUcUpe.js";import{H as L}from"./Helmet-D7MYuSoa.js";import{u as B}from"./useMutation-N7h9ZAvw.js";import{C as d,c as m}from"./card-Bto263fv.js";import{T as V,a as F,b as j,c as x,d as $,e as i}from"./table-Bn0HNHfV.js";import{a as G,b as H,c as M,d as A,e as Y}from"./terms-D2_J0o7j.js";import{C as K}from"./circle-check-D-x_fqZ5.js";const O={m2:"m²",fixed:"job",each:"each"};function l(c){return new Intl.NumberFormat("en-GB",{style:"currency",currency:"GBP"}).format(Number.isFinite(c)?c:0)}function te(){var f,T;const[,c]=k("/quote/:token"),r=(c==null?void 0:c.token)??"",{toast:b}=P(),q=_(),n=Q({queryKey:[`/api/quote/${r}`],enabled:!!r,refetchOnWindowFocus:!1}),[o,N]=p.useState(""),[g,y]=p.useState("");p.useEffect(()=>{n.data&&(N(t=>t||n.data.customerName||""),y(t=>t||n.data.email||""))},[n.data]);const u=B({mutationFn:()=>I(`/api/quote/${r}/accept`,{method:"POST",data:{customerName:o.trim(),customerEmail:g.trim(),acceptedTerms:!0}}),onSuccess:()=>{q.invalidateQueries({queryKey:[`/api/quote/${r}`]}),b({title:"Thank you!",description:"Your quote has been accepted."})},onError:t=>{b({title:"Could not accept",description:(t==null?void 0:t.message)||"Please try again.",variant:"destructive"})}});if(n.isLoading)return e.jsx("div",{className:"container mx-auto px-4 py-12 max-w-3xl text-sm text-gray-500",children:"Loading your quote…"});if(!n.data)return e.jsxs("div",{className:"container mx-auto px-4 py-12 max-w-3xl",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Quote not found"}),e.jsx("p",{className:"text-gray-600",children:"This link may have expired. Please contact us on 01928 263 265 and we'll help."})]});const s=n.data,a=!!s.hideLinePrices,E=Number(s.vatRate??20),S=s.subtotal,w=s.vat,C=s.total,R=!!((f=s.acceptance)!=null&&f.acceptedAt);return e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-3xl",children:[e.jsxs(L,{children:[e.jsx("title",{children:"View & accept your quote | Northwest Floors"}),e.jsx("meta",{name:"robots",content:"noindex"})]}),e.jsx("h1",{className:"text-3xl font-bold mb-1",children:"Your flooring quote"}),e.jsxs("p",{className:"text-gray-600 mb-6",children:["Quote Q-",s.id,s.createdAt?` · ${new Date(s.createdAt).toLocaleDateString("en-GB")}`:""]}),s.jobSummary&&e.jsx("p",{className:"whitespace-pre-line text-gray-700 mb-6",children:s.jobSummary}),e.jsx(d,{className:"mb-6",children:e.jsxs(m,{className:"pt-6",children:[e.jsxs(V,{children:[e.jsx(F,{children:e.jsxs(j,{children:[e.jsx(x,{children:"Description"}),e.jsx(x,{className:"text-right",children:"Qty"}),!a&&e.jsx(x,{className:"text-right",children:"Unit (ex-VAT)"}),!a&&e.jsx(x,{className:"text-right",children:"Total (ex-VAT)"})]})}),e.jsx($,{children:s.items.length?s.items.map(t=>e.jsxs(j,{children:[e.jsx(i,{children:t.description}),e.jsxs(i,{className:"text-right",children:[t.quantity," ",O[t.unit]||t.unit]}),!a&&e.jsx(i,{className:"text-right",children:l(t.unitSell??0)}),!a&&e.jsx(i,{className:"text-right",children:l((t.unitSell??0)*t.quantity)})]},t.id)):e.jsx(j,{children:e.jsx(i,{colSpan:a?2:4,className:"text-gray-500",children:"No items on this quote."})})})]}),e.jsxs("div",{className:"mt-4 ml-auto max-w-xs text-sm space-y-1",children:[!a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Subtotal (ex-VAT)"}),e.jsx("span",{children:l(s.subtotalBeforeDiscount??S)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{children:["VAT (",E,"%)"]}),e.jsx("span",{children:l(w)})]})]}),(s.discountAmount??0)>0&&e.jsxs("div",{className:"flex justify-between text-green-700","data-testid":"text-quote-discount",children:[e.jsxs("span",{children:[s.discountType==="percent"&&(s.discountValue??0)>0?`Discount (${s.discountValue}%)`:"Discount",a?" (ex-VAT)":""]}),e.jsxs("span",{children:["-",l(s.discountAmount)]})]}),e.jsxs("div",{className:"flex justify-between font-bold border-t pt-1 text-base",children:[e.jsxs("span",{children:["Total",a?" (inc. VAT)":""]}),e.jsx("span",{children:l(C)})]})]}),!s.hideAreasList&&(((T=s.areasIncluded)==null?void 0:T.filter(t=>t.label.trim()).length)??0)>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-semibold mb-1",children:"Areas included"}),e.jsx("ul",{className:"text-sm text-gray-700 list-disc pl-5 space-y-0.5",children:s.areasIncluded.filter(t=>t.label.trim()).map((t,h)=>e.jsxs("li",{children:[t.label,t.area>0?` — ${t.area} m²`:""]},h))})]}),s.notes&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-semibold mb-1",children:"Notes"}),e.jsx("p",{className:"whitespace-pre-line text-sm text-gray-700",children:s.notes})]})]})}),e.jsx(d,{className:"mb-6 bg-sage-50/50",children:e.jsxs(m,{className:"pt-6",children:[e.jsx("h2",{className:"text-lg font-semibold mb-3",children:G}),H.map((t,h)=>e.jsx("p",{className:"text-sm text-gray-700 mb-2",children:t},h)),e.jsx("p",{className:"text-sm text-gray-700 mb-2",children:M}),e.jsx("p",{className:"text-sm",children:e.jsx("a",{href:A,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"Read the full Terms & Conditions"})})]})}),R?e.jsx(d,{className:"border-green-300 bg-green-50",children:e.jsxs(m,{className:"pt-6 flex items-start gap-3",children:[e.jsx(K,{className:"h-6 w-6 text-green-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-green-800",children:"Quote accepted — thank you!"}),e.jsxs("p",{className:"text-sm text-green-700",children:["Accepted by ",s.acceptance.customerName,s.acceptance.acceptedAt?` on ${new Date(s.acceptance.acceptedAt).toLocaleDateString("en-GB")}`:"",". We'll be in touch about the next steps. If you have any questions, call us on 01928 263 265."]})]})]})}):e.jsx(d,{children:e.jsxs(m,{className:"pt-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Accept your quote"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium block mb-1",children:"Your name"}),e.jsx(v,{value:o,onChange:t=>N(t.target.value),placeholder:"Full name"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium block mb-1",children:"Email (optional)"}),e.jsx(v,{type:"email",value:g,onChange:t=>y(t.target.value),placeholder:"[email protected]"})]})]}),e.jsx(D,{size:"lg",onClick:()=>u.mutate(),disabled:!o.trim()||u.isPending,children:u.isPending?"Submitting…":"Accept this quote"}),e.jsxs("p",{className:"text-xs text-gray-600 leading-snug",children:[Y," ",e.jsx("a",{href:A,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"Terms & Conditions"}),"."]}),!o.trim()&&e.jsx("p",{className:"text-xs text-gray-500",children:"Please enter your name above to accept."})]})})]})}export{te 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.