PageSourceSearch

https://www.smallbizagent.ai/assets/manage-reservation-Dh5zEpo5.js

js smallbizagent.ai collected 2026-10-05 15:06:02 UTC 7,140 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./vendor-query-CnAhr2B8.js";import{a0 as L,a as q,bs as F,ak as N,p as b,q as I,ae as _,r as H,aT as K,s as O,d as X,U as Y,C as Z,ab as G,M as J,a8 as v,P as w,B as y,K as Q,ax as V}from"./index-CLUtDhnY.js";import{g as W}from"./brand-colors-BK2YJXTW.js";import{U as ee}from"./user-D7D5Y3_w.js";import{C}from"./circle-x-CDWbgxd-.js";import"./vendor-ui-CYA7SV0W.js";import"./vendor-charts-CPMWc2oJ.js";import"./vendor-forms-UY-il7MQ.js";function me(){const k=L(),{slug:i,token:o}=k,{toast:x}=q(),[S,h]=l.useState(!0),[u,R]=l.useState(null),[m,T]=l.useState(null),[p,f]=l.useState(!1),[c,$]=l.useState(!1),{setTheme:g,theme:P}=F();l.useEffect(()=>{const a=P;return g("light"),()=>{a&&a!=="light"&&g(a)}},[]),l.useEffect(()=>{B()},[i,o]);const B=async()=>{try{h(!0);const a=await fetch(`/api/book/${i}/manage-reservation/${o}`);if(!a.ok){const d=await a.json();throw new Error(d.error||"Failed to load reservation")}const n=await a.json();T(n)}catch(a){R(a.message)}finally{h(!1)}},E=async()=>{try{f(!0);const a=await fetch(`/api/book/${i}/manage-reservation/${o}/cancel`,{method:"POST"}),n=await a.json();if(!a.ok)throw new Error(n.error||"Failed to cancel reservation");$(!0),x({title:"Reservation Cancelled",description:n.message})}catch(a){x({title:"Error",description:a.message,variant:"destructive"})}finally{f(!1)}},M=a=>{const[n,d]=a.split(":").map(Number),D=n>=12?"PM":"AM";return`${n%12||12}:${d.toString().padStart(2,"0")} ${D}`};if(S)return e.jsx("div",{className:"min-h-screen bg-muted/30 flex items-center justify-center",children:e.jsx(N,{className:"h-10 w-10 animate-spin text-primary"})});if(u||!m)return e.jsx("div",{className:"min-h-screen bg-muted/30 flex items-center justify-center px-4",children:e.jsx(b,{className:"max-w-md w-full",children:e.jsxs(I,{className:"text-center",children:[e.jsx(_,{className:"h-12 w-12 text-amber-500 mx-auto mb-4"}),e.jsx(H,{children:"Reservation Not Found"}),e.jsx(K,{children:u||"This link may have expired or is invalid."})]})})});const{reservation:t,customer:r,business:s}=m,U=new Date(t.startDate),z={confirmed:"bg-green-100 text-green-800",seated:"bg-blue-100 text-blue-800",completed:"bg-gray-100 text-gray-800",cancelled:"bg-red-100 text-red-800",no_show:"bg-amber-100 text-amber-800"},j=[s.address,s.city,s.state].filter(Boolean).join(", "),A=!c&&t.status!=="cancelled"&&t.status!=="completed"&&t.status!=="seated";return e.jsx("div",{className:"min-h-screen bg-muted/30 py-8 px-4",style:W(m.business.brandColor),children:e.jsxs("div",{className:"max-w-lg mx-auto space-y-4",children:[e.jsxs(b,{className:"overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-br from-primary to-primary/80 p-6",children:e.jsxs("div",{className:"flex items-center gap-4 text-primary-foreground",children:[s.logoUrl?e.jsx("img",{src:s.logoUrl,alt:s.name,className:"h-14 w-14 rounded-xl object-contain bg-white/20 backdrop-blur-sm p-2"}):e.jsx("div",{className:"h-14 w-14 rounded-xl bg-white/20 backdrop-blur-sm flex items-center justify-center",children:e.jsx("span",{className:"text-xl font-bold",children:s.name[0]})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold",children:s.name}),e.jsx("p",{className:"text-primary-foreground/80 text-sm",children:"Manage Your Reservation"})]})]})}),e.jsxs(O,{className:"pt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Reservation #",t.id]}),e.jsx(X,{className:z[c?"cancelled":t.status]||"bg-gray-100 text-gray-800",children:c?"Cancelled":t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsxs("span",{className:"font-medium",children:["Party of ",t.partySize]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Z,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"font-medium",children:U.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",timeZone:s.timezone})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsxs("span",{className:"font-medium",children:[M(t.time),s.timezoneAbbr?` ${s.timezoneAbbr}`:""]})]}),t.specialRequests&&e.jsxs("div",{className:"flex items-start gap-3 pt-2 border-t",children:[e.jsx(J,{className:"h-4 w-4 text-muted-foreground flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Special Requests"}),e.jsx("p",{className:"text-sm",children:t.specialRequests})]})]})]}),r&&e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ee,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:[r.firstName," ",r.lastName]})]}),r.email&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(v,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:r.email})]}),r.phone&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(w,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:r.phone})]})]}),(c||t.status==="cancelled")&&e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3",children:e.jsxs("p",{className:"text-sm text-red-800 flex items-center gap-2",children:[e.jsx(C,{className:"h-4 w-4"}),"This reservation has been cancelled."]})}),A&&e.jsx(y,{variant:"destructive",className:"w-full",onClick:E,disabled:p,children:p?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"})," Cancelling..."]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"mr-2 h-4 w-4"})," Cancel Reservation"]})}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h4",{className:"font-medium mb-2",children:s.name}),j&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 flex-shrink-0"}),j]}),s.phone&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-2 mt-1",children:[e.jsx(w,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("a",{href:`tel:${s.phone}`,className:"hover:underline",children:s.phone})]}),s.email&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-2 mt-1",children:[e.jsx(v,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("a",{href:`mailto:${s.email}`,className:"hover:underline",children:s.email})]})]}),e.jsx("a",{href:`/book/${i}`,children:e.jsxs(y,{variant:"outline",className:"w-full",children:[e.jsx(V,{className:"mr-2 h-4 w-4"})," Back to Booking Page"]})})]})]}),e.jsx("div",{className:"text-center",children:e.jsx("a",{href:"https://www.smallbizagent.ai",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-primary transition-colors",children:"Powered by SmallBizAgent"})})]})})}export{me 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.