1import{j as e}from"./app-C1iegf7Q.js";import{h as v,b as N,H as k,L as o,f as r}from"./inertia-BpyZy4w-.js";import{I as y}from"./input-DJt0nBB3.js";import{a as w}from"./admin-layout-BhXWbUlP.js";import{a as d}from"./utils-BiuKVCuu.js";import{P as _}from"./plus-BJl-aJiX.js";import{S}from"./search-BY9GDMxP.js";import{C as P}from"./circle-check-big-AJlsIacq.js";import{C}from"./circle-x-Bp6Mbpgt.js";import{a as A,T as $}from"./thumbs-up-BUoe2j5t.js";import{L as T}from"./log-in-Dg2nNREu.js";import{S as I}from"./square-pen-DgHxGDPS.js";import{T as L}from"./trash-2-CrI9a2Po.js";/* empty css */import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./createLucideIcon-wqc1LSWg.js";import"./info-D2ZN_yLm.js";import"./triangle-alert-C7AVwNi-.js";import"./circle-check-BMWvzPMx.js";import"./x-DQSeRCcH.js";import"./arrow-left-DCX0fhKH.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";function F({type:l}){return l==="partner"?e.jsx("span",{className:"inline-flex items-center rounded-tag bg-teal/10 px-1.5 py-0.5 text-2xs font-bold uppercase tracking-pill text-teal",children:"Partner"}):l==="team"?e.jsx("span",{className:"inline-flex items-center rounded-tag bg-lime/20 px-1.5 py-0.5 text-2xs font-bold uppercase tracking-pill text-lime-ink",children:"Team"}):e.jsx("span",{className:"inline-flex items-center rounded-tag bg-bg-2 px-1.5 py-0.5 text-2xs font-bold uppercase tracking-pill text-ink-3",children:"Specialist"})}function D(l){const a=l.trim().split(/\s+/);return a.length===1?a[0].slice(0,2).toUpperCase():(a[0][0]+a[a.length-1][0]).toUpperCase()}function de(){const{props:l}=v(),{providers:a,stats:n,filters:i}=l,[c,x]=N.useState(i.search||""),p=t=>{t.preventDefault(),r.get("/admin/providers",{...i,search:c},{preserveState:!0})},m=t=>{r.get("/admin/providers",{...i,status:t||void 0},{preserveState:!0})},h=t=>{const s=t.portal_user_name??t.name;confirm(`Log in as ${s}? You will see their provider dashboard.`)&&r.post(`/admin/providers/${t.slug}/impersonate`)},b=t=>{confirm("Delete this provider? This cannot be undone if they have completed bookings.")&&r.delete(`/admin/providers/${t}`)},u=t=>{confirm("Approve this provider application?")&&r.post(`/admin/providers/${t}/approve`,{},{preserveScroll:!0})},g=t=>{const s=prompt("Enter rejection reason:");s&&r.post(`/admin/providers/${t}/reject`,{rejection_reason:s},{preserveScroll:!0})},f=[{label:"All",value:null},{label:`Pending${n.pending>0?` (${n.pending})`:""}`,value:"pending"},{label:"Active",value:"active"},{label:"Inactive",value:"inactive"},{label:"Featured",value:"featured"}],j=t=>d("rounded-tag px-2.5 py-1 text-xs font-medium transition-colors",t?"bg-ink text-white":"bg-bg-2 text-ink-2 hover:bg-line");return e.jsxs(w,{children:[e.jsx(k,{title:"Providers · Admin"}),e.jsxs("div",{className:"px-4 py-5 sm:px-6 sm:py-7",children:[e.jsxs("div",{className:"mb-5 flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-ink",children:"Providers"}),e.jsx("p",{className:"mt-0.5 text-sm text-ink-3",children:"Specialists, partners, and team providers"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o,{href:"/admin/specialists",className:"inline-flex items-center gap-1.5 rounded-lg border border-line bg-white px-3 py-1.5 text-sm font-medium text-ink-2 hover:bg-bg-2",children:"View workload"}),e.jsxs(o,{href:"/admin/providers/create",className:"inline-flex items-center gap-1.5 rounded-lg bg-ink px-4 py-2 text-sm font-medium text-white hover:bg-ink/90",children:[e.jsx(_,{className:"h-3.5 w-3.5"}),"Add provider"]})]})]}),e.jsx("div",{className:"mb-5 grid grid-cols-3 gap-3 sm:grid-cols-5",children:[{label:"Total",value:n.total},{label:"Pending",value:n.pending},{label:"Active",value:n.active},{label:"Featured",value:n.featured},{label:"Stripe",value:n.stripe_connected}].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-3xl leading-none text-ink",children:t.value})]},t.label))}),e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-3",children:[e.jsxs("form",{onSubmit:p,className:"relative flex-1 max-w-xs",children:[e.jsx(S,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),e.jsx(y,{type:"search",placeholder:"Search providers...",value:c,onChange:t=>x(t.target.value),className:"h-8 pl-8 text-sm"})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:f.map(t=>e.jsx("button",{type:"button",onClick:()=>m(t.value),className:j(t.value===null?!i.status:i.status===t.value),children:t.label},String(t.value)))})]}),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:"Provider"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Specialties"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Services"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Stripe"}),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-right text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Actions"})]})}),e.jsx("tbody",{children:a.data.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-10 text-center text-sm text-ink-3",children:"No providers found"})}):a.data.map(t=>e.jsxs("tr",{className:"cursor-pointer border-b border-line-2 last:border-0 hover:bg-bg-2",onClick:()=>r.visit(`/admin/providers/${t.slug}/edit`),children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-bg-2 text-2xs font-bold text-ink-3",children:t.avatar?e.jsx("img",{src:t.avatar,alt:t.name,className:"h-8 w-8 rounded-full object-cover"}):D(t.name)}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-sm font-semibold text-ink",children:t.name}),e.jsx(F,{type:t.provider_type})]}),e.jsx("p",{className:"mt-0.5 truncate text-xs text-ink-3",children:t.title||t.slug})]})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(t.specialties||[]).slice(0,2).map(s=>e.jsx("span",{className:"rounded-tag bg-bg-2 px-1.5 py-0.5 text-2xs font-bold text-ink-3",children:s},s)),(t.specialties||[]).length>2&&e.jsxs("span",{className:"rounded-tag bg-bg-2 px-1.5 py-0.5 text-2xs font-bold text-ink-3",children:["+",t.specialties.length-2]})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-ink-2",children:t.services_count||0}),e.jsx("td",{className:"px-4 py-3",children:t.stripe_onboarding_complete?e.jsx(P,{className:"h-4 w-4 text-green-ink"}):e.jsx(C,{className:"h-4 w-4 text-ink-3"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[t.approval_status==="pending"?e.jsx("span",{className:"rounded-tag border border-amber/30 bg-amber/12 px-2 py-0.5 text-2xs font-bold text-amber-ink",children:"Pending"}):t.is_active?e.jsx("span",{className:"rounded-tag bg-green/10 px-2 py-0.5 text-2xs font-bold text-green-ink",children:"Active"}):e.jsx("span",{className:"rounded-tag bg-bg-2 px-2 py-0.5 text-2xs font-bold text-ink-3",children:"Inactive"}),t.approval_status==="rejected"&&e.jsx("span",{className:"rounded-tag bg-red/10 px-2 py-0.5 text-2xs font-bold text-red",children:"Rejected"}),t.is_featured&&e.jsx("span",{className:"rounded-tag bg-lime/20 px-2 py-0.5 text-2xs font-bold text-lime-ink",children:"Featured"})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[t.approval_status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),u(t.slug)}
1,title:"Approve",className:"flex h-7 w-7 items-center justify-center rounded-md border border-line bg-white text-ink-3 hover:bg-green/10 hover:text-green-ink hover:border-green/20",children:e.jsx(A,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),g(t.slug)},title:"Reject",className:"flex h-7 w-7 items-center justify-center rounded-md border border-line bg-white text-ink-3 hover:bg-red/10 hover:text-red hover:border-red/20",children:e.jsx($,{className:"h-3.5 w-3.5"})})]}),e.jsx("button",{type:"button",disabled:!t.has_portal_access,onClick:s=>{s.stopPropagation(),h(t)},title:t.has_portal_access?`Log in as ${t.portal_user_name??t.name}`:"No linked account yet. Invite them first.",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 disabled:cursor-not-allowed disabled:opacity-40",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsx(o,{href:`/admin/providers/${t.slug}/edit`,onClick:s=>s.stopPropagation(),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(I,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),b(t.slug)},className:"flex h-7 w-7 items-center justify-center rounded-md border border-line bg-white text-ink-3 hover:border-red/30 hover:bg-red/10 hover:text-red",children:e.jsx(L,{className:"h-3.5 w-3.5"})})]})})]},t.id))})]})}),a.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:a.last_page},(t,s)=>s+1).map(t=>e.jsx("button",{type:"button",onClick:()=>r.get("/admin/providers",{...i,page:t},{preserveState:!0}),className:d("min-w-7 rounded-md px-2 py-1 text-xs font-medium",t===a.current_page?"bg-ink text-white":"border border-line bg-white text-ink-2 hover:bg-bg-2"),children:t},t))})]})]})]})}export{de 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.