PageSourceSearch

https://empiretherapy.net/assets/index-Cy4tCXNv.js

js empiretherapy.net collected 2026-10-07 03:06:28 UTC 8,255 bytes, 1 lines download raw bytes

1import{a as t,j as e}from"./query-YQf5_TCb.js";import{l as C,u as k,n as v,m as A,P as E,X as P,F as R}from"./index-oGxM1WZq.js";import{S as T}from"./skeleton-ujht-kmt.js";import{B as m}from"./button-BoJFaSM5.js";import{I as b}from"./input-Cjf0cD3M.js";import{L as N}from"./label-Kv975ab5.js";import{b as M}from"./badges-BLrCm9sv.js";import{t as F}from"./index-BXi58NoQ.js";import{P as y}from"./plus-Dd8FVPmc.js";import{T as L}from"./trash-2-DoyAYDm9.js";import{C as _}from"./chevron-right-CGrO6W4L.js";import{C as z}from"./circle-alert-BcYOr9z5.js";import"./radix-ui-jHlGqCL3.js";import"./index-BBBx8TSb.js";import"./badge-H6Pm4Z-0.js";import"./clock-SXLyP5J6.js";import"./circle-x-DITAKna9.js";import"./circle-check-CIO_sXYK.js";import"./repeat-CH-BMO49.js";import"./calendar-days-D6orX8WS.js";import"./user-BPMIOR5y.js";import"./briefcase-BnxD0R8q.js";function B({token:n,onClose:x,onSaved:o}){const[d,c]=t.useState(""),[l,p]=t.useState(""),[a,g]=t.useState(""),[f,u]=t.useState(""),[s,i]=t.useState(!1),[j,h]=t.useState(null);async function w(){if(!d.trim()){h("Name is required");return}if(!l.trim()){h("Email is required");return}i(!0),h(null);const r=await v("/api/appointments/admin/staff",n,{method:"POST",body:JSON.stringify({name:d,email:l,phone_number:a||void 0,role:f||"generic"})});if(r.ok)o();else{const S=await r.json().catch(()=>({}));h(S.message??"Failed to create staff member")}i(!1)}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-6 pb-4 pt-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Add Staff Member"}),e.jsx("button",{onClick:x,className:"rounded-lg p-1.5 transition-colors hover:bg-muted",children:e.jsx(P,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"space-y-4 px-6 py-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(N,{children:"Name *"}),e.jsx(b,{value:d,onChange:r=>c(r.target.value),placeholder:"Jane Smith"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(N,{children:["Role ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),e.jsx(b,{value:f,onChange:r=>u(r.target.value),placeholder:"e.g. therapist"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(N,{children:"Email *"}),e.jsx(b,{type:"email",value:l,onChange:r=>p(r.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(N,{children:["Phone ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),e.jsx(b,{type:"tel",value:a,onChange:r=>g(r.target.value),placeholder:"+1 555 000 0000"})]}),j&&e.jsxs("p",{className:"flex items-center gap-1 text-sm text-destructive",children:[e.jsx(z,{className:"h-3.5 w-3.5"}),j]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx(m,{variant:"outline",onClick:x,disabled:s,children:"Cancel"}),e.jsx(m,{onClick:()=>{w()},disabled:s,children:s?"Creating…":"Create Staff Member"})]})]})]})})}function D({staff:n,token:x,onClose:o,onDeleted:d}){const[c,l]=t.useState(!1);async function p(){l(!0);const a=await v(`/api/appointments/admin/staff/${n.id}`,x,{method:"DELETE"});a.ok||a.status===204?d():(F.error("Failed to remove staff member"),l(!1))}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-4 rounded-2xl border border-border bg-card p-6 shadow-xl",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Remove staff member?"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:e.jsx(R,{devId:"7ebd97",guard:{file:"src/pages/admin/staff/index.tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionH
1ash:"sha256:b42964b747eb8314bbc594ccdfb6e0e6a69153ac7c83a252b6c177ffc62fc8ee"},children:n.name??"This staff member"})})," ","will be permanently removed and unlinked from all services."]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx(m,{variant:"outline",onClick:o,disabled:c,children:"Cancel"}),e.jsx(m,{variant:"destructive",onClick:()=>{p()},disabled:c,children:c?"Removing…":"Remove"})]})]})})}function ie(){const{token:n}=C(),x=k(),[o,d]=t.useState([]),[c,l]=t.useState(!0),[p,a]=t.useState(!1),[g,f]=t.useState(null),u=t.useCallback(async()=>{l(!0);const s=await v("/api/appointments/admin/staff?per_page=100",n);if(s.ok){const i=await s.json();d(i.results??[])}l(!1)},[n]);return t.useEffect(()=>{u()},[u]),e.jsxs("div",{className:"space-y-6",children:[p&&e.jsx(B,{token:n,onClose:()=>a(!1),onSaved:()=>{a(!1),u()}}),g&&e.jsx(D,{staff:g,token:n,onClose:()=>f(null),onDeleted:()=>{f(null),u()}}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Staff"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[o.length," staff member",o.length!==1?"s":""]})]}),e.jsxs(m,{onClick:()=>a(!0),children:[e.jsx(y,{className:"mr-1.5 h-4 w-4"})," Add staff"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"border-b border-border bg-muted",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Name"}),e.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Role"}),e.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Email"}),e.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Phone"}),e.jsx("th",{className:"px-4 py-3"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:c?Array.from({length:3}).map((s,i)=>e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-3",children:e.jsx(T,{className:"h-4 w-full"})})},i)):o.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:5,className:"py-10 text-center text-muted-foreground",children:[e.jsx("p",{className:"mb-3",children:"No staff members yet"}),e.jsxs(m,{size:"sm",onClick:()=>a(!0),children:[e.jsx(y,{className:"mr-1.5 h-4 w-4"})," Add your first staff member"]})]})}):o.map(s=>{var i,j;return e.jsxs("tr",{className:"group cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>{x(`/admin/staff/${s.id}`)},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-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:(s.name??"?").charAt(0).toUpperCase()}),e.jsx("span",{className:"font-medium text-foreground",children:s.name??"Unnamed"})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(M,{role:s.role})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:(i=s.contact)!=null&&i.email?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(A,{className:"h-3.5 w-3.5 shrink-0"}),s.contact.email]}):"—"}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:(j=s.contact)!=null&&j.phone_number?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(E,{className:"h-3.5 w-3.5 shrink-0"}),s.contact.phone_number]}):"—"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",onClick:h=>h.stopPropagation(),children:[e.jsx(m,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-destructive opacity-0 transition-opacity hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",onClick:()=>f(s),children:e.jsx(L,{className:"h-3.5 w-3.5"})}),e.jsx(_,{className:"h-4 w-4 text-muted-foreground"})]})})]},s.id)})})]})})]})}export{ie 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.