PageSourceSearch

https://kimlinenergy.com/assets/_id_-DHj0loCV.js

js kimlinenergy.com collected 2026-10-07 01:02:19 UTC 11,883 bytes, 1 lines download raw bytes

1import{a as i,j as e,b as $}from"./query-YQf5_TCb.js";import{f as z,u as O,F as o,H as Z,c as q,C as M,U as G,M as S}from"./index-Ba78mvdf.js";import{d as J,f as c}from"./service-utils-BtfOgjdF.js";import{B as f}from"./button-CMtw-9mo.js";import{S as h}from"./skeleton-tJVS9_4H.js";import{u as Q,a as j}from"./AdminAuthContext-yduR1K3O.js";import{u as W}from"./AppConfigContext-BERjbaDt.js";import{C as V,b as X}from"./admin-events-D6llXLfW.js";import{k as Y}from"./appointments-client-Bm2hBTiA.js";import{A as ee}from"./arrow-left-DT6l9mZu.js";import{T as se}from"./tag-udfJ-BRi.js";import{T as ae}from"./trash-2-B30uWLMk.js";import"./radix-ui-BPNS4XXn.js";import"./index-B-wEA4bz.js";import"./track-DfsJPat3.js";const ne={paid:"bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-400",unpaid:"bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-400",cancelled:"bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-400"};function te(t){if(!t||!t.startsWith("PT"))return null;const d=t.match(/(\d+)H/),r=t.match(/(\d+)M/),m=parseInt((d==null?void 0:d[1])??"0"),s=parseInt((r==null?void 0:r[1])??"0"),u=m*60+s;return u>0?`${u} min`:null}function n({label:t,value:d}){return e.jsxs("div",{className:"flex justify-between border-b border-border py-3 last:border-0",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:e.jsx(o,{devId:"630643",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:1aca80e8b55c802f7b43740da2990e1b5735bbb323d93eb5ebda8395b04025e2"},children:t})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:e.jsx(o,{devId:"630644",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:cd42404d52ad55ccfa9aca4adc828aa5800ad9d385a0671fbcbf724118320619"},children:d})})]})}function ve(){var w,K,A;const{id:t}=z(),{token:d}=Q(),{currency:r}=W(),m=O(),[s,u]=i.useState(null),[L,v]=i.useState(!0),[N,x]=i.useState(!1),[y,H]=i.useState(null),[p,I]=i.useState("UTC");i.useEffect(()=>{Y().then(a=>I(a.config.timezone??"UTC")).catch(()=>{})},[]);async function g(){v(!0);try{const a=await j(`/api/appointments/admin/bookings/${t}`,d);if(a.ok){const l=await a.json();u(l.booking??l)}else H("Booking not found")}finally{v(!1)}}i.useEffect(()=>{g()},[t,d]);async function D(){x(!0),(await j(`/api/appointments/admin/bookings/${t}/mark-as-paid`,d,{method:"PATCH"})).ok&&await g(),x(!1)}async function B(a){x(!0),(await j(`/api/appointments/admin/bookings/${t}`,d,{method:"PATCH",body:JSON.stringify({status:a})})).ok&&(s&&X({booking_id:s.id,service_name:s.serviceName,payment_type:s.status==="paid"?"online":"offline"}),await g()),x(!1)}if(L)return e.jsxs("div",{className:"max-w-2xl space-y-4",children:[e.jsx(h,{className:"h-8 w-48"}),e.jsx(h,{className:"h-32 rounded-xl"}),e.jsx(h,{className:"h-48 rounded-xl"})]});if(y||!s)return e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("p",{className:"text-muted-foreground",children:e.jsx(o,{devId:"ed2a01",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:72a00579617f5875fd6832c57661025e96aadca5e5aa8f471a4f0cf0afd0bfee"},children:y??"Booking not found"})}),e.jsx(f,{variant:"ghost",className:"mt-4",onClick:()=>{m("/admin/bookings")},children:"Back to bookings"})]});
1const F=s.status.charAt(0).toUpperCase()+s.status.slice(1),k=s.clientName??(s.bookerType==="Client"?"Guest":s.bookerType),P=k.charAt(0).toUpperCase(),T=te(s.serviceDuration),b=J(s.serviceAddress)||null,_=((w=s.addons)==null?void 0:w.reduce((a,l)=>a+parseFloat(l.price),0))??0,C=s.serviceCost?String(parseFloat(s.serviceCost)+_-(s.discountAmount?parseFloat(s.discountAmount):0)):null,E=(((K=s.addons)==null?void 0:K.length)??0)>0,U=(((A=s.questions_with_answers)==null?void 0:A.length)??0)>0,R=s.discountAmount?parseFloat(s.discountAmount)>0:!1;return e.jsxs($.Fragment,{children:[e.jsxs(Z,{children:[e.jsx("title",{children:"Booking Detail — Kimlin Admin"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"}),e.jsx("meta",{name:"description",content:"This page is not indexed by search engines."}),e.jsx("link",{rel:"canonical",href:"https://kimlinenergy.com/admin/bookings"})]}),e.jsxs("div",{className:"max-w-2xl space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{variant:"ghost",size:"icon",onClick:()=>{m("/admin/bookings")},children:e.jsx(ee,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-xl font-bold text-foreground",children:["Booking #",s.confirmationCode??s.id.slice(0,8)]}),e.jsx("span",{className:q("rounded-full px-2.5 py-1 text-xs font-medium",ne[s.status]??"bg-muted text-muted-foreground"),children:e.jsx(o,{devId:"67034d",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:cc16ae7ba7d651e6e2a2f7986dcfa798383bcc45e9c35f077df65379c38e6993"},children:F})})]})]}),s.serviceName&&e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[e.jsx("h2",{className:"mb-3 font-semibold text-foreground",children:"Service"}),e.jsx("p",{className:"mb-3 text-base font-medium text-foreground",children:e.jsx(o,{devId:"d02178",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:6a1018de8e92a4d99230115f3424ff09ca0d66ceaff403679acc6b3b13e87ee5"},children:s.serviceName})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.serviceCost&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-muted px-3 py-1 text-xs font-medium text-foreground",children:[e.jsx(se,{className:"h-3 w-3"}),c(s.serviceCost,r)]}),T&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-muted px-3 py-1 text-xs font-medium text-foreground",children:[e.jsx(M,{className:"h-3 w-3"}),T]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[e.jsx("h2",{className:"mb-3 font-semibold text-foreground",children:"Client"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-sm font-semibold text-primary",children:P}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:e.jsx(o,{devId:"0da922",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:625c4fd6e3d1af48f5edde754ba5c86d862b870f69555a1f2c00a4a8986d3fc6"},children:k})}),s.clientEmail&&e.jsx("p",{className:"text-xs text-muted-foreground",children:e.jsx(o,{devId:"0da923",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:df21fdd700f108ef55604ddab4b78d4ca7b2b1659a71d9c282afffebb5d4cd03"},children:s.clientEmail})})]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[e.jsx("h2",{className:"mb-3 font-semibold text-foreground",children:"Details"}),e.jsx(n,{label:"Date",value:s.startTime?new Date(s.startTime).toLocaleDateString([],{weekday:"long",month:"long",day:"numeric",year:"numeric",timeZone:p}):"—"}),e.jsx(n,{label:"Time",value:s.startTime?new Date(s.startTime).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",timeZone:p}):"—"}),e.jsx(n,{label:"End Time",value:s.endTime?new Date(s.endTime).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",timeZone:p}):"—"}),e.jsx(n,{label:"Quantity",value:s.quantity}),s.staffName&&e.jsx(n,{label:"Staff",value:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(G,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.staffName]})}),b&&e.jsx(n,{label:"Customer address",value:e.jsxs("span",{className:"flex items-center gap-1.5 text-right",children:[e.jsx(S,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),b]})}),!b&&s.serviceLocationType==="customer_location"&&e.jsx(n,{label:"Customer address",value:e.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(S,{className:"h-3.5 w-3.5 shrink-0"}),"No address provided"]})}),s.serviceLocationType==="custom"&&s.customLocationText&&e.jsx(n,{label:"Location",value:s.customLocationText}),s.serviceLocationType==="virtual"&&e.jsx(n,{label:"Location",value:"Online"}),s.serviceCost&&e.jsx(n,{label:"Service Cost",value:c(s.serviceCost,r)}),E?e.jsx(e.Fragment,{children:s.addons.map(a=>e.jsx(n,{label:`+ ${a.title}`,value:c(a.price,r)},a.id))}
1):null,s.couponCode?e.jsxs(e.Fragment,{children:[e.jsx(n,{label:"Coupon Applied",value:e.jsx("span",{className:"rounded bg-green-100 px-2 py-1 font-mono text-xs text-green-700 dark:bg-green-900 dark:text-green-300",children:e.jsx(o,{devId:"df0457",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:a4d0fdf2f915133ae8eb347466c2c36f11009a59c0de22ff094af595073dc4fa"},children:s.couponCode})})}),R?e.jsx(n,{label:"Discount",value:e.jsxs("span",{className:"font-medium text-green-600 dark:text-green-400",children:["-",c(s.discountAmount,r)]})}):null]}):null,C!==null&&e.jsx(n,{label:"Final Price",value:e.jsx("span",{className:"font-semibold",children:e.jsx(o,{devId:"62ae19",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:6911c8bee9675afda26aa60e4f8528e16f66e7bcaa4d1211c21f651d07a5608b"},children:c(C,r)})})}),e.jsx(n,{label:"Confirmation Code",value:e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground",children:e.jsx(o,{devId:"a482fa",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:34551f31e7ec9f79108489c55f136e9de29f9209ffc2111d4b691767b2b973bc"},children:s.confirmationCode??s.id.slice(0,8)})})})]}),U?e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[e.jsx("h2",{className:"mb-3 font-semibold text-foreground",children:"Customer Responses"}),e.jsx("div",{className:"space-y-4",children:s.questions_with_answers.map(a=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{className:"text-sm font-medium text-foreground",children:[a.question,a.required&&e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx("p",{className:"rounded-lg bg-muted/50 px-3 py-2 text-sm text-muted-foreground",children:a.answer??"Not provided"})]},a.id))})]}):null,e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[e.jsx("h2",{className:"mb-3 font-semibold text-foreground",children:"Customer Notes"}),e.jsx("p",{className:"rounded-lg bg-muted/50 px-3 py-2 text-sm text-muted-foreground",children:e.jsx(o,{devId:"18837c",guard:{file:"src/pages/admin/bookings/[id].tsx",tagName:"p",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:3f75ad181406e0429f8e80e3b36ae63bc7fb3f6a1226bebbab464fc26da55e6d"},children:s.clientNotes??"Not provided"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.status==="unpaid"&&e.jsxs(f,{onClick:()=>{D()},disabled:N,children:[e.jsx(V,{className:"mr-2 h-4 w-4"}),"Mark as Paid"]}),s.status!=="cancelled"&&e.jsxs(f,{variant:"outline",onClick:()=>{B("cancelled")},disabled:N,className:"border-destructive/20 text-destructive hover:bg-destructive/10",children:[e.jsx(ae,{className:"mr-2 h-4 w-4"}),"Cancel Booking"]})]})]})]})}export{ve 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.