1import{j as e}from"./app-C1iegf7Q.js";import{h as y,b as w,H as S,L as p,f as a}from"./inertia-BpyZy4w-.js";import{I as _}from"./input-DJt0nBB3.js";import{S as C,e as A,f as D,a as I,c as h}from"./select-Bn8hgKYl.js";import{a as P}from"./admin-layout-BhXWbUlP.js";import{a as d}from"./utils-BiuKVCuu.js";import{P as T}from"./plus-BJl-aJiX.js";import{S as F}from"./search-BY9GDMxP.js";import{C as B}from"./clock-BtI_SZvJ.js";import{C as b}from"./circle-check-big-AJlsIacq.js";import{C as u}from"./circle-x-Bp6Mbpgt.js";import{S as L}from"./sparkles-C0aC1RHI.js";import{S as V}from"./square-pen-DgHxGDPS.js";import{T as $}from"./trash-2-CrI9a2Po.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-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 Pe(){const{props:f}=y(),{services:i,stats:l,categories:x,filters:s}=f,[m,g]=w.useState(s.search||""),j=t=>{t.preventDefault(),a.get("/admin/services",{...s,search:m},{preserveState:!0})},n=(t,r)=>{a.get("/admin/services",{...s,[t]:r||void 0},{preserveState:!0})},v=t=>{confirm("Delete this service?")&&a.delete(`/admin/services/${t}`)},N=t=>{a.patch(`/admin/services/${t}/toggle-active`,{},{preserveState:!0})},o=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(P,{children:[e.jsx(S,{title:"Services · 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:"Borderless Services"}),e.jsx("p",{className:"mt-0.5 text-sm text-ink-3",children:"Manage services offered directly by Borderless"})]}),e.jsxs(p,{href:"/admin/services/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(T,{className:"h-3.5 w-3.5"}),"New service"]})]}),e.jsx("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[{label:"Total",value:l.total},{label:"Active",value:l.active},{label:"Tier pricing",value:l.with_tier_pricing},{label:"Free for Pro",value:l.free_for_pro}].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-2",children:[e.jsxs("form",{onSubmit:j,className:"relative flex-1 max-w-xs",children:[e.jsx(F,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),e.jsx(_,{type:"search",placeholder:"Search services...",value:m,onChange:t=>g(t.target.value),className:"h-8 pl-8 text-sm"})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>n("status",null),className:o(!s.status),children:"All"}),e.jsx("button",{type:"button",onClick:()=>n("status","active"),className:o(s.status==="active"),children:"Active"}),e.jsx("button",{type:"button",onClick:()=>n("status","inactive"),className:o(s.status==="inactive"),children:"Inactive"})]}),x.length>0&&e.jsxs(C,{value:s.category||"all",onValueChange:t=>n("category",t==="all"?null:t),children:[e.jsx(A,{className:"h-8 w-[160px] text-sm",children:e.jsx(D,{placeholder:"All categories"})}),e.jsxs(I,{children:[e.jsx(h,{value:"all",children:"All categories"}),x.map(t=>e.jsx(h,{value:t,children:t},t))]})]})]}),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:"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:"Price"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Duration"}),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:i.data.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-10 text-center text-sm text-ink-3",children:"No services found"})}):i.data.map(t=>{const r=Object.entries(t.tier_access).filter(([,c])=>c.is_included).length,k=Object.entries(t.tier_access).some(([,c])=>!c.is_included&&c.override_price!==null);return 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.title}),e.jsx("p",{className:"mt-0.5 text-xs text-ink-3 capitalize",children:t.service_type==="virtual"?"Virtual":"In-person"})]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("p",{className:"text-sm text-ink-2",children:t.provider.name}),t.provider.specialties?.[0]&&e.jsx("p",{className:"mt-0.5 text-xs text-ink-3",children:t.provider.specialties[0]})]}),e.jsxs("td",{className:"px-4 py-3 text-sm font-semibold text-ink",children:["£",Number(t.price_gbp).toFixed(2)]}),e.jsx("td",{className:"px-4 py-3",children:t.formatted_duration?e.jsxs("div",{className:"flex items-center gap-1 text-sm text-ink-2",children:[e.jsx(B,{className:"h-3 w-3"}),t.formatted_duration]}):e.jsx("span",{className:"text-sm text-ink-3",children:"â"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[e.jsxs("span",{className:d("inline-flex items-center gap-1 rounded-tag px-2 py-0.5 text-2xs font-bold",t.is_active?"bg-green/10 text-green-ink":"bg-bg-2 text-ink-3"),children:[t.is_active?e.jsx(b,{className:"h-3 w-3"}):e.jsx(u,{className:"h-3 w-3"}),t.is_active?"Active":"Inactive"]}),r>0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-tag bg-lime/20 px-2 py-0.5 text-2xs font-bold text-lime-ink",children:[e.jsx(L,{className:"h-3 w-3"}),"Free (",r,")"]}),k&&e.jsx("span",{className:"rounded-tag bg-amber/12 px-2 py-0.5 text-2xs font-bold text-amber-ink",children:"Discounts"})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-end gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>N(t.id),title:t.is_active?"Deactivate":"Activate",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:t.is_active?e.jsx(u,{className:"h-3.5 w-3.5"}):e.jsx(b,{className:"h-3.5 w-3.5"})}),e.jsx(p,{href:`/admin/services/${t.id}/edit`,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(V,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>v(t.id),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($,{className:"h-3.5 w-3.5"})})]})})]},t.id)})})]})}),i.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:i.last_page},(t,r)=>r+1).map(t=>e.jsx("button",{type:"button",onClick:()=>a.get("/admin/services",{...s,page:t},{preserveState:!0}),className:d("min-w-[28px] rounded-md px-2 py-1 text-xs font-medium",t===i.current_page?"bg-ink text-white":"border border-line bg-white text-ink-2 hover:bg-bg-2"),children:t},t))})]})]})]})}export{Pe 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.