1import{j as e}from"./app-C1iegf7Q.js";import{h as y,b as N,H as k,L as x,f as c}from"./inertia-BpyZy4w-.js";import{I as w}from"./input-DJt0nBB3.js";import{S as o,e as m,f as p,a as h,c as s}from"./select-Bn8hgKYl.js";import{a as S}from"./admin-layout-BhXWbUlP.js";import{a as u}from"./utils-BiuKVCuu.js";import{A as _}from"./arrow-left-DCX0fhKH.js";import{S as P}from"./search-BY9GDMxP.js";import{S as C}from"./shield-check-CdWPLoDE.js";import{C as A}from"./clock-BtI_SZvJ.js";import{U as B}from"./user-check-SeZyvKBM.js";import{E}from"./eye-DoZffUO5.js";/* empty css */import"./index-BdQq_4o_.js";import"./index-Dc_FVRD7.js";import"./index-B0NHTN87.js";import"./index-CGXdj8xB.js";import"./index-C48dRAib.js";import"./index-BDqbV96p.js";import"./index-Cja0wFUH.js";import"./index-CL12STDK.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-x-Bp6Mbpgt.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 F={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"},L={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 Se(){const{props:b}=y(),{bookings:l,stats:r,payoutStats:i,providers:g,filters:a}=b,[j,f]=N.useState(a.search||""),v=t=>{t.preventDefault(),c.get("/admin/providers/bookings",{...a,search:j},{preserveState:!0})},n=(t,d)=>{c.get("/admin/providers/bookings",{...a,[t]:d||void 0},{preserveState:!0})};return e.jsxs(S,{children:[e.jsx(k,{title:"Provider Bookings · Admin"}),e.jsxs("div",{className:"px-4 py-5 sm:px-6 sm:py-7",children:[e.jsxs("div",{className:"mb-5",children:[e.jsxs(x,{href:"/admin/providers",className:"mb-2 inline-flex items-center gap-1 text-xs font-medium text-ink-3 hover:text-ink",children:[e.jsx(_,{className:"h-3.5 w-3.5"}),"Back to Providers"]}),e.jsx("h1",{className:"text-xl font-semibold text-ink",children:"Provider Bookings"}),e.jsx("p",{className:"mt-0.5 text-sm text-ink-3",children:"Manage bookings, statuses and provider payouts"})]}),e.jsx("div",{className:"mb-5 grid grid-cols-2 gap-3 md:grid-cols-4 lg:grid-cols-7",children:[{label:"Total",value:r.total},{label:"Pending",value:r.pending_payment},{label:"Confirmed",value:r.confirmed},{label:"Scheduled",value:r.scheduled},{label:"Completed",value:r.completed},{label:"Payout Pending",value:r.payout_pending},{label:"Payout Eligible",value:r.payout_eligible}].map(t=>e.jsxs("div",{className:"rounded-card border border-line bg-white p-4",children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:t.label}),e.jsx("p",{className:"mt-1.5 font-serif text-2xl leading-none text-ink",children:t.value})]},t.label))}),e.jsxs("div",{className:"mb-5 rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-ink",children:"Payout Summary"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Pending Amount"}),e.jsxs("p",{className:"mt-1 text-sm font-semibold text-ink",children:["£",i.total_pending_amount?.toFixed(2)||"0.00"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Total Paid"}),e.jsxs("p",{className:"mt-1 text-sm font-semibold text-green-ink",children:["£",i.total_paid_amount?.toFixed(2)||"0.00"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Processing"}),e.jsx("p",{className:"mt-1 text-sm font-semibold text-ink",children:i.processing})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Failed"}),e.jsx("p",{className:"mt-1 text-sm font-semibold text-red",children:i.failed})]})]})]}),e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.jsxs("form",{onSubmit:v,className:"relative flex-1 min-w-[180px] max-w-xs",children:[e.jsx(P,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),e.jsx(w,{type:"search",placeholder:"Search by user...",value:j,onChange:t=>f(t.target.value),className:"h-8 pl-8 text-sm"})]}),e.jsxs(o,{value:a.status||"",onValueChange:t=>n("status",t||null),children:[e.jsx(m,{className:"h-8 w-[150px] text-sm",children:e.jsx(p,{placeholder:"Status"})}),e.jsxs(h,{children:[e.jsx(s,{children:"All Statuses"}),e.jsx(s,{value:"pending_payment",children:"Pending Payment"}),e.jsx(s,{value:"confirmed",children:"Confirmed"}),e.jsx(s,{value:"scheduled",children:"Scheduled"}),e.jsx(s,{value:"completed",children:"Completed"}),e.jsx(s,{value:"cancelled",children:"Cancelled"})]})]}),e.jsxs(o,{value:a.payout_status||"",onValueChange:t=>n("payout_status",t||null),children:[e.jsx(m,{className:"h-8 w-[150px] text-sm",children:e.jsx(p,{placeholder:"Payout Status"})}),e.jsxs(h,{children:[e.jsx(s,{children:"All Payouts"}),e.jsx(s,{value:"pending",children:"Pending"}),e.jsx(s,{value:"processing",children:"Processing"}),e.jsx(s,{value:"completed",children:"Completed"}),e.jsx(s,{value:"failed",children:"Failed"})]})]}),e.jsxs(o,{value:a.provider_id||"",onValueChange:t=>n("provider_id",t||null),children:[e.jsx(m,{className:"h-8 w-[180px] text-sm",children:e.jsx(p,{placeholder:"Provider"})}),e.jsxs(h,{children:[e.jsx(s,{children:"All Providers"}),g.map(t=>e.jsx(s,{value:t.id.toString(),children:t.name},t.id))]})]})]}),e.jsxs("div",{className:"overflow-hidden rounded-card border border-line bg-white",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-line-2 bg-bg-2",children:[e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"User"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Service"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Provider"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Amount"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Status"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Payout"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-right text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Actions"})]})}),e.jsx("tbody",{children:l.data.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"py-10 text-center text-sm text-ink-3",children:"No bookings found"})}):l.data.map(t=>e.jsxs("tr",{className:"border-b border-line-2 last:border-0 hover:bg-bg-2",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("p",{className:"text-sm font-semibold text-ink",children:t.user.name}),e.jsx("p",{className:"mt-0.5 text-xs text-ink-3",children:t.user.email})]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-ink-2",children:t.service.title}),e.jsx("p",{className:"mt-0.5 text-xs text-ink-3",children:t.service.service_type})]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{href:`/admin/providers/${t.provider.slug}/edit`,className:"text-sm text-ink-2 hover:text-teal hover:underline",children:t.provider.name}),t.is_borderless_booking&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-tag bg-lime/20 px-2 py-0.5 text-2xs font-bold text-lime-ink",children:[e.jsx(C,{className:"h-3 w-3"}),"Borderless"]})]}),t.is_pending_assignment&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-amber-ink",children:[e.jsx(A,{className:"h-3 w-3"}),"Pending Assignment"]}),t.assigned_at&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-green-ink",children:[e.jsx(B,{className:"h-3 w-3"}),"Assigned"]})]}),e.jsx("td",{className:"px-4 py-3 text-sm font-semibold text-ink",children:t.payment.amount&&e.jsxs("span",{children:[t.payment.currency==="GBP"?"£":"$",t.payment.amount]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:u("inline-flex items-center rounded-tag px-2 py-0.5 text-2xs font-bold",F[t.status]),children:t.status})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:u("inline-flex items-center rounded-tag px-2 py-0.5 text-2xs font-bold",L[t.payout_status]),children:t.payout_status}),t.payout_amount&&e.jsxs("div",{className:"text-xs text-ink-3",children:["£",t.payout_amount]})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-ink-3",children:new Date(t.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex justify-end",children:e.jsx(x,{href:`/admin/providers/bookings/${t.id}`,className:"flex h-7 w-7 items-center justify-center rounded-md border border-line bg-white text-ink-3 hover:bg-bg-2 hover:text-ink",children:e.jsx(E,{className:"h-3.5 w-3.5"})})})})]},t.id))})]})}),l.last_page>1&&e.jsx("div",{className:"flex items-center justify-center gap-1.5 border-t border-line-2 px-4 py-3",children:Array.from({length:l.last_page},(t,d)=>d+1).map(t=>e.jsx("button",{type:"button",onClick:()=>c.get("/admin/providers/bookings",{...a,page:t},{preserveState:!0}),className:u("min-w-[28px] rounded-md px-2 py-1 text-xs font-medium",t===l.current_page?"bg-ink text-white":"border border-line bg-white text-ink-2 hover:bg-bg-2"),children:t},t))})]})]})]})}export{Se 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.