PageSourceSearch

https://xterns.ai/assets/SuperAdminBusinesses-DnLyYOi-.js

js xterns.ai collected 2026-10-05 13:23:52 UTC 4,573 bytes, 1 lines download raw bytes

1import{r,j as e,D as c,B as x,L as u,I as g,h as j,i as N,k as w,J as v,m as y,q as S}from"./index-DLd_kDlx.js";import{S as b}from"./SuperAdminLayout-BsUvQU2j.js";import{l as C}from"./businessManagement-BTTXtuIj.js";import{P as L}from"./plus-0WhrdjYO.js";import{S as B}from"./search-DFH5eAlA.js";import{L as E}from"./loader-circle-D2miE2xB.js";import{E as _}from"./eye-CRDofLPH.js";import"./NotificationIcon-C1wwYnH5.js";import"./popover-BMD5FOmU.js";import"./scroll-area-BXTuUF24.js";import"./index-Deh-4PO1.js";import"./index-BdQq_4o_.js";import"./NotificationItem-Dc2WXW-y.js";import"./formatDistanceToNow-57P64IbE.js";import"./en-US-9SRVm7yB.js";import"./differenceInCalendarMonths-BA0TPVs2.js";import"./endOfDay-DkR3ZXc8.js";import"./endOfMonth-CYn6pTOm.js";import"./message-square-CtxeCfRz.js";import"./trophy-DBX-jNOC.js";import"./triangle-alert-Chqk_WK7.js";import"./dropdown-menu-DSd1c3Vk.js";import"./index-lTaZyIGy.js";import"./chevron-right-CD1gvy-q.js";import"./crown-hzm_bRIt.js";import"./user-check-DxoAQXwU.js";import"./star-BH1OFEcs.js";import"./globe-C057RQ73.js";import"./timer-CZhDpZys.js";import"./briefcase-business-CphIeAJd.js";import"./key-round-B79BulHq.js";function D(a){const i=new Date().toISOString().slice(0,10);return a.status!=="active"?{label:a.status,className:"bg-slate-100 text-slate-700"}:i<a.activation_start_date?{label:"Scheduled",className:"bg-amber-100 text-amber-800"}:i>a.activation_end_date?{label:"Expired",className:"bg-red-100 text-red-800"}:{label:"Active",className:"bg-emerald-100 text-emerald-800"}}const oe=()=>{const[a,i]=r.useState([]),[n,p]=r.useState(""),[h,l]=r.useState(!0),[o,m]=r.useState(null);r.useEffect(()=>{(async()=>{try{l(!0),m(null),i(await C())}catch(s){m(s instanceof Error?s.message:"Unable to load businesses")}finally{l(!1)}})()},[]);const d=r.useMemo(()=>{const t=n.trim().toLowerCase();return t?a.filter(s=>[s.name,s.industry,s.description].some(f=>f.toLowerCase().includes(t))):a},[a,n]);return e.jsx(b,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-6 w-6 text-primary"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Business Management"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Onboard client organizations and manage their activation windows."})]}),e.jsx(x,{asChild:!0,className:"gap-2",children:e.jsxs(u,{to:"/super-admin/businesses/new",children:[e.jsx(L,{className:"h-4 w-4"}),"Create Business"]})})]}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(B,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(g,{placeholder:"Search businesses...",value:n,onChange:t=>p(t.target.value),className:"pl-9"})]}),h?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(E,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):o?e.jsx("p",{className:"text-sm text-destructive",children:o}):d.length===0?e.jsxs("div",{className:"rounded-lg border bg-white py-16 text-center",children:[e.jsx(c,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground"}),e.jsx("p",{className:"font-medium",children:"No businesses found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Create the first client organization to begin onboarding admins."})]}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:d.map(t=>{const s=D(t);return e.jsxs(j,{className:"hover:shadow-md transition-shadow",children:[e.jsx(N,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(w,{className:"truncate text-lg",children:t.name}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t.industry})]}),e.jsx(v,{className:s.className,children:s.label})]})}),e.jsxs(y,{className:"space-y-4",children:[e.jsx("p",{className:"line-clamp-3 text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(S,{className:"h-4 w-4"}),e.jsxs("span",{children:[new Date(t.activation_start_date).toLocaleDateString()," - ",new Date(t.activation_end_date).toLocaleDateString()]})]}),e.jsx(x,{asChild:!0,variant:"outline",className:"w-full gap-2",children:e.jsxs(u,{to:`/super-admin/businesses/${t.id}`,children:[e.jsx(_,{className:"h-4 w-4"}),"View Business"]})})]})]},t.id)})})]})})};export{oe 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.