1import{a as Qe}from"./chunk-TCSZAXC5.js";import"./chunk-N2XCYBJ4.js";import"./chunk-WWUUNGOH.js";import{g as ei}from"./chunk-AVMRUDX4.js";import{C as Le,H as pe,d as ii,f as ni,q as pi}from"./chunk-43GDRL7N.js";import"./chunk-6HIJHFNX.js";import"./chunk-XVTCBB6H.js";import"./chunk-KEZHDQIE.js";import"./chunk-LKHHWPHP.js";import"./chunk-LM66VD7C.js";import"./chunk-5X4SSXKM.js";import"./chunk-E3MVPWOU.js";import"./chunk-WPAAEOXB.js";import"./chunk-SZBSZBIO.js";import"./chunk-QNYLRPL4.js";import"./chunk-AKCVL37J.js";import"./chunk-7E5UOVHS.js";import"./chunk-VQJK6PLE.js";import"./chunk-A3I57NHN.js";import"./chunk-G4BO3UFI.js";import"./chunk-UI7XN7JH.js";import"./chunk-QTUVCWCW.js";import"./chunk-ONNXAYZH.js";import{a as mi}from"./chunk-HQLL6AH6.js";import"./chunk-27GNGV6T.js";import"./chunk-FQRUVZ4X.js";import"./chunk-B2BCSKRA.js";import"./chunk-GPRSHBYR.js";import"./chunk-TGXJHTK3.js";import{a as oi,b as ai,c as ri,d as li,e as si}from"./chunk-DVOWPHCF.js";import"./chunk-CRKH5BY4.js";import"./chunk-2PTMLTDJ.js";import"./chunk-QTELCQLJ.js";import"./chunk-INF3NU6U.js";import"./chunk-A3A7VRKR.js";import"./chunk-5N3WEBVU.js";import"./chunk-PKJHNPBJ.js";import"./chunk-265YUTJB.js";import"./chunk-F2YQEF5G.js";import"./chunk-7X2JEPF7.js";import"./chunk-HOU6SDD7.js";import"./chunk-Q2USBPIU.js";import"./chunk-BZJB6QXX.js";import"./chunk-YJBHYRU2.js";import"./chunk-TDJZESUJ.js";import"./chunk-KJB6OCKA.js";import"./chunk-P36KONTB.js";import"./chunk-WJBSE4SC.js";import"./chunk-XFWBAKYL.js";import"./chunk-VWKUCRZW.js";import"./chunk-U6OCV5FE.js";import"./chunk-32W4QTXK.js";import"./chunk-PZGCKJEG.js";import"./chunk-KEEKFMME.js";import{b as ti}from"./chunk-HUV6E2ND.js";import"./chunk-ORG5HICP.js";import"./chunk-HH3SAZRI.js";import"./chunk-ROB2HQJW.js";import{Cb as Zt,Ia as Xt,a as F,b as at,fa as Ne,k as ft,n as Se,qa as Jt,r as Ut,ua as Be,w as Ht}from"./chunk-VJEY7ARU.js";import"./chunk-LEVCIQHM.js";import{C as j,Ja as Qt,L as Wt,O as jt,Ra as Gt,g as we,o as vt}from"./chunk-DPOPNBB5.js";import{c as Tt,d as Ft,m as kt,n as Et}from"./chunk-KNUYPGJH.js";import"./chunk-CPNDCTWV.js";import"./chunk-JF5HOGNI.js";import{f as qt,g as zt}from"./chunk-IXZVSOS3.js";import{a as bt,c as yt}from"./chunk-G2VNB6CJ.js";import"./chunk-RWBOQKPB.js";import"./chunk-3EK4GQZL.js";import{e as Kt,g as Yt,h as Re}from"./chunk-LE2GXE3H.js";import"./chunk-7T4I5REZ.js";import"./chunk-FMKVILIL.js";import"./chunk-PPRBUJWH.js";import"./chunk-6BTZ6KUR.js";import{J as me,Ra as ct,ea as We,h as pt,i as k}from"./chunk-ORRH6NIM.js";import{C as h,G as Ee,H as Pe,J as je,N as Vt,S as Ot,U as Ie,W as $t,t as Pt,u as It,v as Rt,y as Bt,z as Lt}from"./chunk-GP5ZBEM2.js";import{B as Ae,L as At,O as Mt,fa as Nt,ha as ke,w as Dt}from"./chunk-UBENFOEE.js";import{$ as De,Cc as z,Dc as oe,Ec as wt,Hb as ne,Ib as $,Kb as q,Lb as xt,Mb as St,Qc as Fe,Va as _t,Wa as gt,Y as B,Z as L,Zc as W,aa as te,ab as Ct,ba as xe,bc as Me,ca as V,da as O,ec as Te,ha as mt,mb as ht,qb as ie,r as ee,x as rt}from"./chunk-HMJSVFYW.js";import{$ as P,$a as dt,Ua as ut,_ as be,ba as I,da as ye,ea as R,jb as K,na as N}from"./chunk-IXUGMMZS.js";import"./chunk-BLVKTIDM.js";import{$b as g,Aa as m,Ac as Xe,Ad as nt,Bc as Ze,Bd as ot,Cc as Oe,Fa as S,Ga as w,Hb as d,Hc as et,Jb as f,La as fe,Mb as U,N as G,Nb as H,Oa as D,Ob as s,Pb as o,Qb as a,Qc as he,Rb as v,Rc as ve,Vc as $e,Xb as Ve,Yb as A,Zc as qe,bc as p,bd as tt,db as l,fb as Je,fc as re,g as Ye,gc as le,hc as se,jd as it,lc as ge,oa as ae,oc as J,pa as Y,pc as u,pe as lt,ra as y,rc as C,re as st,sc as Ce,t as M,tb as x,ub as _e,ue as ze,xa as de,xc as X,yc as E,z as T,zb as b,zc as Z}from"./chunk-DHHP3IOI.js";import"./chunk-KHB7WKRM.js";import"./chunk-PVY5IX2D.js";import{a as ce,b as ue}from"./chunk-IIGMZVP4.js";var ci=(()=>{class t{client=D(null);reasonAttribute=D(null);reasonDetails=D(null);_data=m(L);_dialogRef=m(B);_clientData=m(j);_message=m(ie);constructor(){this._init()}save=()=>this._clientData.delete({id:this.client().id,reasonAttributeId:this.reasonAttribute()?.id,reasonDetails:this.reasonDetails()||null}).pipe(y(e=>{this._dialogRef.close(e),this._message.success("Saved Changes")}
1));_init(){this.client.set(this._data.client)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=x({type:t,selectors:[["ng-component"]],decls:10,vars:5,consts:[["fsForm","",3,"submit"],[3,"reasonAttributeChange","reasonDetailsChange","reasonAttribute","reasonDetails"],[3,"create","close"]],template:function(i,n){i&1&&(o(0,"form",0)(1,"fs-dialog")(2,"fs-dialog-title"),u(3,"Delete Client Warning"),a(),o(4,"mat-dialog-content")(5,"fs-label-field"),u(6," You are about to delete a client. Pick the reason that best describes why \u2014 it is recorded in the deleted client's audit record. "),a(),o(7,"app-client-status-reason-field",1),Z("reasonAttributeChange",function(_){return E(n.reasonAttribute,_)||(n.reasonAttribute=_),_})("reasonDetailsChange",function(_){return E(n.reasonDetails,_)||(n.reasonDetails=_),_}),a()(),o(8,"mat-dialog-actions"),v(9,"fs-form-dialog-actions",2),a()()()),i&2&&(s("submit",n.save),l(7),X("reasonAttribute",n.reasonAttribute)("reasonDetails",n.reasonDetails),l(2),s("create",!1)("close",!1))},dependencies:[N,R,P,I,W,z,wt,q,$,ne,V,Te,Me,O,Le],encapsulation:2,changeDetection:0})}return t})();var ui=(()=>{class t{staffAccount;account=null;_accountTypeNames=Ne(Ht);get title(){return this._accountTypeNames[this.account?.type]}_data=m(L);_dialogRef=m(B);_accountData=m(we);_message=m(ie);_cdRef=m(it);ngOnInit(){this._accountData.get(this._data.account.id,{avatars:!0,addresses:!0,type:this._data.account.type}).subscribe(e=>{this.account=this._accountData.create(e),this._cdRef.markForCheck()})}save=()=>this.staffAccount.save().pipe(y(e=>{this._message.success("Saved Changes"),this._dialogRef.close(e)}));static \u0275fac=function(i){return new(i||t)};static \u0275cmp=x({type:t,selectors:[["ng-component"]],viewQuery:function(i,n){if(i&1&&re(Qe,5),i&2){let c;le(c=se())&&(n.staffAccount=c.first)}},decls:11,vars:4,consts:[["fsForm","",3,"submit"],["mat-dialog-title",""],[3,"account"],["mat-button","","type","submit","color","primary"],["mat-button","","type","button",3,"mat-dialog-close"]],template:function(i,n){i&1&&(o(0,"form",0)(1,"fs-dialog")(2,"div",1),u(3),a(),o(4,"mat-dialog-content"),v(5,"app-staff-account",2),a(),o(6,"mat-dialog-actions")(7,"button",3),u(8," Save "),a(),o(9,"button",4),u(10," Cancel "),a()()()()),i&2&&(s("submit",n.save),l(3),C(" ",n.title," "),l(2),s("account",n.account),l(4),s("mat-dialog-close",null))},dependencies:[N,R,P,I,W,z,oe,q,$,ke,Qe,xe,V,O,te,ee],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}return t})();function bi(t,r){if(t&1){let e=A();o(0,"fs-badge",1),g("click",function(){S(e);let n=p();return w(n.open())}),a()}if(t&2){let e=p();s("size",e.size)("matTooltip",e.account.name)("image",e.account.avatar==null?null:e.account.avatar.small)("text",e.account.avatar!=null&&e.account.avatar.small||e.account.avatar==null?null:e.account.avatar.abbreviation)("color",e.account.avatar==null?null:e.account.avatar.color)}}var di=(()=>{class t{account;size=24;saved=new Je;_dialog=m(De);open(){this.account&&this._dialog.open(ui,{width:"600px",data:{account:this.account}}).afterClosed().pipe(G(e=>!!e)).subscribe(e=>this.saved.emit(e))}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=x({type:t,selectors:[["app-staff-profile-avatar"]],inputs:{account:"account",size:"size"},outputs:{saved:"saved"},decls:1,vars:1,consts:[["shape","circle",1,"staff-profile-avatar",3,"size","matTooltip","image","text","color"],["shape","circle",1,"staff-profile-avatar",3,"click","size","matTooltip","image","text","color"]],template:function(i,n){i&1&&d(0,bi,1,5,"fs-badge",0),i&2&&f(n.account?0:-1)},dependencies:[Pe,Ee,mt],styles:["[_nghost-%COMP%]{display:inline-flex}[_nghost-%COMP%] .staff-profile-avatar[_ngcontent-%COMP%]{cursor:pointer}"],changeDetection:0})}return t})();function Di(t,r){if(t&1){let e=A();o(0,"app-client-status-reason-field",9),Z("reasonAttributeChange",function(n){S(e);let c=p();return E(c.reasonAttribute,n)||(c.reasonAttribute=n),w(n)})("reasonDetailsChange",function(n){S(e);let c=p();return E(c.reasonDetails,n)||(c.reasonDetails=n),w(n)}),a()}if(t&2){let e=p();
1X("reasonAttribute",e.reasonAttribute)("reasonDetails",e.reasonDetails)}}function xi(t,r){if(t&1){let e=A();o(0,"fs-label-field")(1,"mat-slide-toggle",10),g("ngModelChange",function(n){S(e);let c=p();return w(c.restore.set(n))}),u(2," Restore "),a(),o(3,"mat-hint"),u(4," Brings the selected clients back as active, exactly as they were \u2014 programs, subscriptions, payment methods, prescriptions and booked appointments all resume. "),a()()}if(t&2){let e=p();l(),s("ngModel",e.restore())}}var fi=(()=>{class t{AttributeClass=me;addTagAttributes=D([]);removeTagAttributes=D([]);clientStatusAttribute=D(null);clientStatusTouched=D(!1);restore=D(!1);reasonAttribute=D(null);reasonDetails=D(null);clientIds;showDeleted;reasonRequired=qe(()=>!!this.clientStatusAttribute()?.configs?.[Jt]);hasChanges=qe(()=>this.addTagAttributes().length>0||this.removeTagAttributes().length>0||this.clientStatusTouched()||this.restore());_data=m(L);_dialogRef=m(B);_clientData=m(j);_destroyRef=m(fe);constructor(){this.clientIds=this._data.clientIds,this.showDeleted=this._data.showDeleted}clientStatusChange(e){this.clientStatusAttribute.set(e),this.clientStatusTouched.set(!0)}submit=()=>this.hasChanges()?this._clientData.bulk(this._payload()).pipe(y(e=>this._dialogRef.close(e)),Ae(this._destroyRef)):(this._dialogRef.close(),M(null));_payload(){let e={clientIds:this.clientIds};return this.addTagAttributes().length&&(e.addTagAttributeIds=this.addTagAttributes().map(i=>i.id)),this.removeTagAttributes().length&&(e.removeTagAttributeIds=this.removeTagAttributes().map(i=>i.id)),this.clientStatusTouched()&&(e.clientStatusAttributeId=this.clientStatusAttribute()?.id??null),this.reasonRequired()&&(e.reasonAttributeId=this.reasonAttribute()?.id??null,e.reasonDetails=this.reasonDetails()||null),this.restore()&&(e.restore=!0),e}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=x({type:t,selectors:[["ng-component"]],decls:18,vars:26,consts:[["fsForm","",3,"submit","dirtySubmitButton","confirm"],[1,"fs-column.gap-sm"],[1,"subheading"],["name","addTagAttributes","label","Add tags",3,"ngModelChange","ngModel","multiple","saveOnChange","size"],["name","removeTagAttributes","label","Remove tags",3,"ngModelChange","ngModel","multiple","saveOnChange","size"],["name","clientStatusAttribute","label","Set client status",3,"ngModelChange","ngModel","multiple","saveOnChange","size"],[3,"reasonAttribute","reasonDetails"],["mat-button","","type","submit","color","primary"],["mat-button","","type","button",3,"mat-dialog-close"],[3,"reasonAttributeChange","reasonDetailsChange","reasonAttribute","reasonDetails"],["name","restore",3,"ngModelChange","ngModel"]],template:function(i,n){i&1&&(o(0,"form",0)(1,"fs-dialog")(2,"fs-dialog-title"),u(3," Bulk actions "),a(),o(4,"mat-dialog-content")(5,"div",1)(6,"div",2),u(7),a(),o(8,"fs-attribute-autocomplete-chips",3),g("ngModelChange",function(_){return n.addTagAttributes.set(_||[])}),a(),o(9,"fs-attribute-autocomplete-chips",4),g("ngModelChange",function(_){return n.removeTagAttributes.set(_||[])}),a(),o(10,"fs-attribute-autocomplete-chips",5),g("ngModelChange",function(_){return n.clientStatusChange(_)}),a(),d(11,Di,1,2,"app-client-status-reason-field",6),d(12,xi,5,1,"fs-label-field"),a()(),o(13,"mat-dialog-actions")(14,"button",7),u(15," Apply "),a(),o(16,"button",8),u(17," Cancel "),a()()()()),i&2&&(s("submit",n.submit)("dirtySubmitButton",!1)("confirm",!1),l(7),Ce(" Applies to ",n.clientIds.length," selected client",n.clientIds.length===1?"":"s",". Anything left blank is not changed. "),l(),J(n.AttributeClass.ClientTag),s("ngModel",n.addTagAttributes())("multiple",!0)("saveOnChange",!1)("size","small"),l(),J(n.AttributeClass.ClientTag),s("ngModel",n.removeTagAttributes())("multiple",!0)("saveOnChange",!1)("size","small"),l(),J(n.AttributeClass.ClientStatus),s("ngModel",n.clientStatusAttribute())("multiple",!1)("saveOnChange",!1)("size","small"),l(),f(n.reasonRequired()?11:-1),l(),f(n.showDeleted?12:-1),l(4),s("mat-dialog-close",void 0))},dependencies:[N,R,be,P,ye,I,W,z,Fe,oe,q,$,ne,Re,Kt,Te,Me,rt,ee,dt,ut,Lt,Bt,V,O,te,Le],encapsulation:2,changeDetection:0})}return t})();var Si=(t,r)=>r.id;function wi(t,r){t&1&&(o(0,"mat-checkbox",4),u(1," Protected information "),a()),t&2&&s("value","protected")}function Ai(t,r){if(t&1&&(o(0,"mat-checkbox",3),u(1),a()),t&2){let e=r.$implicit,i=p();s("value","form-"+e.id)("disabled",!i.includeProtected),l(),C(" ",e.name," ")}}var _i=(()=>{class t{include=["nonProtected"];forms$=M(null).pipe(G(()=>this.hasClientExportFullPermission),ae(()=>this._formData.gets({})));_api=m(ht);_data=m(L);_process=m(ti);_formData=m(jt);_acl=m(at);_sessionService=m(Se);get includeProtected(){return this.include.includes("protected")}get hasClientExportFullPermission(){return this._acl.has([{permission:k.ClientExport,access:F.Full},{permission:k.ClientExport,access:F.Full,object:this._sessionService.environmentId()}])}includeChange(){this.include.includes("protected")||(this.include=this.include.f
1ilter(e=>!e.startsWith("form-")))}save=()=>M(!0).pipe(y(()=>{let e=ue(ce({},this._data.filtersQuery),{includeProtected:this.includeProtected,includeFormIds:this.include.filter(i=>i.startsWith("form-")).map(i=>parseInt(i.replace("form-","")))});this._process.download("Export",this._api.post("clients/export",e,{key:"url"}))}));static \u0275fac=function(i){return new(i||t)};static \u0275cmp=x({type:t,selectors:[["ng-component"]],decls:18,vars:10,consts:[["fsForm","",3,"submit","dirtySubmitButton","confirm"],["mat-dialog-title",""],["label","Include","name","include",3,"ngModelChange","ngModel"],[3,"value","disabled"],[3,"value"],["mat-button","","type","submit","color","primary"],["mat-button","","type","button",3,"mat-dialog-close"]],template:function(i,n){i&1&&(o(0,"form",0)(1,"fs-dialog")(2,"fs-dialog-title")(3,"h1",1),u(4," Export "),a()(),o(5,"mat-dialog-content")(6,"fs-checkbox-group",2),Z("ngModelChange",function(_){return E(n.include,_)||(n.include=_),_}),g("ngModelChange",function(){return n.includeChange()}),o(7,"mat-checkbox",3),u(8," Non protected information "),a(),d(9,wi,2,1,"mat-checkbox",4),U(10,Ai,2,3,"mat-checkbox",3,Si),he(12,"async"),a()(),o(13,"mat-dialog-actions")(14,"button",5),u(15," Export "),a(),o(16,"button",6),u(17," Close "),a()()()()),i&2&&(s("submit",n.save)("dirtySubmitButton",!1)("confirm",!1),l(6),X("ngModel",n.include),l(),s("value","nonProtected")("disabled",!0),l(2),f(n.hasClientExportFullPermission?9:-1),l(),H(ve(12,8,n.forms$)),l(6),s("mat-dialog-close",void 0))},dependencies:[N,R,be,P,ye,I,W,z,Fe,oe,q,$,ne,xe,V,O,ee,te,Et,kt,Dt,ot],encapsulation:2,changeDetection:0})}return t})();var Mi=(t,r)=>r.clientStatusAttributeId;function Ti(t,r){if(t&1&&u(0),t&2){let e=p().$implicit;C(" ",e.name," ")}}function Fi(t,r){if(t&1&&u(0),t&2){let e=p().$implicit;C(" ",e.count," ")}}function ki(t,r){if(t&1){let e=A();o(0,"button",2),g("click",function(){let n=S(e).$implicit,c=p(2);return w(c.statusSelected.emit(n))}),o(1,"fs-tile",3),b(2,Ti,1,1,"ng-template",4)(3,Fi,1,1,"ng-template",5),a()()}if(t&2){let e=r.$implicit;l(),s("backgroundColor",e.backgroundColor)}}function Ei(t,r){if(t&1&&(o(0,"div")(1,"fs-tiles"),U(2,ki,4,1,"button",1,Mi),a()()),t&2){let e=p();l(2),H(e.clientStatusCounts())}}var Ke=(()=>{class t{statusSelected=tt();clientStatusCounts=D(null);_destroyRef=m(fe);_clientData=m(j);constructor(){this._init()}reload(){this._load()}_init(){this._load()}_load(){this._clientData.getClientStatusCounts().pipe(y(e=>{this.clientStatusCounts.set(e)}),Ae(this._destroyRef)).subscribe()}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=x({type:t,selectors:[["app-clients-status-counts"]],outputs:{statusSelected:"statusSelected"},decls:1,vars:1,consts:[[4,"fsSkeleton"],["type","button",1,"status-tile"],["type","button",1,"status-tile",3,"click"],[3,"backgroundColor"],["fsTileLabel",""],["fsTileContent",""]],template:function(i,n){i&1&&b(0,Ei,4,0,"div",0),i&2&&s("fsSkeleton",n.clientStatusCounts())},dependencies:[ke,Nt,si,ri,li,ai,oi],styles:["[_nghost-%COMP%]{display:block;margin-bottom:20px}.status-tile[_ngcontent-%COMP%]{padding:0;border:0;background:none;font:inherit;text-align:inherit;cursor:pointer}"],changeDetection:0})}return t})();var Pi=t=>[t],Ii=(t,r)=>r.id,Ri=(t,r)=>r.name;function Ni(t,r){if(t&1&&(o(0,"fs-chip",17),u(1),a()),t&2){let e=p(2).row;s("shape","square")("backgroundColor",e.partner==null?null:e.partner.color),l(),C(" ",e.partner==null?null:e.partner.name," ")}}function Bi(t,r){if(t&1&&(o(0,"a",14),Ve(1,15),a(),o(2,"div",16),u(3),d(4,Ni,2,3,"fs-chip",17),a()),t&2){let e=p().row,i=ge(3);s("routerLink",et(4,Pi,e.id)),l(),s("ngTemplateOutlet",i),l(2),C(" ",e.id," "),l(),f(e.partner?4:-1)}}function Li(t,r){if(t&1){let e=A();o(0,"a",18),g("click",function(){S(e);let n=p(2).row,c=p();return w(c.openDialog(n))}),Ve(1,15),a()}if(t&2){p(2);let e=ge(3);l(),s("ngTemplateOutlet",e)}}function Vi(t,r){t&1&&v(0,"app-conversation-followup-icon",19),t&2&&s("type","staff")}function Oi(t,r){t&1&&v(0,"app-conversation-followup-icon",19),t&2&&s("type","client")}function $i(t,r){if(t&1&&(u(0),d(1,Vi,1,1,"app-conversation-followup-icon",19),d(2,Oi,1,1,"app-conversation-followup-icon",19)),t&2){let e=p(2).row;C(" ",e.name," "),l(),f(e.conversationStaffFollowup?1:-1),l(),f(e.conversationClientFollowup?2:-1)}}function qi(t,r){if(t&1&&d(0,Li,2,1,"a")(1,$i,3,3),t&2){let e=p().row;f(e.state!=="deleted"?0:1)}}function zi(t,r){t&1&&v(0,"app-conversation-followup-icon",19),t&2&&s("type","staff")}function Wi(t,r){t&1&&v(0,"app-conversation-followup-icon",19),t&2&&s("type","client")}function ji(t,r){if(t&1&&(o(0,"div",20),u(1),d(2,zi,1,1,"app-conversation-followup-icon",19),d(3,Wi,1,1,"app-conversation-followup-icon",19),a()),t&2){let e=p().row;l(),C(" ",e.name," "),l(),f(e.conversationStaffFollowup?2:-1),l(),f(e.conversationClientFollowup?3:-1)}}function Qi(t,r){if(t&1&&(o(0,"div"),v(1,"fs-attributes",21),a()),t&2){let e=p().row,i=p();l(),J(i.AttributeClass.ClientTag),s("attributes",e.tags)}}function Gi(t,r){if(t&1&&(d(0,Bi,5,6)(1,qi,2,1),b(2,ji,4,3,"ng-template",null,0,$e),d(4,Qi,2,3,"div")),t&2){let e=r.row,i=p();f(i.navigateDialog?0:1),l(4),f(e.tags!=null&&e.tags.length?4:-1)}}function Ui(t,r){if(t&1&&(o(0,"fs-chip",22),u(1),a()),t&2){let e=p().row;s("backgroundColor",e.clientStatusAttribute.backgroundColor),l(),C(" ",e.clientStatusAttribute.name," ")}}function Hi(t,r){if(t&1&&d(0,Ui,2,2,"fs-chip",22),t&2){let e=r.row;f(e.clientStatusAttribute?0:-1)}}function Ki(t,r){if(t&1&&(o(0,"div",23),u(1),he(2,"fsPhone"),a()),t&2){let e=p().row;l(),C(" ",ve(2,1,e.phone)," ")}}function Yi(t,r){if(t&1&&(o(0,"div",23),u(1),a()),t&2){let e=p().row;l(),Ce(" ",e.address.region,", ",e.address.country," ")}}function Ji(t,r){if(t&1&&(u(0),d(1,Ki,3,3,"div",23),d(2,Yi,2,2,"div",23)),t&2){let e=r.row;C(" ",e.email," "),l(),f(e.phone?1:-1),l(),f(e.address.region||e.address.country?2:-1)}}function Xi(t,r){if(t&1){let e=A();o(0,"div")(1,"a",18),g("click",function(){let n=S(e).$implicit,c=p(2);return w(c.openProgramDialog(n))}),u(2),a()()}if(t&2){let e=r.$implicit;l(2),C(" ",e.program==null?null:e.program.name," ")}}function Zi(t,r){if(t&1&&U(0,Xi,3,1,"div",null,Ii),t&2){let e=r.row;H(e.clientPrograms)}}function en(t,r){if(t&1&&(o(0,"app-pharmacy-popover",24),v(1,"app-pharmacy-name",24),a()),t&2){let e=p().row;s("environment",e.environment),l(),s("environment",e.environment)}}function tn(t,r){if(t&1&&d(0,en,2,2,"app-pharmacy-popover",24),t&2){let e=r.row;f(e.environment?0:-1)}}function nn(t,r){if(t&1&&(o(0,"tr")(1,"td",29),u(2),a(),o(3,"td",30),v(4,"fs-date",31),a()()),t&2){let e=r.$implicit;l(2),C(" ",e.name," "),l(2),s("date",e.completeDate)}}function on(t,r){if(t&1&&(o(0,"table",28),U(1,nn,5,2,"tr",null,Ri),a()),t&2){p(2);let e=Oe(0);l(),H(e)}}function an(t,r){if(t&1&&(o(0,"div",25)(1,"fs-popover",26),v(2,"f
1s-badge",27),a()(),b(3,on,3,0,"ng-template",null,1,$e)),t&2){let e=ge(4);p();let i=Oe(0);l(),s("template",e)("indication",!1)("maxWidth",null),l(),s("text",i.length)("color","var(--brand-primary-color)")("size",24)}}function rn(t,r){if(t&1&&(Xe(0),d(1,an,5,6)),t&2){let e=r.row,i=Ze(p().completedMilestones(e));l(),f(i.length?1:-1)}}function ln(t,r){if(t&1){let e=A();o(0,"app-staff-profile-avatar",33),g("saved",function(){S(e);let n=p(2);return w(n.reload())}),a()}if(t&2){let e=p().row;s("account",e.practitionerAccount)}}function sn(t,r){if(t&1&&d(0,ln,1,1,"app-staff-profile-avatar",32),t&2){let e=r.row;f(e.practitionerAccount?0:-1)}}function mn(t,r){if(t&1){let e=A();o(0,"app-staff-profile-avatar",33),g("saved",function(){S(e);let n=p(2);return w(n.reload())}),a()}if(t&2){let e=p().row;s("account",e.supportAccount)}}function pn(t,r){if(t&1&&d(0,mn,1,1,"app-staff-profile-avatar",32),t&2){let e=r.row;f(e.supportAccount?0:-1)}}function cn(t,r){if(t&1&&v(0,"fs-date-ago",31),t&2){let e=p().row;s("date",e.signinDate)}}function un(t,r){t&1&&u(0," Never signed in ")}function dn(t,r){if(t&1&&(v(0,"fs-date-ago",31),o(1,"div",23),d(2,cn,1,1,"fs-date-ago",31)(3,un,1,0),a()),t&2){let e=r.row;s("date",e.createDate),l(2),f(e.signinDate?2:3)}}var gi=(()=>{class t{list;statusCounts;listConfig;AttributeClass=me;milestoneTypeNames=Ne(Be);_destroy$=new Ye;_dialogRef=m(B,{optional:!0});_clientData=m(j);_navService=m(ei);_dialog=m(De);_attributeData=m(vt);_environmentData=m(Wt);_fsDialog=m(xt);_aclService=m(ft);_sessionService=m(Se);_accountData=m(we);_programData=m(Gt);_partnerData=m(Qt);_message=m(ie);_savedFilterService=m(Ut);_prompt=m(Pt);get navigateDialog(){return!this._dialogRef}completedMilestones(e){return(e.clientMilestones??[]).filter(i=>!!i.completeDate&&!!this.milestoneTypeNames[i.type]).map(i=>({name:this.milestoneTypeNames[i.type],completeDate:new Date(i.completeDate)})).sort((i,n)=>n.completeDate.getTime()-i.completeDate.getTime())}ngOnInit(){this._initTitle(),this._initListConfig(),this._initDialog()}openDialog(e={id:null}){this._dialog.open(pe,{data:{client:e}}).afterClosed().pipe(Y(this._destroy$)).subscribe(()=>{this.reload()})}openProgramDialog(e){this._dialog.open(pi,{data:{clientProgram:e}}).afterClosed().pipe(Y(this._destroy$)).subscribe(()=>{this.reload()})}applyStatus(e){this.list.filterRef.getItem("clientStatusAttributeId").setValue([{name:e.name,value:e.clientStatusAttributeId??"none"}],!1),this.list.reload()}reload(){this.list.reload(),this.statusCounts?.reload()}ngOnDestroy(){this._destroy$.next(),this._destroy$.complete()}_initDialog(){this._fsDialog.dialogRef$(pe).pipe(ae(e=>e.afterClosed()),Y(this._destroy$)).subscribe(()=>{this.reload()})}_getFilters(){return[{name:"keyword",type:h.Keyword,label:"Search"},{name:"clientStatusAttributeId",type:h.AutoCompleteChips,label:"Status",values:e=>this._attributeData.gets({keyword:e,class:me.ClientStatus}).pipe(T(i=>[..."unassigned".includes(e.toLowerCase())?[{name:"Unassigned",value:"none"}]:[],...K(i,"name","id")]))},{name:"milestoneType",type:h.AutoCompleteChips,label:"Milestones",values:e=>M(Be.filter(i=>i.name.toLowerCase().includes(e.toLowerCase())))},{name:"notMilestoneType",type:h.AutoCompleteChips,label:"Without milestones",values:e=>M(Be.filter(i=>i.name.toLowerCase().includes(e.toLowerCase())))},{name:"bloodworkRequirement",type:h.AutoCompleteChips,label:"Blood work",values:e=>M(Xt.filter(i=>i.name.toLowerCase().includes(e.toLowerCase())))},{name:"allTagAttributeId",type:h.AutoCompleteChips,label:"Includes all tags",values:e=>this._attributeData.gets({keyword:e,class:"tag"}).pipe(T(i=>K(i,"name","id")))},{name:"tagAttributeId",type:h.AutoCompleteChips,label:"Includes any tags",values:e=>this._attributeData.gets({keyword:e,class:"tag"}).pipe(T(i=>K(i,"name","id")))},{name:"region",type:h.AutoCompleteChips,label:"Province",values:e=>{let i=Tt.find(n=>n.code===Ft.Canada.toString());return M(i.regions.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())).map(n=>({name:n.name,value:n.code})))}},{name:"pharmacyType",type:h.Select,label:"Pharmacy type",multiple:!1,values:[{name:"All",value:""},{name:"Internal",value:We.Internal},{name:"External",value:We.External}]},{name:"clinicianAccountId",type:h.AutoCompleteChips,label:"Clinician",values:e=>this._accountData.gets({keyword:e,type:pt.Clinician}).pipe(T(i=>K(i,"name","id")))},{name:"environmentId",type:h.AutoCompleteChips,label:"Pharmacy",values:e=>this._environmentData.gets({keyword:e}).pipe(T(i=>K(i,"name","id")))},{name:"subscriptionStatus",type:h.Select,label:"Subscription Status",multiple:!1,values:Zt},{name:"activePaymentMethodProvider",type:h.Select,label:"Active payment method provider",multiple:!0,change:e=>{e.model?.includes("none")&&e.model.length>1&&(e.model=["none"])},values:[{name:"None",value:"none"},{name:"Stripe",value:"stripe"},{name:"Square",value:"square"}]},{name:"programId",type:h.AutoCompleteChips,label:"Program",values:e=>this._programData.gets({keyword:e}).pipe(T(i=>K(i,"name","id")))},{name:"partnerId",type:h.AutoCompleteChips,label:"Partner",chipBackgroun
1d:"color",values:e=>this._partnerData.gets({keyword:e,limit:50}).pipe(T(i=>i.map(n=>({name:n.name,value:n.id,color:n.color}))))},{name:"createDate",type:h.DateRange,label:["Create date from","Create date to"]}]}_initListConfig(){let e=this._getFilters(),i=this._getSelectionActions();this.listConfig={filters:e,savedFilters:this._savedFilterService.getConfig(ct.Clients,e.map(n=>n.name)),selection:i.length?{actions:i,actionSelected:n=>this._selectionAction(n)}:null,actions:[{label:"Export",primary:!1,show:()=>this._aclService.has([{permission:k.ClientExport,access:F.Read},{permission:k.ClientExport,access:F.Read,object:this._sessionService.environmentId()}]),click:()=>{this._dialog.open(_i,{data:{filtersQuery:this.list.filtersQuery}}).afterClosed().pipe(Y(this._destroy$)).subscribe(()=>{this.list.reload()})}},{label:"Create",click:()=>{this.openDialog()},show:()=>this._aclService.hasPermissionAdmin()}],rowActions:[{click:n=>{this._dialog.open(ci,{data:{client:n}}).afterClosed().pipe(G(c=>!!c),Y(this._destroy$)).subscribe(()=>{this.reload()})},show:()=>this._aclService.has([{permission:k.Client,access:F.Full}]),label:"Delete"}],sorts:[{value:"signin_date",name:"Last Sign-In"}],fetch:n=>(n=ue(ce({},n),{tags:!0,addresses:!0,environments:!0,environmentAddresses:!0,partners:!0,clientStatusAttributes:!0,conversationStaffFollowups:!0,conversationClientFollowups:!0,clientPrograms:!0,clientMilestones:!0,practitionerAccounts:!0,practitionerAccountAvatars:!0,supportAccounts:!0,supportAccountAvatars:!0}),this._clientData.gets(n,{key:null}).pipe(T(c=>({data:c.clients,paging:c.paging})))),restore:{query:{state:"deleted"},filterLabel:"Show Deleted",menuLabel:"Restore",reload:!0,click:n=>this._clientData.undelete(n.id).pipe(y(()=>this.statusCounts?.reload()))}}}_getSelectionActions(){let e=[];return this._aclService.has([{permission:k.Client,access:F.Write}])&&e.push({label:"Bulk actions",type:je.Action,name:"bulk"}),this._aclService.has([{permission:k.Client,access:F.Full}])&&e.push({label:"Request new payment method",type:je.Action,name:"requestNewPaymentMethod"}),e}_initTitle(){this._navService.setTitle("Clients")}_selectionAction(e){let i=e.selected.map(n=>n.id);return e.action.name==="bulk"?this._openBulkDialog(i):this._requestNewPaymentMethod(i)}_openBulkDialog(e){return this._dialog.open(fi,{data:{clientIds:e,showDeleted:this._showDeleted}}).afterClosed().pipe(G(i=>!!i),y(i=>{this.reload(),this._messageBulkResult(i,e.length)}))}_requestNewPaymentMethod(e){let i=`${e.length} client${e.length===1?"":"s"}`;return this._prompt.confirm({title:"Request new payment method",template:`This will immediately email the ${i} you selected, telling them their payment could not be processed and asking them to sign in to the client portal and update their payment information. Are you sure you want to send it?`,commitLabel:"Send"}).pipe(ae(()=>this._clientData.bulkRequestPaymentMethod(e)),y(()=>{this._message.success(`Request new payment method sent to ${i}`)}))}_messageBulkResult(e,i){let n=e.succeeded.length;if(n===i){this._message.success(`${n} client(s) updated`);return}let c=Array.from(new Set(e.failed.map(_=>_.message).filter(Boolean)));this._message.warning([`${n} of ${i} client(s) updated.`,`${e.failed.length} could not be updated.`,...c].join(" "))}get _showDeleted(){return this.list?.list?.filtersQuery?.state==="deleted"}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=x({type:t,selectors:[["ng-component"]],viewQuery:function(i,n){if(i&1&&(re(Ie,5),re(Ke,5)),i&2){let c;le(c=se())&&(n.list=c.first),le(c=se())&&(n.statusCounts=c.first)}},decls:23,vars:5,consts:[["name",""],["milestonePopover",""],[3,"statusSelected"],[3,"config"],["name","first_name","title","Name",3,"sortable"],["fs-list-cell",""],["title","Status"],["title","Contact"],["title","Programs"],["title","Pharmacy"],["title","Milestones"],["title","Clinician"],["title","Support"],["title","Created / Sign-In","name","create_date",3,"sortable","sortableDirection","sortableDefault"],[3,"routerLink"],[3,"ngTemplateOutlet"],[1,"small","fs-row.gap-xs.align-center"],["size","micro",3,"shape","backgroundColor"],[3,"click"],[3,"type"],[1,"fs-row.gap-xs.align-center"],["size","tiny",3,"attributes"],["size","small",3,"backgroundColor"],[1,"small"],[3,"environment"],[1,"fs-row.justify-center"],[3,"template","indication","maxWidth"],[3,"text","color","size"],[1,"milestones-popover"],[1,"milestones-popover__name"],[1,"milestones-popover__date","small"],[3,"date"],[3,"account"],[3,"saved","account"]],template:function(i,n){i&1&&(o(0,"mat-card")(1,"mat-card-content")(2,"app-clients-status-counts",2),g("statusSelected",function(_){return n.applyStatus(_)}),a(),o(3,"fs-list",3)(4,"fs-list-column",4),b(5,Gi,5,2,"ng-template",5),a(),o(6,"fs-list-column",6),b(7,Hi,1,1,"ng-template",5),a(),o(8,"fs-list-column",7),b(9,Ji,3,3,"ng-template",5),a(),o(10,"fs-list-column",8),b(11,Zi,2,0,"ng-template",5),a(),o(12,"fs-list-column",9),b(13,tn,1,1,"ng-template",5),a(),o(14,"fs-list-column",10),b(15,rn,2,2,"ng-template",5),a(),o(16,"fs-list-column",11),b(17,sn,1,1,"ng-template",5),a(),o(18,"fs-list-column",12),b(19,pn,1,1,"ng-template",5),a(),o(20,"fs-list-column",13),b(21,dn,4,2,"ng-template",5),a()()()(),v(22,"router-outlet")),i&2&&(l(3),s("config",n.listConfig),l(),s("sortable",!0),l(16),s("sortable",!0)("sortableDirection","desc")("sortableDefault",!0))},dependencies:[bt,yt,$t,Ie,Ot,Vt,st,nt,mi,Re,Yt,Pe,Ee,Mt,At,ni,ii,Ct,_t,gt,lt,zt,Rt,It,di,Ke,qt],styles:[".milestones-popover[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:3px;white-space:nowrap}.milestones-popover__name[_ngcontent-%COMP%]{font-weight:500}.milestones-popover__date[_ngcontent-%COMP%]{padding-left:20px}"],changeDetection:0})}return t})();var fn=[{path:"",component:gi,children:[St({path:":id",component:pe,data:{}})]}],Ci=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=_e({type:t});static \u0275inj=de({imports:[ze.forChild(fn),ze]})}return t})();var Sr=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=_e({type:t});static \u0275inj=de({imports:[Ci]})}return t})();export{gi as ClientsComponent,Sr as ClientsModule,Ci as ClientsRoutingModule};
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.