PageSourceSearch

https://care.soberpedia.ai/assets/DashboardRoute-_7FgdzMk.js

js soberpedia.ai collected 2026-10-05 15:09:04 UTC 12,645 bytes, 1 lines download raw bytes

1import{r as m,j as e,L}from"./react-vendor-CU6Sz31W.js";import{i as x,E as P,aA as j,c7 as F,c8 as T,c9 as I,ca as $,cb as A,I as R,U as z,al as q,b as D,dX as B,be as V}from"./index-DEXJEDAi.js";import{R as M}from"./RoutePageHeader-9W0v4VlT.js";import"./calendar-RV2oTCrW.js";import{a as U}from"./DataTableCard-BluwWKn_.js";import"./ExportCsvAction-BJr9eiP6.js";import{P as W}from"./patient-name-link-BAfQKbEs.js";import"./text-highlight-BFqqfcjs.js";import{P as G}from"./PracticeFormDialog-RdnfXKaS.js";import{p as N}from"./api-DkVW0jWd.js";import{A as _}from"./AccessDenied-Ba4b0-Uz.js";import{u as J}from"./useOpenPatientProfile-CASNKG5E.js";import{v as K}from"./visitPresentation-CQKFg6I_.js";import{P as Q}from"./PracticeUserDirectory-IShCHR3g.js";import{u as X,P as f}from"./usePracticeRoute-BanfQY79.js";import"./firebase-w6DYUbFN.js";import"./payment-icons-Daq1K3F1.js";import"./RoutePageHeaderContent-FkxdZGox.js";import"./addWeeks-1hrFjz19.js";import"./index-BSuGcRaZ.js";import"./table-CxPdvV_9.js";import"./arrow-up-D6DFVL4j.js";import"./arrow-down-BjUlbB4f.js";import"./pill-filter-CtZSNPVl.js";import"./date-picker-filter-Qp1kqu9t.js";import"./clear-filters-button-DmPemFGr.js";import"./modal-option-cards-Dksohkou.js";import"./use-unsaved-changes-B6nL5Xdd.js";import"./modal-form-CqN5DZuv.js";import"./shield-alert-DjOj07_r.js";import"./PracticeAccountPanel-QQHtjc0s.js";import"./AvailabilityEditor-TPypWqhY.js";import"./api-DY4FU5Af.js";import"./PracticeSetupForm-CggMMYGi.js";import"./PolicyAgreementChecklist-bNROQwu5.js";import"./interactive-checkbox-card-shZR8BJj.js";import"./date-of-birth-picker-BQ2yrZNI.js";import"./PracticeNotificationSettings-BT7Yt_vd.js";const S={body:{label:"Body measurements",fields:[["weight","Weight",1,3e3]]},activity:{label:"Activity",fields:[["steps","Steps",0,2e5],["activeMinutes","Active minutes",0,1440]]},nutrition:{label:"Nutrition",fields:[["calories","Calories",0,2e4],["proteinGrams","Protein (g)",0,5e3],["carbsGrams","Carbohydrates (g)",0,5e3],["fatGrams","Fat (g)",0,5e3],["waterOz","Water (oz)",0,1024]]},sleep:{label:"Sleep",fields:[["hoursSlept","Hours slept",0,24],["sleepQuality","Sleep quality (0–10)",0,10]]},mind:{label:"Mood and stress",fields:[["moodScore","Mood (0–10)",0,10],["stressLevel","Stress (0–10)",0,10],["breathingMinutes","Breathing minutes",0,1440]]},symptom:{label:"Symptoms",fields:[["severity","Severity (0–10)",0,10],["duration","Duration (minutes)",0,525600]]}},Z=Object.fromEntries(Object.values(S).flatMap(o=>o.fields.map(([n,i])=>[n,i])));function ee(o){var n;return Object.entries(o.values||{}).filter(([i,l])=>l!=null&&l!==""&&!["unit","notes"].includes(i)).map(([i,l])=>`${Z[i]||i}: ${typeof l=="object"?JSON.stringify(l):l}${i==="weight"?` ${o.values.unit||"lbs"}`:""}`).concat((n=o.values)!=null&&n.notes?[o.values.notes]:[]).join(" · ")||"Health update"}function te({practiceId:o}){const[n,i]=m.useState([]),[l,d]=m.useState(null),[p,c]=m.useState(!0),[g,h]=m.useState(""),[u,v]=m.useState(0),[y,a]=m.useState(null);m.useEffect(()=>{const t=new AbortController;return c(!0),h(""),N(o,"/health-logs",{signal:t.signal}).then(r=>{t.signal.aborted||(i(r.logs),d(r.nextCursor))}).catch(r=>{r.name!=="AbortError"&&h(r.message)}).finally(()=>{t.signal.aborted||c(!1)}),()=>t.abort()},[o,u]);const b=[{id:"date",header:"Date",renderCell:t=>t.date},{id:"category",header:"Category",renderCell:t=>{var r;return((r=S[t.category])==null?void 0:r.label)||t.category}},{id:"values",header:"Your update",renderCell:ee}];return e.jsxs("section",{className:"space-y-4","aria-labelledby":"practice-health-logs",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"practice-health-logs",className:"font-display text-xl",children:"Your health updates"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Record measurements, habits, or symptoms to share with your care team."})]}),e.jsx(x,{onClick:()=>a({requestId:crypto.randomUUID(),date:new Date().toISOString().slice(0,10),category:"body",values:{unit:"lbs"}}),children:"Add health update"})]}),g?e.jsx(P,{reason:"error",title:"Unable to load health updates",description:g,action:e.jsx(x,{variant:"outline",onClick:()=>v(t=>t+1),children:"Try again"})}):e.jsx(U,{tableLabel:"Your health updates",rows:n,columns:b,loading:p,emptyMessage:e.jsx(P,{reason:"empty",title:"No health updates yet",description:"Add an update to start tracking your health."})})," ",l&&!g&&e.jsx(x,{variant:"outline",disabled:p,onClick:async()=>{c(!0),h("");try{const t=await N(o,`/health-logs?after=${encodeURIComponent(l)}`);i(r=>[...r,...t.logs]),d(t.nextCursor)}catch(t){h(t.message)}finally{c(!1)}},children:"Load earlier updates"}),y&&e.jsx(G,{title:"Add health update",initial:y,saveLabel:"Save update",onClose:()=>a(null),onSave:async t=>{const r=Object.fromEntries(Object.entries(t.values).filter(([,s])=>s!==""&&s!=null));if(!Object.keys(r).some(s=>s!=="unit"))throw new Error("Enter a measurement, symptom, or note.");await N(o,"/health-logs",{method:"POST",body:{requestId:t.requestId,logs:[{category:t.category,date:t.date,values:r}]}}),v(s=>s+1)},children:(t,r)=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"practice-health-category",children:"Category"}),e.jsxs(F,{value:t.category,onValueChange:s=>{r("category",s),r("values",s==="body"?{unit:"lbs"}:{})},children:[e.jsx(T,{id:"practice-health-category",children:e.jsx(I,{})}),e.jsx($,{children:Object.entries(S).map(([s,w])=>e.jsx(A,{value:s,children:w.label},s))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"practice-health-date",children:"Date"}),e.jsx(R,{id:"practice-health-date",type:"date",required:!0,max:new Date().toISOString().slice(0,10),value:t.date,onChange:s=>r("date",s.target.value)})]}),t.category==="symptom"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"practice-health-symptom",children:"Symptom"}),e.jsx(R,{id:"practice-health-symptom",required:!0,maxLength:300,value:t.values.symptom||"",onChange:s=>r("values",{...t.values,symptom:s.target.value})})]}),S[t.category].fields.map(([s,w,Y,H])=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:`practice-health-${s}`,required:!1,children:w}),e.jsx(R,{id:`practice-health-${s}`,type:"number",step:"any",min:Y,max:H,value:t.values[s]??"",onChange:k=>r("values",{...t.values,[s]:k.target.value===""?"":Number(k.target.value)})})]},s)),t.category==="body"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"practice-health-unit",children:"Weight unit"}),e.jsxs(F,{value:t.values.unit||"lbs",onValueChange:s=>r("values",{...t.values,unit:s}),children:[e.jsx(T,{id:"practice-health-unit",children:e.jsx(I,{})}),e.jsxs($,{children:[e.jsx(A,{value:"lbs",children:"Pounds (lbs)"}),e.jsx(A,{value:"kg",children:"Kilograms (kg)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"practice-health-notes",required:!1,children:"Notes"}),e.jsx(z,{id:"practice-health-notes",maxLength:2e3,value:t.values.notes||"",onChange:s=>r("values",{...t.values,notes:s.target.value})})]})]})})]})}const se=[{title:"Your care",description:"Follow your visits, complete forms, and contact your care team.",links:[["Your visits","/sync-visits"],["Required forms","/forms"],["Messages","/messages"]]},{title:"Treatments and appointments",description:"Explore treatments, book a service, and track y
1our orders.",links:[["Products","/products"],["Book a service","/services"],["Your orders","/orders"]]}];function ae({practiceId:o,userDoc:n}){const{branding:i}=q(),l=(i==null?void 0:i.accentColor)||D;return e.jsxs("div",{className:"app-page-shell space-y-6",children:[e.jsx(M,{title:`Welcome${n!=null&&n.firstName?`, ${n.firstName}`:""}`,description:"Your care, appointments, and health updates in one place."}),e.jsx("section",{className:"grid grid-cols-1 gap-4 md:grid-cols-2","aria-label":"Your Practice care",children:se.map(d=>e.jsxs("article",{className:"rounded-xl p-5 text-white",style:{backgroundColor:l},children:[e.jsx("h2",{className:"font-sans font-semibold",children:d.title}),e.jsx("p",{className:"mt-2 text-sm",children:d.description}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:d.links.map(([p,c])=>e.jsx(x,{asChild:!0,size:"sm",className:"rounded-full bg-white hover:bg-white",style:{color:l},children:e.jsx(L,{to:c,children:p})},c))})]},d.title))}),e.jsx(te,{practiceId:o})]})}function ie({practiceId:o}){const[n,i]=m.useState([]),[l,d]=m.useState(!0),[p,c]=m.useState(""),[g,h]=m.useState(0),{openPatientProfile:u,buildPatientProfileHref:v}=J();m.useEffect(()=>{const a=new AbortController;return i([]),d(!0),c(""),N(o,"/administration/dashboard",{signal:a.signal}).then(b=>{a.signal.aborted||i(b.visits)}).catch(b=>{b.name!=="AbortError"&&c(b.message)}).finally(()=>{a.signal.aborted||d(!1)}),()=>a.abort()},[o,g]);const y=[{id:"patientName",header:"Patient",renderCell:a=>e.jsx(W,{patientId:a.patientId,name:a.patientName,href:v(a.patientId),onOpen:u})},{id:"status",header:"Status",renderCell:a=>K(a.status)},{id:"providerName",header:"Assigned to",renderCell:a=>a.providerName},{id:"updatedAt",header:"Updated",renderCell:a=>a.updatedAt?new Date(a.updatedAt).toLocaleString():"Not recorded"},{id:"action",header:"Details",renderCell:a=>e.jsx(x,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(L,{to:`/${a.mode==="async"?"async-visits":"sync-visits"}?visit=${encodeURIComponent(a.id)}`,children:"View visit"})})}];return e.jsxs("section",{className:"space-y-4","aria-labelledby":"practice-clinical-activity",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h2",{id:"practice-clinical-activity",className:"font-display text-xl",children:"Recent clinical activity"}),e.jsx(x,{variant:"outline",disabled:l,onClick:()=>h(a=>a+1),children:"Refresh activity"})]}),p?e.jsx(P,{reason:"error",title:"Unable to load clinical activity",description:p,action:e.jsx(x,{variant:"outline",onClick:()=>h(a=>a+1),children:"Try again"})}):e.jsx(U,{tableLabel:"Recent Practice visits",rows:n,columns:y,loading:l,emptyMessage:e.jsx(P,{reason:"empty",title:"No clinical activity yet",description:"Visits appear here as your Practice receives requests for care."})})]})}const O={title:"Clinical care",description:"Review submitted encounters and manage scheduled visits.",links:[["Review asynchronous visits","/async-visits"],["Open scheduled visits","/sync-visits"]]},C={title:"Patient coordination",description:"Find patient records and respond to care-team conversations.",links:[["Open patients","/patients"],["Open messages","/messages"]]},E={title:"Service appointments",description:"Manage treatment bookings and your team’s availability.",links:[["Open service calendars","/service-calendars"]]},re={title:"Products and treatments",description:"Manage your Practice’s products, protocols, services, and labs.",links:[["Open products","/products"],["Open labs","/labs"]]};function Be(){const{loading:o,role:n,userDoc:i,practiceId:l,userType:d}=X(),{branding:p}=q();if(o)return e.jsx(B,{title:"Dashboard",message:"Loading your Practice…"});if(l&&V(d,"Patient"))return e.jsx(ae,{practiceId:l,userDoc:i},l);if(!n)return e.jsx(_,{subject:"dashboard"});const c=n===f.ADMIN,g=n===f.STAFF?[C,E]:n===f.DELEGATE?[O,C]:c?[O,E,C,re]:[O,E,C],h=(p==null?void 0:p.accentColor)||D;return e.jsxs("div",{className:"app-page-shell space-y-6",children:[e.jsx(M,{title:`Welcome${i!=null&&i.firstName?`, ${i.firstName}`:""}`,description:"Your Practice’s patient care and daily operations."}),e.jsxs("section",{className:"space-y-4","aria-labelledby":"practice-dashboard-actions",children:[e.jsx("h2",{id:"practice-dashboard-actions",className:"font-display text-xl",children:"Action items"}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:g.map(u=>e.jsxs("article",{className:"rounded-xl p-5 text-white",style:{backgroundColor:h},children:[e.jsx("h3",{className:"font-sans font-semibold",children:u.title}),e.jsx("p",{className:"mt-2 text-sm",children:u.description}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:u.links.map(([v,y])=>e.jsx(x,{asChild:!0,size:"sm",className:"rounded-full bg-white hover:bg-white",style:{color:h},children:e.jsx(L,{to:y,children:v})},y))})]},u.title))})]}),n!==f.STAFF&&e.jsx(ie,{practiceId:l}),c&&e.jsxs("section",{className:"space-y-4","aria-labelledby":"practice-dashboard-team",children:[e.jsx("h2",{id:"practice-dashboard-team",className:"font-display text-xl",children:"Practice team"}),e.jsx(Q,{showHeader:!1})]})]})}export{Be 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.