1import{j as e}from"./app-C1iegf7Q.js";import{h as L,u as j,H as I,L as b,f as g}from"./inertia-BpyZy4w-.js";import{A as T,b as U,a as V}from"./avatar-C7fKgiRY.js";import{B as o}from"./button-BE4q1_FS.js";import{I as $}from"./input-DJt0nBB3.js";import{L as m}from"./label-Czc25Mye.js";import{S as N,e as f,f as k,a as v,c as d}from"./select-Bn8hgKYl.js";import{S as z}from"./switch-DhdMz2rn.js";import{T as F}from"./textarea-CXLxrYIG.js";import{a as E}from"./admin-layout-BhXWbUlP.js";import{a as p}from"./utils-BiuKVCuu.js";import{A as M}from"./arrow-left-DCX0fhKH.js";import{S as y}from"./shield-check-CdWPLoDE.js";import{C as H}from"./calendar-C9IvR7oY.js";import{U as w}from"./user-check-SeZyvKBM.js";import{C as _}from"./clock-BtI_SZvJ.js";import{C as R}from"./circle-check-big-AJlsIacq.js";import{C as G}from"./circle-x-Bp6Mbpgt.js";import{V as X}from"./video-CJHgxwGi.js";import{M as q}from"./map-pin-CrQmCnbd.js";import{D as J}from"./dollar-sign-Ck66Jney.js";import{S as K}from"./send-COySMMwK.js";/* empty css */import"./index-Cja0wFUH.js";import"./index-CL12STDK.js";import"./index-DdRFMukF.js";import"./index-B9qJRYKv.js";import"./index-CGXdj8xB.js";import"./index-BdQq_4o_.js";import"./index-Dc_FVRD7.js";import"./index-B0NHTN87.js";import"./index-C48dRAib.js";import"./index-BDqbV96p.js";import"./Combination-Cr5kvm8y.js";import"./index-C_n-C52S.js";import"./index-D4vO54bj.js";import"./index-BRU_LjHB.js";import"./index-XydtsrKA.js";import"./index-Cs5D2gCo.js";import"./index-DyGg2PJd.js";import"./chevron-down-B1YaU0K5.js";import"./createLucideIcon-wqc1LSWg.js";import"./check-0O-UND6N.js";import"./chevron-up-CLp5HMgA.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./info-D2ZN_yLm.js";import"./triangle-alert-C7AVwNi-.js";import"./circle-check-BMWvzPMx.js";import"./x-DQSeRCcH.js";import"./menu-BR3Nc3Gr.js";import"./users-BCcupCXV.js";import"./folder-open-I72SPUVk.js";import"./pound-sterling-D16GLaAZ.js";import"./book-open-DVFlG_9t.js";const O={pending_payment:"bg-amber/12 text-amber-ink",confirmed:"bg-teal/10 text-teal",scheduled:"bg-lime/20 text-lime-ink",completed:"bg-green/10 text-green-ink",cancelled:"bg-red/10 text-red",refunded:"bg-bg-2 text-ink-3"},Q={pending:"bg-amber/12 text-amber-ink",scheduled:"bg-teal/10 text-teal",processing:"bg-lime/20 text-lime-ink",completed:"bg-green/10 text-green-ink",failed:"bg-red/10 text-red",manual:"bg-amber/12 text-amber-ink"};function W({note:a}){const s=a.author_type==="user"||a.author_type==="provider"?"bg-bg-2":a.is_internal?"border border-dashed border-amber/40 bg-amber/12":"bg-bg-2";return e.jsxs("div",{className:p("rounded-lg p-3",s),children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-ink",children:a.author_name}),e.jsx("span",{className:"rounded-tag border border-line bg-white px-2 py-0.5 text-2xs font-bold text-ink-3 capitalize",children:a.author_type}),a.is_internal&&e.jsx("span",{className:"rounded-tag bg-amber/12 px-2 py-0.5 text-2xs font-bold text-amber-ink",children:"Internal"})]}),e.jsx("span",{className:"text-xs text-ink-3",children:new Date(a.created_at).toLocaleString()})]}),e.jsx("p",{className:"whitespace-pre-wrap text-sm text-ink-2",children:a.content})]})}function es(){const{props:a}=L(),{booking:s,user:h,service:i,provider:r,payment:x,notes:u}=a,S=r.name.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),n=j({content:"",author_type:"provider",is_internal:!1}),C=t=>{t.preventDefault(),n.post(`/admin/providers/bookings/${s.uuid}/notes`,{preserveScroll:!0,onSuccess:()=>n.reset("content")})},l=j({status:s.status,scheduled_at:s.scheduled_at||""}),A=()=>{l.patch(`/admin/providers/bookings/${s.uuid}/status`,{preserveScroll:!0})},D=()=>{confirm("Are you sure you want to process this payout?")&&g.post(`/admin/providers/bookings/${s.uuid}/payout`,{},{preserveScroll:!0})},P=()=>{confirm("Assign this booking? The provider will be notified.")&&g.post(`/admin/providers/bookings/${s.uuid}/assign`,{},{preserveScroll:!0})},c=i.service_type==="virtual",B=s.status==="confirmed"&&s.payout_status==="pending"&&s.payout_eligible_at&&new Date(s.payout_eligible_at)<=new Date;return e.jsxs(E,{children:[e.jsx(I,{title:`Booking #${s.id} · Admin`}),e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-5 sm:px-6 sm:py-7",children:[e.jsxs("div",{className:"mb-5",children:[e.jsxs(b,{href:"/admin/providers/bookings",className:"mb-2 inline-flex items-center gap-1 text-xs font-medium text-ink-3 hover:text-ink",children:[e.jsx(M,{className:"h-3.5 w-3.5"}),"Back to Bookings"]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("h1",{className:"text-xl font-semibold text-ink",children:["Booking #",s.id]}),s.is_borderless_booking&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-tag border border-line bg-white px-2 py-0.5 text-2xs font-bold text-ink-2",children:[e.jsx(y,{className:"h-3 w-3"}),"Borderless Service"]})]}),e.jsx("span",{className:p("inline-flex items-center rounded-tag px-2 py-0.5 text-2xs font-bold capitalize",O[s.status]),children:s.status})]})]}),e.jsxs("div",{className:"flex flex-col gap-6",children:[s.is_borderless_booking&&e.jsxs("div",{className:"rounded-card border border-line-strong bg-white p-5",children:[e.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-sm font-semibold text-ink",children:[e.jsx(y,{className:"h-4 w-4 text-lime-ink"}),"Borderless Booking Details"]}
1),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Preferred Date"}),e.jsxs("p",{className:"mt-1 flex items-center gap-1 text-sm text-ink",children:[e.jsx(H,{className:"h-4 w-4"}),s.preferred_date?new Date(s.preferred_date).toLocaleDateString():"Not specified"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Preferred Time"}),e.jsx("p",{className:"mt-1 text-sm capitalize text-ink",children:s.preferred_time||"Not specified"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Assignment Status"}),s.assigned_at?e.jsxs("p",{className:"mt-1 flex items-center gap-1 text-sm font-medium text-green-ink",children:[e.jsx(w,{className:"h-4 w-4"}),"Assigned"]}):e.jsxs("p",{className:"mt-1 flex items-center gap-1 text-sm font-medium text-amber-ink",children:[e.jsx(_,{className:"h-4 w-4"}),"Pending Assignment"]})]})]}),s.user_description&&e.jsxs("div",{className:"mt-4 border-t border-line-2 pt-4",children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"User's Description"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap rounded-md bg-bg-2 p-3 text-sm text-ink-2",children:s.user_description})]}),s.is_pending_assignment&&e.jsxs("div",{className:"mt-4 border-t border-line-2 pt-4",children:[e.jsxs(o,{onClick:P,className:"w-full",children:[e.jsx(w,{className:"mr-2 h-4 w-4"}),"Confirm Assignment to ",r.name]}),e.jsx("p",{className:"mt-2 text-center text-xs text-ink-3",children:"The provider will be notified and can contact the user."})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Customer"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-ink",children:h.name}),e.jsx("p",{className:"text-sm text-ink-3",children:h.email})]})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Provider"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(T,{className:"h-12 w-12",children:[e.jsx(U,{src:r.avatar||void 0}),e.jsx(V,{children:S})]}),e.jsxs("div",{children:[e.jsx(b,{href:`/admin/providers/${r.slug}/edit`,className:"text-sm font-medium text-ink hover:text-teal",children:r.name}),r.title&&e.jsx("p",{className:"text-sm text-ink-3",children:r.title}),e.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[r.stripe_connected?e.jsx(R,{className:"h-4 w-4 text-green-ink"}):e.jsx(G,{className:"h-4 w-4 text-red"}),e.jsx("span",{className:"text-xs text-ink-3",children:r.stripe_connected?"Stripe Connected":"Stripe Not Connected"})]})]})]})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Service"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-ink",children:i.title}),i.description&&e.jsx("p",{className:"mt-1 text-sm text-ink-3",children:i.description})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1 text-ink-2",children:[c?e.jsx(X,{className:"h-4 w-4 text-ink-3"}):e.jsx(q,{className:"h-4 w-4 text-ink-3"}),c?"Virtual":"In-Person"]}),e.jsxs("div",{className:"flex items-center gap-1 text-ink-2",children:[e.jsx(_,{className:"h-4 w-4 text-ink-3"}),i.duration]})]}),c&&i.booking_url&&e.jsxs("div",{className:"border-t border-line-2 pt-2",children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Booking URL"}),e.jsx("a",{href:i.booking_url,target:"_blank",rel:"noopener noreferrer",className:"break-all text-sm text-teal hover:underline",children:i.booking_url})]}),!c&&i.location&&e.jsxs("div",{className:"border-t border-line-2 pt-2",children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Location"}),e.jsx("p",{className:"mt-1 text-sm text-ink",children:i.location})]})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Payment & Payout"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Payment Amount"}),e.jsxs("p",{className:"mt-1 text-sm font-medium text-ink",children:[x.currency==="GBP"?"£":"$",x.amount]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Payment Status"}),e.jsx("p",{className:"mt-1 text-sm font-medium text-ink capitalize",children:x.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Platform Fee (15%)"}),e.jsxs("p",{className:"mt-1 text-sm font-medium text-ink",children:["£",s.platform_fee||"-"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Payout Amount"}),e.jsxs("p",{className:"mt-1 text-sm font-medium text-ink",children:["£",s.payout_amount||"-"]})]})]}),e.jsxs("div",{className:"mt-4 space-y-2 border-t border-line-2 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-ink-2",children:"Payout Status:"}),e.jsx("span",{className:p("inline-flex items-center rounded-tag px-2 py-0.5 text-2xs font-bold capitalize",Q[s.payout_status]),children:s.payout_status})]}),s.payout_eligible_at&&e.jsxs("div",{className:"text-sm text-ink-2",children:[e.jsx("span",{className:"text-ink-3",children:"Eligible at: "}
1),new Date(s.payout_eligible_at).toLocaleString()]}),s.payout_at&&e.jsxs("div",{className:"text-sm text-ink-2",children:[e.jsx("span",{className:"text-ink-3",children:"Paid at: "}),new Date(s.payout_at).toLocaleString()]}),s.payout_transfer_id&&e.jsxs("div",{className:"text-sm text-ink-2",children:[e.jsx("span",{className:"text-ink-3",children:"Transfer ID: "}),e.jsx("code",{className:"rounded bg-bg-2 px-1 py-0.5 text-xs text-ink",children:s.payout_transfer_id})]}),s.payout_error&&e.jsxs("div",{className:"text-sm text-red",children:[e.jsx("span",{className:"text-ink-3",children:"Error: "}),s.payout_error]}),B&&r.stripe_connected&&e.jsxs(o,{onClick:D,className:"mt-2 w-full",children:[e.jsx(J,{className:"mr-1 h-4 w-4"}),"Process Payout"]})]})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Update Status"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Status"}),e.jsxs(N,{value:l.data.status,onValueChange:t=>l.setData("status",t),children:[e.jsx(f,{children:e.jsx(k,{})}),e.jsxs(v,{children:[e.jsx(d,{value:"confirmed",children:"Confirmed"}),e.jsx(d,{value:"scheduled",children:"Scheduled"}),e.jsx(d,{value:"completed",children:"Completed"}),e.jsx(d,{value:"cancelled",children:"Cancelled"})]})]})]}),l.data.status==="scheduled"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Scheduled At"}),e.jsx($,{type:"datetime-local",value:l.data.scheduled_at,onChange:t=>l.setData("scheduled_at",t.target.value)})]}),e.jsx(o,{onClick:A,disabled:l.processing,className:"w-full",children:"Update Status"})]})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Dates"}),e.jsxs("div",{className:"space-y-2 text-sm text-ink-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-ink-3",children:"Booked: "}),new Date(s.created_at).toLocaleString()]}),s.scheduled_at&&e.jsxs("div",{children:[e.jsx("span",{className:"text-ink-3",children:"Scheduled: "}),new Date(s.scheduled_at).toLocaleString()]})]})]})]})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Notes & Messages"}),e.jsxs("div",{className:"space-y-4",children:[u.length===0?e.jsx("p",{className:"py-4 text-center text-sm text-ink-3",children:"No notes yet"}):e.jsx("div",{className:"max-h-96 space-y-3 overflow-y-auto",children:u.map(t=>e.jsx(W,{note:t},t.id))}),e.jsxs("form",{onSubmit:C,className:"space-y-4 border-t border-line-2 pt-4",children:[e.jsx(F,{placeholder:"Add a note...",value:n.data.content,onChange:t=>n.setData("content",t.target.value),rows:3}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"text-sm",children:"Send as:"}),e.jsxs(N,{value:n.data.author_type,onValueChange:t=>n.setData("author_type",t),children:[e.jsx(f,{className:"w-[120px]",children:e.jsx(k,{})}),e.jsxs(v,{children:[e.jsx(d,{value:"provider",children:"Provider"}),e.jsx(d,{value:"admin",children:"Admin"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{checked:n.data.is_internal,onCheckedChange:t=>n.setData("is_internal",t)}),e.jsx(m,{className:"text-sm",children:"Internal (hidden from user)"})]})]}),e.jsxs(o,{type:"submit",disabled:n.processing||!n.data.content.trim(),children:[e.jsx(K,{className:"mr-2 h-4 w-4"}),"Add Note"]})]})]})]})]})]})]})}export{es 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.