PageSourceSearch

https://plus4.ai/assets/Dashboard-BwHQayHJ.js

js plus4.ai collected 2026-10-05 15:19:52 UTC 4,428 bytes, 1 lines download raw bytes

1import{r as c,aN as w,j as e,c as m,d as x,n as S,aR as i,a2 as C,az as D,b2 as T}from"./index-CuBJvi3o.js";import{T as I,a as L,b as h,c as u,d as R,e as r}from"./table-D7rP_C6j.js";import{S as k}from"./searchable-select-C7sAesum.js";import"./command-B7iXYv6G.js";import"./search-CLJug8CE.js";import"./chevrons-up-down-CUVK1DsB.js";const p="all";function N(t){return t.toLocaleString("en-US",{style:"currency",currency:"USD"})}function M(t){return t?new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"No orders"}function g(t){return t.toISOString().slice(0,10)}function $(){const t=c.useMemo(()=>{const s=new Date;return s.setDate(s.getDate()-29),g(s)},[]),f=c.useMemo(()=>g(new Date),[]),[d,v]=c.useState(p),{data:b,isLoading:o}=w({queryKey:["/api/franchisee/summary",t,f],queryFn:async()=>(await T("GET",`/api/franchisee/summary?from=${t}&to=${f}`)).json()}),l=b?.clinics??[],y=c.useMemo(()=>{const s=[{value:p,label:"All clinics",pinTop:!0}];for(const a of l)s.push({value:String(a.clinicId),label:a.clinicName});return s},[l]),n=c.useMemo(()=>d===p?l:l.filter(s=>String(s.clinicId)===d),[l,d]),j=c.useMemo(()=>({clinics:n.length,orderCount:n.reduce((s,a)=>s+a.orderCount,0),revenue:n.reduce((s,a)=>s+a.revenue,0)}),[n]);return e.jsxs("div",{className:"space-y-6 p-4 md:p-6","data-testid":"franchisee-dashboard",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Franchisee Dashboard"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Orders and revenue across your clinics for the last 30 days."})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[e.jsx(m,{children:e.jsxs(x,{className:"flex items-center gap-4 p-6",children:[e.jsx("div",{className:"rounded-md bg-muted p-3",children:e.jsx(S,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Clinics"}),o?e.jsx(i,{className:"mt-1 h-7 w-16"}):e.jsx("p",{className:"text-2xl font-semibold","data-testid":"kpi-clinics",children:j.clinics})]})]})}),e.jsx(m,{children:e.jsxs(x,{className:"flex items-center gap-4 p-6",children:[e.jsx("div",{className:"rounded-md bg-muted p-3",children:e.jsx(C,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Orders"}),o?e.jsx(i,{className:"mt-1 h-7 w-16"}):e.jsx("p",{className:"text-2xl font-semibold","data-testid":"kpi-orders",children:j.orderCount})]})]})}),e.jsx(m,{children:e.jsxs(x,{className:"flex items-center gap-4 p-6",children:[e.jsx("div",{className:"rounded-md bg-muted p-3",children:e.jsx(D,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Revenue"}),o?e.jsx(i,{className:"mt-1 h-7 w-24"}):e.jsx("p",{className:"text-2xl font-semibold","data-testid":"kpi-revenue",children:N(j.revenue)})]})]})})]}),e.jsx("div",{className:"max-w-xs",children:e.jsx(k,{options:y,value:d,onValueChange:v,placeholder:"All clinics",testId:"franchisee-clinic-filter"})}),e.jsx(m,{children:e.jsx(x,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(I,{children:[e.jsx(L,{children:e.jsxs(h,{children:[e.jsx(u,{children:"Clinic"}),e.jsx(u,{className:"text-right",children:"Orders"}),e.jsx(u,{className:"text-right",children:"Revenue"}),e.jsx(u,{className:"text-right",children:"Last order"})]})}),e.jsx(R,{children:o?Array.from({length:3}).map((s,a)=>e.jsxs(h,{children:[e.jsx(r,{children:e.jsx(i,{className:"h-5 w-40"})}),e.jsx(r,{className:"text-right",children:e.jsx(i,{className:"ml-auto h-5 w-10"})}),e.jsx(r,{className:"text-right",children:e.jsx(i,{className:"ml-auto h-5 w-20"})}),e.jsx(r,{className:"text-right",children:e.jsx(i,{className:"ml-auto h-5 w-24"})})]},a)):n.length===0?e.jsx(h,{children:e.jsx(r,{colSpan:4,className:"py-10 text-center text-sm text-muted-foreground",children:"No clinics in your portfolio for this period."})}):n.map(s=>e.jsxs(h,{"data-testid":`franchisee-dashboard-row-${s.clinicId}`,children:[e.jsx(r,{className:"font-medium",children:s.clinicName}),e.jsx(r,{className:"text-right",children:s.orderCount}),e.jsx(r,{className:"text-right",children:N(s.revenue)}),e.jsx(r,{className:"text-right text-muted-foreground",children:M(s.lastOrderAt)})]},s.clinicId))})]})})})})]})}export{$ 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.