1import{m as g,c as i,a as l,b as y,h as U,e as r,d as t,o,l as _,x as f,f as u,g as k,V as I,_ as K,D as R,p as E,F as b,r as z,t as n,E as $,n as V,j as Y,J,A as q,i as G,y as Q}from"./app-DWwbkxzy.js";import{_ as W}from"./AdminLayout-DD0R75QB.js";import"./SidebarLayout-Dfse5RnS.js";const X={class:"mx-auto max-w-7xl px-4 py-2 sm:px-6 lg:px-8"},Z={class:"mb-3"},ee=["href"],te={key:0,class:"flex w-full flex-wrap justify-end gap-3 px-2"},se={class:"mb-4 flex flex-wrap items-end gap-3"},ae={class:"min-w-[200px] flex-1"},ne=["value"],le=["value"],oe={class:"overflow-x-auto"},ie={class:"w-full"},re={class:"border-b bg-gray-50"},de={class:"px-4 py-3 text-left text-sm font-semibold text-gray-700"},ue={class:"text-xs text-gray-400"},me={class:"px-4 py-3 text-left text-sm font-semibold text-gray-700"},xe={class:"text-xs text-gray-400"},ce={class:"px-4 py-3 text-left text-sm font-semibold text-gray-700"},pe={class:"text-xs text-gray-400"},ge={class:"divide-y divide-gray-200"},ye={class:"px-4 py-3"},fe={class:"text-sm font-medium text-gray-900"},be={class:"px-4 py-3 text-sm text-gray-600"},ve={class:"px-4 py-3"},he={class:"px-4 py-3 text-sm text-gray-600"},we={class:"px-4 py-3"},_e={key:0,class:"mt-0.5 text-xs text-gray-500"},ke={class:"px-4 py-3 text-right"},ze={key:0},Ce={key:0,class:"mt-4 flex items-center justify-between border-t pt-3"},Se={class:"text-sm text-gray-700"},Ve={class:"flex gap-1"},Ne=["innerHTML"],Me=Object.assign({layout:null},{__name:"Index",props:{organizations:Object,filters:Object,orgTypes:{type:Array,default:()=>[]}},setup(d){var T,O,A,M,j;const B=q(()=>{var a;return["admin","superadmin"].includes((a=G().props.auth.user)==null?void 0:a.role)}),c=d,v=g(((T=c.filters)==null?void 0:T.search)??""),h=g(((O=c.filters)==null?void 0:O.type)??""),L={individual:"bg-slate-100 text-slate-700",practice:"bg-indigo-100 text-indigo-800",institution:"bg-amber-100 text-amber-900",kiosk:"bg-teal-100 text-teal-800"},D=a=>L[a]??"bg-slate-100 text-slate-700",w=g(((A=c.filters)==null?void 0:A.access)??""),p=g(((M=c.filters)==null?void 0:M.sort)??"name"),m=g(((j=c.filters)==null?void 0:j.direction)??"asc"),F=[{value:"",label:"All access types"},{value:"stripe",label:"Stripe"},{value:"failing",label:"Payment failing"},{value:"amember",label:"aMember"},{value:"trial",label:"Trial"},{value:"comp",label:"Complimentary"},{value:"none",label:"No access"}],x=()=>{Q.get(route("admin.organizations.index"),{search:v.value||void 0,type:h.value||void 0,access:w.value||void 0,sort:p.value,direction:m.value},{preserveState:!0,preserveScroll:!0})},H=()=>{v.value="",h.value="",w.value="",p.value="name",m.value="asc",x()},C=a=>{p.value===a?m.value=m.value==="asc"?"desc":"asc":(p.value=a,m.value="asc"),x()},S=a=>p.value!==a?"â":m.value==="asc"?"â²":"â¼",P=a=>({Stripe:"bg-green-100 text-green-800",Trial:"bg-sky-100 text-sky-800",Comp:"bg-purple-100 text-purple-800",aMember:"bg-amber-100 text-amber-800",Expired:"bg-red-100 text-red-700",None:"bg-gray-100 text-gray-700"})[a]??"bg-gray-100 text-gray-700",N=a=>a.access_source!=="None"?a.access_source:a.had_subscription?"Expired":"None";return(a,e)=>(o(),i(b,null,[l(y(U),{title:"Manage Organizations"}),l(W,{title:"Manage Organizations"},{default:r(()=>[t("div",X,[t("div",Z,[e[6]||(e[6]=t("h1",{class:"text-2xl font-bold text-gray-900"},"Organizations",-1)),e[7]||(e[7]=t("p",{class:"mt-1 text-sm text-gray-600"}," Review practices and individual accounts, their access status, and seat usage. ",-1)),t("a",{href:a.route("admin.guide"),target:"_blank",rel:"noopener",class:"mt-1 inline-block text-sm font-medium text-indigo-600 hover:text-indigo-500"}," ð How to manage users & organizations â ",8,ee)]),B.value?(o(),i("div",te,[l(y(_),{href:a.route("admin.practices.create")},{default:r(()=>[l(f,{variant:"primary",size:"sm"},{default:r(()=>[...e[8]||(e[8]=[u(" + New practice account ",-1)])]),_:1})]),_:1},8,["href"]),l(y(_),{href:a.route("admin.kiosks.create")},{default:r(()=>[l(f,{variant:"white",size:"sm"},{default:r(()=>[...e[9]||(e[9]=[u(" + New kiosk account ",-1)])]),_:1})]),_:1},8,["href"])])):k("",!0),l(I,null,{text:r(()=>[t("div",se,[t("div",ae,[e[10]||(e[10]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700"}," Search ",-1)),l(K,{modelValue:v.value,"onUpdate:modelValue":e[0]||(e[0]=s=>v.value=s),type:"text",placeholder:"Org name, owner name or email...",class:"w-full",onKeyup:R(x,["enter"])},null,8,["modelValue"])]),t("div",null,[e[12]||(e[12]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700"}," Type ",-1)),E(t("select",{"onUpdate:modelValue":e[1]||(e[1]=s=>h.value=s),class:"rounded-md border-gray-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500",onChange:x},[e[11]||(e[11]=t("option",{value:""},"All types",-1)),(o(!0),i(b,null,z(d.orgTypes,s=>(o(),i("option",{key:s.value,value:s.value},n(s.label),9,ne))),128))],544),[[$,h.value]])]),t("div",null,[e[13]||(e[13]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700"}
1," Access ",-1)),E(t("select",{"onUpdate:modelValue":e[2]||(e[2]=s=>w.value=s),class:"rounded-md border-gray-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500",onChange:x},[(o(),i(b,null,z(F,s=>t("option",{key:s.value,value:s.value},n(s.label),9,le)),64))],544),[[$,w.value]])]),l(f,{variant:"primary",onClick:x},{default:r(()=>[...e[14]||(e[14]=[u(" Search ",-1)])]),_:1}),l(f,{variant:"secondary",onClick:H},{default:r(()=>[...e[15]||(e[15]=[u(" Reset ",-1)])]),_:1})]),t("div",oe,[t("table",ie,[t("thead",re,[t("tr",null,[t("th",de,[t("button",{type:"button",class:"inline-flex items-center gap-1 hover:text-indigo-600",onClick:e[3]||(e[3]=s=>C("name"))},[e[16]||(e[16]=u(" Organization ",-1)),t("span",ue,n(S("name")),1)])]),e[19]||(e[19]=t("th",{class:"px-4 py-3 text-left text-sm font-semibold text-gray-700"}," Owner ",-1)),t("th",me,[t("button",{type:"button",class:"inline-flex items-center gap-1 hover:text-indigo-600",onClick:e[4]||(e[4]=s=>C("type"))},[e[17]||(e[17]=u(" Type ",-1)),t("span",xe,n(S("type")),1)])]),t("th",ce,[t("button",{type:"button",class:"inline-flex items-center gap-1 hover:text-indigo-600",onClick:e[5]||(e[5]=s=>C("members"))},[e[18]||(e[18]=u(" Seats ",-1)),t("span",pe,n(S("members")),1)])]),e[20]||(e[20]=t("th",{class:"px-4 py-3 text-left text-sm font-semibold text-gray-700"}
1," Access ",-1)),e[21]||(e[21]=t("th",{class:"px-4 py-3 text-right text-sm font-semibold text-gray-700"}," Actions ",-1))])]),t("tbody",ge,[(o(!0),i(b,null,z(d.organizations.data,s=>(o(),i("tr",{key:s.id,class:"hover:bg-gray-50"},[t("td",ye,[t("div",fe,n(s.name),1)]),t("td",be,n(s.owner??"â"),1),t("td",ve,[t("span",{class:V(["inline-flex rounded-full px-2.5 py-0.5 text-xs font-semibold capitalize",D(s.type)])},n(s.type),3)]),t("td",he,n(s.members)+" / "+n(s.seat_limit),1),t("td",we,[t("span",{class:V([P(N(s)),"inline-flex rounded-full px-2 py-0.5 text-xs font-medium"])},n(N(s)),3),s.auto_renew!==null?(o(),i("div",_e,n(s.auto_renew?"â» auto-renews":"not renewing"),1)):k("",!0)]),t("td",ke,[l(y(_),{href:a.route("admin.organizations.show",s.id)},{default:r(()=>[l(f,{variant:"secondary",size:"sm"},{default:r(()=>[...e[22]||(e[22]=[u(" View ",-1)])]),_:1})]),_:1},8,["href"])])]))),128)),d.organizations.data.length===0?(o(),i("tr",ze,[...e[23]||(e[23]=[t("td",{colspan:"5",class:"px-4 py-8 text-center text-sm text-gray-500"}," No organizations match your search. ",-1)])])):k("",!0)])])]),d.organizations.links.length>3?(o(),i("div",Ce,[t("div",Se," Showing "+n(d.organizations.from)+" to "+n(d.organizations.to)+" of "+n(d.organizations.total)+" organizations ",1),t("div",Ve,[(o(!0),i(b,null,z(d.organizations.links,s=>(o(),Y(J(s.url?y(_):"span"),{key:s.label,href:s.url||void 0,class:V(["rounded px-3 py-1",s.active?"bg-indigo-600 text-white":"bg-white text-gray-700 hover:bg-gray-50",s.url?"":"cursor-not-allowed opacity-50"])},{default:r(()=>[t("span",{innerHTML:s.label},null,8,Ne)]),_:2},1032,["href","class"]))),128))])])):k("",!0)]),_:1})])]),_:1})],64))}});export{Me 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.