1import{u as T,a as P,p as b,i as c,r as w,j as e,af as f,ap as m,ag as A,a9 as E,cz as x,cc as M,cy as V,n as R,b as B,A as D,a8 as u,N as H,g as S,O as I,d as q}from"./index-4ng2XTnA.js";import{L as G}from"./Loop-atip6cJb.js";import{i as K,g as y,a as k,s as N,b as W,u as L,v as _,r as F}from"./form-validation-CSCyw0Rc.js";import{u as z}from"./promise.hook-wd1IaplE.js";import{I as Y}from"./InnerHeader.component-DPSRXCuc.js";import{g as J,c as Q,s as U}from"./cla.actions-rWfS3sy9.js";import{F as l}from"./FormControlLabel-FyK8eetS.js";import{C as d}from"./Checkbox-C2SsTmJY.js";import"./fromPairs-OpLZi5q5.js";import"./Card-B5Fc8mGU.js";const g=R("div")({marginTop:"10px",marginBottom:"10px",paddingBottom:"10px"}),v=R("div")({marginTop:8,marginBottom:8}),X=({email:a,password:n})=>H.put("cla/auth",{email:a,password:n}),Z=a=>a.target.value,$={email:{default:"",validation:[F("An email is required to integrate CLA")]},password:{default:"",validation:[F("A password is required to integrate CLA")]},rememberMe:{default:!1}},ee=({patch:a,cla:n})=>{const o=s=>p=>{p.target.checked?a("cla",S({allowedScans:I([s])},n)):a("cla",S({allowedScans:q(s)},n))},{allowedScans:t=[],newPatientCreate:i}=n;return e.jsxs("div",{children:[e.jsxs(g,{children:[e.jsx(x,{variant:"h6",children:"Allow New Patient Creation"}),e.jsx(m,{children:"Enabling this will automatically add new patients into CLA"}),e.jsx("div",{style:{marginBottom:"10px"}}),e.jsx(l,{label:"Enabled",control:e.jsx(d,{checked:i,onChange:s=>a("cla",D("newPatientCreate",s.target.checked,n))})})]}),e.jsx(u,{}),e.jsxs(g,{children:[e.jsx(x,{variant:"h6",children:"Allow CORESCORE"}),e.jsx(m,{children:"Enabling this will display the CORESCORE in the app."}),e.jsx("div",{style:{marginBottom:"10px"}}),e.jsx(l,{label:"Enabled",control:e.jsx(d,{checked:!c("CoreScore",t),onChange:o("CoreScore")})})]}),e.jsx(u,{}),e.jsxs(g,{children:[e.jsx(x,{variant:"h6",children:"Allow Exam Report"}),e.jsx(m,{children:"Enabling this will allow clients to view their exam report in the app."}),e.jsx("div",{style:{marginBottom:"10px"}}),e.jsx(l,{label:"Enabled",control:e.jsx(d,{checked:!c("ExamReport",t),onChange:o("ExamReport")})})]}),e.jsx(u,{}),e.jsxs(g,{children:[e.jsx(x,{variant:"h6",children:"Allow Scans"}),e.jsx(m,{children:"Enabling these will allow the respective scan to be viewed in the app."}),e.jsx("div",{style:{marginBottom:"10px"}}),e.jsx(l,{label:"EMG",control:e.jsx(d,{checked:!c("EMG",t),onChange:o("EMG")})}),e.jsx(l,{label:"HRV",control:e.jsx(d,{checked:!c("HRV",t),onChange:o("HRV")})}),e.jsx(l,{label:"Thermal",control:e.jsx(d,{checked:!c("Thermal",t),onChange:o("Thermal")})}),e.jsx(l,{label:"Algo",control:e.jsx(d,{checked:!c("Algo",t),onChange:o("Algo")})}),e.jsx(l,{label:"ROM",control:e.jsx(d,{checked:!c("ROM",t),onChange:o("ROM")})})]})]})},he=()=>{const a=T(),{busy:n,hasFeature:o,cla:t}=P(r=>({hasFeature:c("SkedApp",b([],["login","features"],r)),cla:r.settingsApp.cla,busy:b({},["settingsApp","busy"])(r)}));w.useEffect(()=>{a(J())},[]);const i=z(X,{}),[s,p]=w.useState(K($)),C=(r="",h=Z)=>j=>p(B(L(r,h(j)),_(r))),O=r=>{r.preventDefault();const h=N(s);if(p(h),!h.__form.isValid){console.log("form not valid");return}const j=W(h);i.invoke(j).then(()=>{a(M("Saved CLA email and password. The password has been cleared from the input to keep your account secure.")),p(L("password",""))}).catch(()=>{a(V("Failed to save email and password"))})};return e.jsxs(e.Fragment,{children:[e.jsx(Y,{title:"CLA Integration",pageId:"cla-integration"}),e.jsxs("div",{style:{padding:"20px",overflowY:"auto"},children:[e.jsx(f,{style:{padding:"20px"},children:e.jsxs("form",{onSubmit:O,children:[e.jsx(v,{children:e.jsx(m,{children:"Enter the email and password of your CLA instance so SKED can integrate with CLA. This will let your patients see their CLA scans in the SKED app."})}),e.jsx(v,{children:e.jsx(A,{autoFocus:!0,style:{minWidth:256},id:"login-email",label:"Email",type:"email",helperText:k("email",s),error:!s.email.isValid,value:y("email",s),onChange:C("email")})}),e.jsx(v,{children:e.jsx(A,{style:{minWidth:256},id:"login-password",label:"Password",type:"password",helperText:k("password",s),error:!s.password.isValid,value:y("password",s),onChange:C("password")})}),e.jsx(E,{variant:"contained",type:"submit",disabled:i.loading,startIcon:i.loading?e.jsx(G,{}):null,color:"primary",children:i.loading?"Loading...":"Save"}),i.errorMessage&&e.jsxs("div",{children:["Error: ",i.errorMessage,". The email and password may be incorrect or SKED may not be able to reach CLA's servers."]})]})}),o&&e.jsxs(f,{style:{padding:"20px",marginTop:"20px"},children:[e.jsx(x,{variant:"h6",children:"CLA Reports"}),e.jsx(ee,{cla:t,patch:(r,h)=>a(Q(r,h))}),n?e.jsx("div",{className:"loader"}):e.jsx(E,{variant:"contained",onClick:()=>a(U(t)),children:"Save"})]})]})]})};export{he 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.