1import{az as ns,j as e,r as ce,eS as Pe,M as He,H as G,bl as Me,ak as R,B as T,ac as B,n as de,R as z,bG as ts,P as Re,g as Te,ca as as,a7 as je,c as Ce,N as os,be as is,ex as ls,Q as Be,au as oe,a5 as rs,a6 as L,al as be,ar as cs,d0 as Ne,c$ as ds,d2 as hs,d3 as ps,e as ms,u as us,a0 as xs,a as u,p as S,b as W,i as U,bJ as fs,cq as gs,m as js,cs as _,hn as Cs,G as re,C as bs,$ as ys,cr as Ie,ho as Ee,ct as ks,cu as vs,cv as ws,cw as As,hp as Ss,aw as Ps,a8 as De,hq as Ts,hr as Ns,hs as Is,ht as Es,d as Ds,h as ee,k as se,bn as Ls,e1 as Hs,ae as Le,hu as Ms,hv as Rs,cx as Bs}from"./index-2k2e1F8S.js";import{c as Ws}from"./index-2H8-97Tk.js";import{I as O}from"./Info-v2HnUEsb.js";import{A as Fs}from"./ArrowDropDown-DSpZf4iO.js";import{u as Os}from"./useTitle-CTZNLmI5.js";import{e as $s,s as zs}from"./automations.actions-CtP7CGGz.js";import{u as ie}from"./promise.hook-BeqSMSpU.js";import{P as Vs}from"./PageHeader.component-3dQc61hD.js";import{S as qs}from"./SelectProfessional.component-Dxhisuvv.js";import{T as We,H as C,B as b,a as Fe}from"./TableContainer.component-DbVZvbOn.js";import{H as xe}from"./HeaderCheckbox.component-TOhPuIv5.js";import{I as E}from"./Input.component-x3IBogpr.js";import{P as Us}from"./Google-CLQvVlx_.js";import{b as Ys,c as Gs,T as ye,a as v,d as h}from"./TableRow-B_Xdv0vT.js";import{A as Qs,E as _s}from"./edit-professional.component-BWv4MmFZ.js";import{T as Js}from"./Delete-TmGf8XG4.js";import{A as Ks}from"./Add-BvHB-VPL.js";import{T as Oe}from"./TableHead-BF_d99Ij.js";import{C as Z}from"./Checkbox-CyLj9Qpv.js";import{b as Xs,s as Zs}from"./appointments.service-J_UpJqSF.js";import{i as en}from"./intersection-CvKlKIce.js";import{s as $e}from"./sortWith-CMxVsVLW.js";import{T as sn}from"./Trash.icon-D3NE4Rsn.js";import"./HeaderTabs.component-CEAaAfJ_.js";import"./KeyboardArrowDown-BHrHG3Mm.js";import"./InnerHeader.component-CIjmR-l0.js";import"./Card-sWLQbFU6.js";import"./Professional.icon-DnIWutr2.js";import"./Edit-CnMlClWI.js";import"./FilterHeader.component-9vKVsrMw.js";import"./Help-C015KE1B.js";import"./Button.component-BxpK7Xc6.js";import"./Radio-C6B0eTuQ.js";import"./RadioButtonUnchecked-ksLr7bc4.js";import"./PartialChecked.icon-Cg4BldBY.js";import"./ChevronLeft-B5IBp7lf.js";import"./ChevronRight-D7JFQKUD.js";import"./SidebarFolders.component-Ckn5UdIy.js";import"./ListItem-Bbo2Atif.js";import"./join-l_emI_xZ.js";import"./FormControlLabel-DTmxyUmR.js";import"./inputAdornmentClasses-DAPYZ7aH.js";import"./index-BcA84JJb.js";import"./ApptTypeSelector.component-EWG4Y7VK.js";import"./ExpandLess-Chga_r89.js";import"./Search-CkpQcndd.js";import"./KeyboardArrowUp-BPKn8ZPp.js";import"./Checkbox.component-drCMVWvX.js";import"./useDrop-C-hUx1J0.js";import"./difference-BfmijKj_.js";import"./Box-J9ns1Mf-.js";import"./InputAdornment-D_vrziC0.js";import"./Collapse-CyyoCvKq.js";const nn=ns(e.jsx("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z"}),"Restore"),tn={swatch:{padding:"5px",background:"#fff",borderRadius:"1px",boxShadow:"0 0 0 1px rgba(0,0,0,.1)",display:"inline-block",cursor:"pointer",marginLeft:"45%"}},an=de(Us)({"& > div":{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",paddingRight:5,paddingLeft:5}}),on=({name:t,internalName:a,duration:x,canChange:j,canSee:y,canCancel:f,color:l,notAllowedMinutesBeforeClosing:r,partOfCarePlan:c,rescheduleCutoff:i,cancelCutoff:p,scheduleCutoff:m,ehr:A,hasScheduleCutoff:N,hasCutoff:H,state:k,updateType:o,updateTypeColor:g,close:M,openColor:V,selectTemp:J})=>{const D=l!=null?{h:l.hue,s:l.saturation,l:l.lightness}:{h:0,s:0,l:100},d=l!=null?"hsl("+l.hue+","+l.saturation+"%,"+l.lightness+"%)":"hsl(0,0,100)";return e.jsx(Ys,{children:e.jsx(Gs,{size:"small",style:{overflowY:"scroll"},children:e.jsxs(ye,{children:[A==="None"&&e.jsxs(v,{children:[e.jsx(h,{children:e.jsx("b",{children:"Internal Name:"})}),e.jsx(h,{children:e.jsx(E,{value:a,fullWidth:!0,onChange:n=>o("internalName",n.target.value),placeholder:"Internal Name"})})]},0),e.jsxs(v,{children:[e.jsx(h,{children:e.jsx("b",{children:"Display Name:"})}),e.jsx(h,{children:e.jsx(E,{value:t,fullWidth:!0,onChange:n=>o("name",n.target.value),placeholder:"Display Name"})})]},1),e.jsxs(v,{children:[e.jsx(h,{children:e.jsx("b",{children:"Duration:"})}),e.jsx(h,{children:e.jsx(E,{value:x,type:"number",fullWidth:!0,onChange:n=>o("duration",Number(n.target.value)),placeholder:"Duration"})})]},2),e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Enable Closing Limit:"}),"Â ",e.jsx(R,{title:"Add a limit to how close a client can schedule to closing.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:r!==null,onChange:n=>o("notAllowedMinutesBeforeClosing",n.target.checked?0:null)})})]},3),r!==null&&e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Closing Limit:"}),"Â ",e.jsx(R,{title:"How many minutes before closing can a client schedule this appointment type? Set to 0 to allow scheduling at closing.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsxs(h,{style:{width:"339.65px"},children:[e.jsx(E,{type:"number",sx:{width:70,marginLeft:"25%",verticalAlign:"middle"},value:r,onChange:n=>o("notAllowedMinutesBeforeClosing",Number(n.target.value))}),"Â minutes"]})]},4),e.jsxs(v,{children:[e.jsx(h,{children:e.jsx("b",{children:"Can Cancel:"})}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:f,onChange:n=>
1o("canCancel",n.target.checked)})})]},5),e.jsxs(v,{children:[e.jsx(h,{children:e.jsx("b",{children:"Can Reschedule:"})}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:j,onChange:n=>o("canChange",n.target.checked)})})]},6),e.jsxs(v,{children:[e.jsx(h,{children:e.jsx("b",{children:"Can See:"})}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:y,onChange:n=>o("canSee",n.target.checked)})})]},7),e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Allow on Care Plan:"})," ",e.jsx(R,{title:"With this checkbox enabled, this appointment code counts toward care plan visits.",placement:"top",arrow:!0,slotProps:{tooltip:{sx:{maxWidth:234}}},children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:c,onChange:n=>o("partOfCarePlan",n.target.checked)})})]},8),N&&e.jsxs(e.Fragment,{children:[e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Enable Schedule Cutoff:"})," ",e.jsx(R,{title:"Add a limit to how soon a client can schedule an appointment.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:m!==null,onChange:n=>o("scheduleCutoff",n.target.checked?0:null)})})]},14),m!==null&&e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Schedule Cutoff:"})," ",e.jsx(R,{title:"How many minutes before the appointment time a client can reschedule.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsxs(h,{style:{width:"339.65px",whiteSpace:"nowrap"},children:[e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"days",m),onChange:n=>o("scheduleCutoff",T(m,{days:Number(n.target.value)}))})," days  ",e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"hours",m),onChange:n=>o("scheduleCutoff",T(m,{hours:Number(n.target.value)}))})," hours  ",e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"minutes",m),onChange:n=>o("scheduleCutoff",T(m,{minutes:Number(n.target.value)}))})," minutes"]})]},10)]}),H&&e.jsxs(e.Fragment,{children:[e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Enable Reschedule Cutoff:"})," ",e.jsx(R,{title:"Add a limit to how close to the appointment time a client can reschedule.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:i!==null,onChange:n=>o("rescheduleCutoff",n.target.checked?0:null)})})]},9),i!==null&&e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Reschedule Cutoff:"})," ",e.jsx(R,{title:"How many minutes before the appointment time a client can reschedule.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsxs(h,{style:{width:"339.65px",whiteSpace:"nowrap"},children:[e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"days",i),onChange:n=>o("rescheduleCutoff",T(i,{days:Number(n.target.value)}))})," days  ",e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"hours",i),onChange:n=>o("rescheduleCutoff",T(i,{hours:Number(n.target.value)}))})," hours  ",e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"minutes",i),onChange:n=>o("rescheduleCutoff",T(i,{minutes:Number(n.target.value)}))})," minutes"]})]},10),e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Enable Cancel Cutoff:"})," ",e.jsx(R,{title:"Add a limit to how close to the appointment time a client can cancel.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsx(h,{children:e.jsx("input",{type:"checkbox",style:{marginLeft:"50%"},checked:p!==null,onChange:n=>o("cancelCutoff",n.target.checked?0:null)})})]},11),p!==null&&e.jsxs(v,{children:[e.jsxs(h,{children:[e.jsx("b",{children:"Cancel Cutoff:"})," ",e.jsx(R,{title:"How many minutes before the appointment time a client can cancel.",placement:"top",arrow:!0,children:e.jsx(O,{style:{fontSize:"12px"}})})]}),e.jsxs(h,{style:{width:"339.65px",whiteSpace:"nowrap"},children:[e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"days",p),onChange:n=>
1o("cancelCutoff",T(p,{days:Number(n.target.value)}))})," days  ",e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"hours",p),onChange:n=>o("cancelCutoff",T(p,{hours:Number(n.target.value)}))})," hours  ",e.jsx(E,{type:"number",sx:{width:62,minWidth:62,verticalAlign:"middle"},value:B(0,"minutes",p),onChange:n=>o("cancelCutoff",T(p,{minutes:Number(n.target.value)}))})," minutes"]})]},12)]}),e.jsxs(v,{children:[e.jsx(h,{children:e.jsx("b",{children:"Color:"})}),e.jsxs(h,{children:[e.jsx("div",{style:tn.swatch,onClick:()=>V(D),children:e.jsx("div",{style:{width:"36px",height:"14px",borderRadius:"2px",background:d}})}),k.opened?e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0)",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(an,{header:"Color for "+t,color:k.temp,onChangeComplete:n=>J(n.hsl),onCancel:()=>M(),onAccept:()=>{g("color",{hue:Math.round(Number(k.temp.h)),saturation:Math.round(Number(100*k.temp.s)),lightness:Math.round(Number(100*k.temp.l))})}})}):null]})]},13)]})})})},ln=({open:t,type:a,onClose:x,save:j,doctor:y,ehr:f,hasCutoff:l,hasScheduleCutoff:r})=>{const[c,i]=ce.useState({status:"INIT",busy:!1,type:{}});ce.useEffect(()=>{c.status==="INIT"&&t?(Pe("apptType",a.id>0?a.id:void 0),i({...c,status:"EDIT",type:a})):!t&&c.status!=="INIT"&&(Pe("apptType",void 0),i({...c,status:"INIT"}))},[c.status,t]);const p=g=>{i(T(c,g))},m=(g,M)=>{i({...c,type:{...c.type,[g]:M}})},A=(g,M)=>{const V=T(c.type,{[g]:M});i(T(c,{type:V,opened:!1}))},N=g=>{p({temp:g})},H=g=>{p({opened:!0,temp:g})},k=()=>{p({opened:!1})},o=()=>{k(),x()};return e.jsx(He,{open:t,onClose:o,title:`Edit ${a.internalName} ${y?`for ${y}`:""}`,className:"sked-test-appt-types-edit-appt-modal",size:"xs",maxWidth:750,buttons:[e.jsx(G,{title:"Save",color:"primary",disabled:Me(c.type,a),onClick:()=>j(c.type),className:"sked-test-appt-types-edit-appt-modal-button-save"},"save")],children:e.jsx("div",{children:e.jsx(on,{...c.type,ehr:f,hasCutoff:l,hasScheduleCutoff:r,state:c,updateType:m,updateTypeColor:A,close:k,openColor:H,selectTemp:N})})})},rn=ls(Be),cn=t=>{const a=t.firstName||t.lastName,x=` (${t.firstName||""} ${t.lastName||""})`;return`${t.displayFirstName||""} ${t.displayLastName||""}`+(a?x:"")},dn=({professionals:t,professionalId:a,onClose:x,save:j,open:y})=>{const f=t.filter(d=>!d.isHidden&&d.id>0),l=a===-1&&f&&f.length>0?f[0].id:a,r={name:"",internalName:"",duration:15,notAllowedMinutesBeforeClosing:void 0,professionalId:l,canCancel:!0,canChange:!0,canSee:!0,partOfCarePlan:!1};z.useEffect(()=>{i({types:[r]})},[l]);const[c,i]=z.useState({types:[r]}),p=d=>d.target.value,m=(d,n,P=p)=>F=>{const w=P(F),Q=cs(Ne("types"),ds(d),Ne(n));i(hs(Q,w))},A=(d,n)=>m(d,n,F=>F.target.checked),N=(d,n)=>m(d,n,F=>Number(F.target.value)),H=d=>{i(Te({types:ps(d,1)}))},k=()=>{i(Te({types:as(r)}))},o=d=>{d===c.types.length-1&&k()},g=!ts((d,n)=>d&&n.duration>0,!0,c.types),M=()=>{const d=je(({internalName:n,name:P})=>!Ce(n)&&!Ce(P),c.types);os.post("appointmentType/",d).then(()=>{j(),x(),i({types:[r]})}).catch(n=>{console.log(n),is("Error!","Failed to create appointment types! Verify all fields and try again!")})},V=()=>{x(),i({types:[r]})},J=(d,n)=>{const{name:P,internalName:F,duration:w,notAllowedMinutesBeforeClosing:Q,canCancel:ne,canChange:he,canSee:pe,partOfCarePlan:me,professionalId:ue}=d;return e.jsxs(v,{children:[e.jsx(b,{children:e.jsx(oe,{value:F,onChange:m(n,"internalName"),onBlur:$=>P===""?m(n,"name")($):null,required:!0})}),e.jsx(b,{children:e.jsx(oe,{value:P,onChange:m(n,"name"),required:!0})}),e.jsx(b,{children:e.jsx(rs,{value:ue,variant:"standard",onChange:m(n,"professionalId"),children:f.map($=>e.jsx(L,{value:$.id,style:{color:$.isHidden?"#AAA":"#000"},children:cn($)},$.id))})}),e.jsx(b,{children:e.jsx(oe,{value:w,type:"number",onChange:N(n,"duration"),required:!0})}),e.jsx(b,{children:e.jsx(oe,{value:Q,type:"number",onChange:N(n,"notAllowedMinutesBeforeClosing")})}),e.jsx(b,{children:e.jsx(Z,{checked:ne,onChange:A(n,"canCancel")})}),e.jsx(b,{children:e.jsx(Z,{checked:he,onChange:A(n,"canChange")})}),e.jsx(b,{children:e.jsx(Z,{checked:pe,onChange:A(n,"canSee")})}),e.jsx(b,{children:e.jsx(Z,{checked:me,onChange:A(n,"partOfCarePlan"),onFocus:()=>o(n)})}),e.jsx(b,{children:e.jsx(be,{tabIndex:-1,onClick:()=>H(n),children:e.jsx(Js,{})})})]},n)},D=({types:d})=>e.jsxs(We,{style:{overflowY:"auto"},children:[e.jsx(Oe,{children:e.jsxs(v,{children:[e.jsx(C,{children:"Internal Name"}),e.jsx(C,{children:"Display Name"}),e.jsx(C,{children:"Professional"}),e.jsx(C,{children:"Duration"}),e.jsx(C,{children:"Closing Limit"}),e.jsx(C,{children:"Can Cancel"}),e.jsx(C,{children:"Can Reschedule"}),e.jsx(C,{children:"Can See"}),e.jsx(C,{children:"On Care Plan"}),e.jsx(C,{})]})}),e.jsx(ye,{children:rn((n,P)=>J(n,P),d)})]});return e.jsx(He,{open:y,onClose:V,title:"Add appointments types",size:"xl",className:"sked-test-appt-types-add-appt-type-modal",buttons:[e.jsx(G,{onClick:k,borderSolid:!0,Icon:Ks,iconStyle:{marginRight:-6},title:"Add",className:"sked-test-appt-types-add-appt-type-modal-button-add"},"add"),e.jsx(G,{title:"Save",disabled:g,onClick:M,color:"primary",className:"sked-test-appt-types-add-appt-type-modal-button-save"},"save")],children:e.jsxs("div",{children:[e.jsx(Re,{}),e.jsxs("p",{style:{marginTop:"10px"},children:['To make process as fast as possible, use the "Tab" key to jump from input field to input field. To toggle a checkbox, use the "Space" key. Once you reach the last field (On Care Plan), a new row will appear and you can use the "Tab" key to jump down to it. If you do ',e.jsx("b",{children:"NOT"})," want an appointment type to have a closing limit ",e.jsx("i",{children:"leave the input field blank"}),"."]}),D(c)]})})},hn=de("div")({padding:"5px",background:"#fff",borderRadius:"1px",boxShadow:"0 0 0 1px rgba(0,0,0,.1)",display:"inline-block","& > div":{width:"36px",height:"14px",borderRadius:"2px"}}),le=de(Z)({marginRight:3,"& svg":{width:"15px !important",height:"15px !important"}}),pn="When a patient replies âCâ via SMS their appointment will be marked as confirmed in SKED. Youâll need to include a phrase in your appointment reminders such as âReply âCâ to confirm your appointmentâ, so patients know how to confirm their appointment.",mn="Track patient responses to appointment reminders as Pending, Confirmed, or Denied. Ask patients to reply 'YES' to confirm or 'NO' if they cannot attend. A denied response does not cancel the appointment.",un="There are currently some automated messages that ask patients to confirm their appointments. This setting canât be disabled until those messages are disabled or deleted.",xn="This setting can't be turned off while an active automated message updates appointment confirmation status. Disable or delete those messages first.",fn=de(O)({fontSize:"2rem"}),fe=(t,a)=>t?`${t}${a} `:"",ge=(t,a)=>{if(!t||!a)return"";const x=Math.floor(t/1440),j=Math.floor(t%1440/60),y=t%1440%60%60;return` ${fe(x,"d")}${fe(j,"h")}${fe(y,"m")}`},gn=({type:t,selectToggleApptType:a,patch:x,admin:j,isLoading:y,hasScheduleCutoff:f,save:l,hasCutoff:r,onEditProfessional:c})=>{var H,k;const i=se("color")(t)!==null?"hsl("+t.color.hue+","+t.color.saturation+"%,"+t.color.lightness+"%)":"hsl(0,0,0)",p=()=>x({state:"EDIT_TYPE",selectedType:t}),m=o=>{o.stopPropagation(),c(t.professional)},A=()=>{x({state:void 0,selectedType:{}}),j.disable(t.id)},N=()=>{x({state:void 0,selectedType:{}}),j.enable(t.id)};return e.jsxs(Fe,{style:{cursor:"pointer",opacity:t.disabled?.5:1},hasSelect:j.isAdmin,disabled:y,checked:t.isSelected,setChecked:()=>a(t.id),children:[e.jsxs(b,{fixed:!0,onClick:p,children:[e.jsx("a",{children:t.internalName}),j.isAdmin&&e.jsxs("span",{style:{marginLeft:6,color:"#ABABAE",fontSize:12,fontFamily:"monospace"},children:["#",t.id]})]}),e.jsx(b,{onClick:p,children:t.name}),e.jsx(b,{onClick:m,children:e.jsxs("a",{children:[(H=t.professional)==null?void 0:H.firstName," ",(k=t.professional)==null?void 0:k.lastName]})}),e.jsx(b,{onClick:p,children:t.duration}),e.jsx(b,{onClick:p,children:t.notAllowedMinutesBeforeClosing!==null?t.notAllowedMinutesBeforeClosing:""}),f&&e.jsx(b,{onClick:p,children:ge(t.scheduleCutoff,f)}),e.jsxs(b,{nowrap:!0,onClick:p,children:[e.jsx(le,{checked:!!t.canCancel,onClick:o=>o.stopPropagation(),onChange:(o,g)=>{o.stopPropagation(),l({canCancel:g})}}),ge(t.cancelCutoff,r),!!t.cancelCutoff&&r&&e.jsx("span",{style:{color:"#ABABAE"},children:"cutoff"})]}),e.jsxs(b,{nowrap:!0,onClick:p,children:[e.jsx(le,{checked:!!t.canChange,onClick:o=>o.stopPropagation(),onChange:(o,g)=>{o.stopPropagation(),l({canChange:g})}}),ge(t.rescheduleCutoff,r),!!t.rescheduleCutoff&&r&&e.jsx("span",{style:{color:"#ABABAE"},children:"cutoff"})]}),e.jsx(b,{onClick:p,children:e.jsx(le,{checked:!!t.canSee,onClick:o=>o.stopPropagation(),onChange:(o,g)=>{o.stopPropagation(),l({canSee:g})}})}),e.jsx(b,{onClick:p,children:e.jsx(le,{checked:!!t.partOfCarePlan,onClick:o=>o.stopPropagation(),onChange:(o,g)=>{o.stopPropagation(),l({partOfCarePlan:g})}})}),e.jsx(b,{onClick:p,children:e.jsx(hn,{children:e.jsx("div",{style:{background:i}})})}),e.jsx(b,{children:t.disabled?e.jsx(be,{style:{margin:"0px"},onClick:N,"aria-label":"restore",title:"Re-enable",children:e.jsx(nn,{})}):e.jsx(be,{style:{margin:"0px"},onClick:A,"aria-label":"delete",children:e.jsx(sn,{})})})]})},jn=({isLoading:t,selectedTypes:a,types:x,isAdmin:j,selectToggleApptTypeAll:y,hasScheduleCutoff:f})=>e.jsxs(Fe,{hasSelect:j,checked:a.length>0&&a.length===x.length,setChecked:()=>y(),disabled:t,someChecked:a.length>0&&a.length<x.length,noSelectHover:!0,children:[e.jsx(C,{fixed:!0,children:"Internal Name"}),e.jsx(C,{children:"Display Name"}),e.jsx(C,{children:"Provider"}),e.jsx(C,{children:"Duration"}),e.jsx(C,{children:"Closing Limit"}),f&&e.jsx(C,{children:"Schedule Cutoff"}),e.jsx(C,{children:"Canceling"}),e.jsx(C,{children:"Rescheduling"}),e.jsx(C,{children:"Show in App"}),e.jsx(C,{children:e.jsxs(re,{display:"flex",alignItems:"center",children:["Care Plan",e.
1jsx(R,{title:"With this checkbox enabled, this appointment code counts toward care plan visits.",arrow:!0,slotProps:{tooltip:{sx:{maxWidth:234}}},children:e.jsx("div",{style:{display:"flex"},children:e.jsx(Bs,{style:{width:"unset",height:"unset",marginLeft:6,cursor:"pointer"}})})})]})}),e.jsx(C,{children:"Color"}),e.jsx(C,{children:"Delete"})]}),Cn=({types:t,patch:a,admin:x,bulkUpdate:j,selectToggleApptType:y,selectToggleApptTypeAll:f,selectedTypes:l,headerHeight:r,hasScheduleCutoff:c,hasCutoff:i,save:p,onEditProfessional:m})=>e.jsxs(We,{maxHeight:`calc(100vh - ${r}px - 45px)`,scrollPaddingBottom:45,children:[e.jsx(Oe,{children:e.jsx(jn,{isLoading:j.loading,types:t,selectedTypes:l,selectToggleApptTypeAll:f,isAdmin:x.isAdmin,hasScheduleCutoff:c})}),e.jsx(ye,{children:t.map(A=>e.jsx(gn,{type:A,isLoading:j.loading,patch:a,selectToggleApptType:y,admin:x,hasScheduleCutoff:c,hasCutoff:i,save:N=>p(N,A),onEditProfessional:m},A.id))})]}),At=()=>{var Ae;const t=ms(),a=us(),[x]=xs(),[j,y]=ce.useState(!1),[f,l]=z.useState(!1),r=ie($s,{}),c=ie(zs,null),i=ie(Xs,!1),p=ie(Zs,null);Os("Appointment Types");const[m,A]=z.useState({opened:!1,color:{},checkForWidth:!0,openAddPro:!1,openAddType:!1,openEditPro:!1,tab:"types"}),[N,H]=z.useState(null),k=u(s=>ze(s)),o=u(s=>s.professionals.professional),g=u(s=>wn(s)),M=u(s=>s.professionals.isShowingHiddenProfessional),V=u(s=>s.professionals.isShowingDisabledTypes),J=u(s=>s.professionals.busy),D=u(s=>S("",["login","office","ehrSystem"])(s)),d=u(s=>W(S([],["login","features"]),U("CToConfirm"))(s)),n=u(s=>W(S([],["login","features"]),U("CToConfirmv2"))(s)),P=u(s=>S(!1,["login","admin"])(s)),F=u(s=>S(null,["professionals","state"])(s)),w=u(s=>S(null,["professionals","selectedType"])(s)),Q=u(s=>W(S([],["login","features"]),U("RescheduleCancelCutoff"))(s)),ne=u(s=>W(S([],["login","features"]),U("ScheduleCutoff"))(s)),he=u(s=>W(S([],["login","features"]),U("SkedApp"))(s)),pe=u(s=>s.professionals.types),me=u(s=>s.professionals.fallbacks),ue=u(s=>S([],["business","locations"],s)),$=u(s=>W(S([],["login","features"]),U("Locations"))(s)),ke=u(s=>Ve(s)),qe=u(s=>s.professionals.bulkUpdate),Ue=u(s=>W(S([],["login","features"]),U("ApptTySchedule"))(s)),Ye=u(s=>s.login.headerHeight),te=u(s=>S(null,["login","office"])(s)),ve=u(s=>W(S([],["login","features"]),U("AppointmentConfirmationPending"))(s)),Ge=u(s=>W(S([],["login","features"]),en(["SkedApp","EPPortal"]),Ce,fs)(s)),Qe=k.filter(s=>M||!s.isHidden),_e=s=>A(I=>T(I,s)),Y=s=>{_e({[s]:!se(s,m)})},K=()=>{H(null)},Je=()=>{K(),Y("openAddType")},q=s=>{K(),a(Rs(s))},Ke=()=>{K(),a(Ms())},Xe=()=>{Y("openAddPro"),K()},we=s=>{n?p.invoke(s).then(()=>i.invoke()):c.invoke({enabled:s,confirmAutomation:r.data}).then(()=>r.invoke())},Ze=(s,I)=>{const X=T(I,s);a(Ee(X,!0))},es=s=>{a(Ie(s)),Y("openEditPro")},ss=z.useMemo(()=>f?n?xn:un:n?mn:pn,[f,n]);return z.useEffect(()=>{const s=x.get("pro"),I=s?Number(s):-1;a(gs(t,D,I)),$&&a(js())},[te]),z.useEffect(()=>()=>{a(_({professional:{},types:[],selectedTypes:[]}))},[]),ce.useEffect(()=>{n?i.invoke():d&&r.invoke()},[d,n,te]),z.useEffect(()=>{var X;const s=d&&((X=r.data)==null?void 0:X.id),I=n&&i.data!==void 0;ve&&te.ehrSystem==="ChiroHD"&&(s||I)&&Cs().then(ae=>{var Se;l(ae),ae&&(n?!i.data:!((Se=r.data)!=null&&Se.enabled))&&we(!0)})},[(Ae=r.data)==null?void 0:Ae.id,i.data,n,d,ve,te.ehrSystem]),e.jsxs(e.Fragment,{children:[e.jsx(Vs,{title:"Appointment Types",pageId:"appointment-types",leftIcons:[e.jsx(qs,{showNameAndDisplayName:!0,title:o.id>0?`${o.displayFirstName} ${o.displayLastName}`:"Provider",allProfessionals:Qe,selectedProId:o.id,setPropId:s=>{const I=k.find(ae=>ae.id===s);a(Ie(I||{id:-1,displayFirstName:"All Providers"}))}},"select-professional")],rightIcons:[e.jsx(re,{display:"flex",marginX:"5px",children:(J||r.loading||c.loading||i.loading||p.loading)&&e.jsx(bs,{size:18})},"loading"),e.jsx(re,{children:(d||n)&&e.jsxs(G,{disableRipple:f,style:{opacity:f?.5:1},borderSolid:!0,active:n?i.data:B(!1,"enabled",r.data),type:"hide",disabled:n?i.loading||p.loading:c.loading||r.loading,children:[e.jsx(xe,{disabled:f,checked:n?i.data:B(!1,"enabled",r.data),onChange:we,label:n?"Enable Appointment Confirmation Status":"Enable Appt Confirmation"}),e.jsx(R,{arrow:!0,title:ss,slotProps:{tooltip:{sx:{maxWidth:428}}},children:e.jsx(ys,{display:"flex",style:{padding:"2px 4px",borderRadius:2,marginLeft:4,marginRight:-4},children:e.jsx(fn,{style:{width:17,height:17,color:"#0000008a"}})})})]})},"enabled"),e.jsx(G,{borderSolid:!0,active:M,type:"hide",children:e.jsx(xe,{checked:M,onChange:s=>a(_({isShowingHiddenProfessional:s})),label:"Show Disabled Providers"})},"show-hidden"),e.jsx(G,{borderSolid:!0,active:V,type:"hide",children:e.jsx(xe,{checked:V,onChange:s=>a(_({isShowingDisabledTypes:s})),label:"Show Disabled Types"})},"show-disabled"),e.jsx(re,{children:(D==="None"||P)&&e.jsx(G,{title:"Actions",className:"sked-test-appointment-types-actions",borderSolid:!0,onClick:s=>H(s.currentTarget),EndIcon:Fs})},"actions")],onlyIconsWidth:d||n?1042:754,breakPoints:d||n?[{width:965,mobileItems:[2]},{width:675,mobileItems:[2,3]},{width:528,mobileItems:[2,3,4]}]:[{width:632,mobileItems:[2,3]},{width:525,mobileItems:[2,3,4]}]}),e.jsxs("div",{style:{padding:0},children:[!F&&!m.openAddPro&&!m.openEditPro&&e.jsx(Re,{}),e.jsx(ln,{open:F==="EDIT_TYPE",type:T(w,{scheduleCutoff:w.scheduleCutoff&&{days:Math.floor(w.scheduleCutoff/1440),hours:Math.floor(w.scheduleCutoff%1440/60),minutes:w.scheduleCutoff%1440%60%60},rescheduleCutoff:w.rescheduleCutoff&&{days:Math.floor(w.rescheduleCutoff/1440),hours:Math.floor(w.rescheduleCutoff%1440/60),minutes:w.rescheduleCutoff%1440%60%60},cancelCutoff:w.cancelCutoff&&{days:Math.floor(w.cancelCutoff/1440),hours:Math.floor(w.cancelCutoff%1440/60),minutes:w.cancelCutoff%1440%60%60}}),onClose:()=>a(_({state:void 0,selectedType:{}})),save:s=>a(Ee(s)),doctor:o.displayFirstName+" "+(o.displayLastName||""),ehr:D,hasCutoff:Q,hasScheduleCutoff:ne}),e.jsx(Qs,{open:m.openAddPro,onClose:()=>Y("openAddPro"),loading:j,save:s=>{y(!0),a(ks(s)).then(I=>{I&&t(`/providers?pro=${I.id}`)}).finally(()=>{y(!1),Y("openAddPro")})}}),e.jsx(_s,{open:m.openEditPro,professional:o,ehr:D,onClose:()=>Y("openEditPro"),save:s=>{a(As(s))},professionals:k,allTypes:pe,fallbacks:me,patch:s=>a(_(s)),deleteFallback:s=>a(ws(s)),saveFallback:s=>a(vs(s)),locations:ue,hasLocations:$,hasFallback:Ge,hasApp:he}),e.jsx(dn,{open:m.openAddType,onClose:()=>Y("openAddType"),professionals:k,professionalId:o.id,save:()=>{a(Ss())}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsxs(Ps,{id:"simple-menu",anchorEl:N,open:!!N,onClose:K,keepMounted:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[D==="None"&&e.jsx(L,{onClick:Je,children:"Add Appointment Types"}),D==="None"&&e.jsx(L,{onClick:Xe,children:"Add Provider"}),D==="None"&&P&&e.jsx(De,{}),P&&e.jsxs("div",{children:[e.jsx(L,{disabled:ke.length===0,className:"sked-test-appointment-types-duplicate-selected",onClick:Ke,children:"Duplicate Selected"}),e.jsx(De,{}),e.jsx(L,{onClick:()=>q({canSee:!0}),className:"sked-test-appointment-types-check-can-see",children:'Check "Can See"'}),e.jsx(L,{onClick:()=>q({canSee:!1}),className:"sked-test-appointment-types-uncheck-can-see",children:'Uncheck "Can See"'}),e.jsx(L,{onClick:()=>q({canCancel:!0}),className:"sked-test-appointment-types-check-can-cancel",children:'Check "Can Cancel"'}),e.jsx(L,{onClick:()=>q({canCancel:!1}),className:"sked-test-appointment-types-uncheck-can-cancel",children:'Uncheck "Can Cancel"'}),e.jsx(L,{onClick:()=>q({canChange:!0}),className:"sked-test-appointment-types-check-can-reschedule",children:'Check "Can Reschedule"'}),e.jsx(L,{onClick:()=>q({canChange:!1}),className:"sked-test-appointment-types-uncheck-can-reschedule",children:'Uncheck "Can Reschedule"'}),e.jsx(L,{onClick:()=>q({partOfCarePlan:!0}),className:"sked-test-appointment-types-check-on-careplan",children:'Check "On Care Plan"'}),e.jsx(L,{onClick:()=>q({partOfCarePlan:!1}),className:"sked-test-appointment-types-uncheck-on-careplan",children:'Uncheck "On Care Plan"'})]})]}),e.jsx("div",{hidden:m.tab!=="types",children:e.jsx(Cn,{types:g,selectedTypes:ke,selectToggleApptType:s=>a(Es(s)),selectToggleApptTypeAll:()=>a(Is()),ehrSystem:D,bulkUpdate:qe,patch:s=>a(_(s)),isApptTySked:Ue,admin:{isAdmin:P,disable:s=>a(Ns(s)),enable:s=>a(Ts(s))},headerHeight:Ye,hasScheduleCutoff:ne,hasCutoff:Q,save:Ze,onEditProfessional:es})})]})]})]})},bn=t=>t.professionals.professional,ze=W(S([],["professionals","professionals"]),$e([ee(se("isHidden")),ee(se("lastName"))]),Ds({id:-1,professionalId:-1,displayFirstName:"All Providers"})),yn=t=>t.professionals.types,Ve=t=>t.professionals.selectedTypes,kn=t=>t.professionals.isShowingHiddenProfessional,vn=t=>t.professionals.isShowingDisabledTypes,wn=Ws(ze,bn,yn,Ve,kn,vn,(t,{id:a},x,j,y,f)=>W(Be(l=>{const r=t.find(Le("id",l.professionalId)),c=j.some(Me(l.id));return{...l,professional:r,isSelected:c}}),je(l=>f||!l.disabled),je(Hs(l=>{var r;return a===-1&&(y||!((r=l.professional)!=null&&r.isHidden))},Le("professionalId",a))),$e([ee(l=>l.disabled?1:0),ee(Ls(["professional","lastName"])),ee(se("internalName"))]))(x));export{At 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.