PageSourceSearch

https://app.psychreport.ai/assets/session-new-Tn047Vkv.js

js psychreport.ai collected 2026-10-05 14:12:23 UTC 3,724 bytes, 1 lines download raw bytes

1import{a8 as y,s as f,o as N,b as v,t as b,j as s,C as d,B as m,L as u,at as w,g as C,h as S,i as I,z as n,H as x,E as D}from"./index-CREIb8fj.js";import{H as r}from"./header-7rGDf7B-.js";import{S as L}from"./session-form-YuW1qQGO.js";import{f as P}from"./client-guardians-BYZeL428.js";import"./dropdown-menu-CoXAWKDn.js";import"./index-CPd2V67_.js";import"./megaphone-BaHBaP_d.js";import"./circle-GPDBqDzX.js";import"./activity-JxjUizZb.js";import"./scroll-area-BOgYt5--.js";import"./shield-check-G1soq_df.js";import"./format-JTsCMcxv.js";import"./en-US-CWMsrfO-.js";import"./user-plus-Dl4uLf4e.js";import"./textarea-DJMatDgV.js";import"./pricingPlans-J6gOBJsS.js";import"./circle-help-BP2Cv9s2.js";import"./date-picker-Dutu8VcV.js";import"./calendar-pDeIylXs.js";import"./chevron-left-B0c4ZgeF.js";import"./calendar-hP_68NOg.js";import"./session-types-BYotWRKe.js";import"./info-tynCp0NR.js";function ts(){const[q,o]=y(),{isAuthenticated:p}=f(),{toast:l}=N(),t=new URLSearchParams(window.location.search).get("clientId"),{data:e,isLoading:h}=v({queryKey:[`/api/clients/${t}`],enabled:p&&!!t}),c=b({mutationFn:async a=>{const{evaluationDate:i,...j}=a,g=i?x(i instanceof Date?i:new Date(i)):x();return await(await D("POST","/api/evaluation-sessions",{...j,sessionDate:g,clientId:t})).json()},onSuccess:()=>{n.invalidateQueries({queryKey:["/api/evaluation-sessions"]}),n.invalidateQueries({queryKey:[`/api/clients/${t}/sessions`]}),n.invalidateQueries({queryKey:["/api/sessions-with-assessments"]}),l({title:"Session Created",description:"The evaluation session has been successfully created."}),o(`/clients/${t}`)},onError:a=>{l({title:"Error",description:"Failed to create session. Please try again.",variant:"destructive"})}});return h?s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx(r,{}),s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})]}):e?s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx(r,{}),s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[s.jsxs("div",{className:"mb-8 flex items-center gap-4",children:[s.jsx(u,{href:`/clients/${t}`,children:s.jsx(m,{variant:"ghost",size:"icon",children:s.jsx(w,{className:"h-4 w-4"})})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Create New Session"}),s.jsxs("p",{className:"text-gray-600 mt-1",children:["For ",e.lastName,", ",e.firstName," ",e.middleInitial||""]}),(e.studentId||e.guardians&&e.guardians.length>0)&&s.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[e.studentId&&s.jsxs("span",{"data-testid":"text-client-student-id",children:["Student ID: ",e.studentId]}),e.studentId&&e.guardians&&e.guardians.length>0&&s.jsx("span",{className:"mx-2",children:"·"}),e.guardians&&e.guardians.length>0&&s.jsxs("span",{"data-testid":"text-client-guardians",children:["Guardians: ",P(e.guardians)]})]})]})]}),s.jsxs(d,{children:[s.jsx(C,{children:s.jsx(S,{children:"Session Details"})}),s.jsx(I,{children:s.jsx(L,{onSubmit:a=>c.mutate(a),isLoading:c.isPending,onCancel:()=>o(`/clients/${t}`),initialData:{clientId:t||""}})})]})]})]}):s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx(r,{}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:s.jsxs(d,{className:"p-8 text-center",children:[s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Client not found"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Please select a client to create a session."}),s.jsx(m,{asChild:!0,children:s.jsx(u,{href:"/clients",children:"Back to Clients"})})]})})]})}export{ts 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.