1import{r as t,H as g,i as u,j as e}from"./index-CcaPaFKR.js";import{B as y}from"./Button-DviqAEY1.js";import{F as f}from"./PlusIcon-CNVP6X1w.js";import{F as b}from"./PencilIcon-SvYa_ey3.js";import"./clsx-B-dksMZM.js";const j={zovv_go:"Zovv Go",zovv_pro:"Zovv Pro",zovv_pay:"Zovv Pay",zovv_assist:"Zovv Assist"},v=r=>r.subscribed_products.map(a=>j[a]||a).join(", ")||"None",w=()=>{const[r,a]=t.useState([]),[d,l]=t.useState(!0),[n,x]=t.useState(null),[i,m]=t.useState(""),o=g();t.useEffect(()=>{u.get("/organizations/platform-organizations/").then(s=>{const c=s.data.results||s.data;a(Array.isArray(c)?c:[])}).catch(()=>x("Failed to load organizations")).finally(()=>l(!1))},[]);const p=s=>{o(`/admin/organizations/${s.id}`)},h=r.filter(s=>!i.trim()||s.name.toLowerCase().includes(i.trim().toLowerCase()));return e.jsxs("div",{className:"bg-white shadow rounded-lg",children:[e.jsxs("div",{className:"px-6 py-4 flex flex-col sm:flex-row sm:items-end sm:justify-between gap-3",children:[e.jsxs("div",{className:"w-full sm:w-64",children:[e.jsx("label",{className:"block text-[11px] font-bold text-gray-500 mb-1 uppercase tracking-wide",children:"Search"}),e.jsx("input",{type:"text",value:i,onChange:s=>m(s.target.value),placeholder:"Search by organization name...",className:"h-10 w-full border border-gray-300 rounded px-3 py-2 text-[13px] focus:outline-none focus:ring-1 focus:ring-primary-500 focus:border-primary-500"})]}),e.jsxs(y,{onClick:()=>o("/admin/organizations/new"),className:"flex items-center bg-primary-500 text-white px-3 py-2 rounded shadow-sm hover:bg-primary-500",children:[e.jsx(f,{className:"w-5 h-5 mr-1"})," New Organization"]})]}),e.jsx("div",{className:"px-6 pb-6",children:d?e.jsxs("div",{className:"flex justify-center items-center py-12",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-500"}),e.jsx("span",{className:"ml-2 text-gray-600",children:"Loading organizations..."})]}):n?e.jsx("div",{className:"rounded-md bg-red-50 p-4",children:e.jsx("div",{className:"text-sm font-medium text-red-800",children:n})}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 bg-white",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Name"}),e.jsx("th",{className:"px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Subscription"}),e.jsx("th",{className:"px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Products"}),e.jsx("th",{className:"px-6 py-3 bg-gray-50 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:h.map(s=>e.jsxs("tr",{className:"bg-white hover:bg-gray-50",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:s.name}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 capitalize",children:s.subscription_status}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700",children:v(s)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-center",children:e.jsxs("button",{onClick:()=>p(s),className:"inline-flex items-center text-primary-600 hover:text-blue-900 font-medium",children:[e.jsx(b,{className:"w-4 h-4 mr-1"}),"Manage"]})})]},s.id))})]})})})]})},O=()=>e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Organizations"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 mb-4",children:"Manage which products each organization is subscribed to."})]}),e.jsx(w,{})]});export{O as OrganizationsPage};
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.