1import {B as Bt}from'./chunk-CJ2yeGM5.js';import {o as oi}from'./chunk-DM6ctPue.js';import'./chunk-CRxq4SBi.js';import {S}from'./chunk-B3u5vfS_.js';import {P as P$1}from'./chunk-329OKGpO.js';import {E as En,D as De}from'./chunk-D3crpTkA.js';import'./chunk-C2EVnWPI.js';import'./chunk-CC_dzDIF.js';import {c as ce}from'./chunk-Cha4_V9g.js';import'./chunk-yuXVPJRt.js';import {g,b as gr,E,D,c8 as Xr,ay as o,H,f,bQ as P,bO as Gt,cA as zM,A as Ao,aE as lt,h as c$1,a as G,O,az as Ke,K as Kb,P as Pg,T as Tt$1,V as Vg,j as ai,cz as aE,cr as pe,d5 as Pe,k as Kv,l as b0,L as L0,Y as Yx,m as dn,b2 as da,bR as Ch,n as Vw,bA as Pw,o as nk,t as td,p as tC,q as bC,s as sv,aF as ta,aG as pr,aH as ov,N as NC,X as XC,_ as _D,aO as oD,aP as lD,r as il,u as XD,v as rM,F as Fb,w as t1,y as A1,z as gS,B as Vs,C as zs,I as Fi,J as NS,Z as ZS,M as EI,Q as us,R as ms,S as HI,U as ZI,$ as Dn,a0 as kE,a1 as Jv,a2 as go,a3 as qd,av as on,a4 as YE,a5 as OT,a6 as lA,a7 as mt,a8 as cy,aa as Xs,ae as fS,ab as my,ad as hd,ac as V_,a9 as qT,aB as Qm,ai as ay,bC as tS,ag as _C,bD as Z_,al as hS,ah as ZT,dC as eS,aZ as Ey,a_ as g_,a$ as m_,aR as o_,aS as Pp,aT as l_,aU as Lp,ak as Dd,aj as ky,bf as Ty,bi as v_,be as Y_,cG as yd,cH as Da,bm as Vg$1}from'./main-CTPND76J.js';import'./chunk-CAH8VGMK.js';var ht=["searchInput"],gt=()=>["Add a user \u2014 they get an email with a link to verify and set their own password.","Give each user a role; the role is what decides their permissions.","Use Resend verification email if someone never received their invitation.","View as customer shows you what that user sees, which is the quickest way to check a permission problem."],vt=()=>["Read_Users"],Mt=()=>["Read_Customers"],ct=()=>["Manage_Users"];function St(i,s){if(i&1){let e=o_();Xs(0,"button",14),my("click",function(){Pp(e);let l=l_();return Lp(l.addSocialLabSupportUser())}),Xs(1,"mat-icon",15),V_(2,"headset_mic"),hd(),V_(3),fS(4,"translate"),hd();}i&2&&(_C(3),Dd(" ",hS(4,1,"Add Social Lab Support User")," "));}function Ct(i,s){if(i&1&&(Xs(0,"div",24),cy(1,"img",25),Xs(2,"div",26)(3,"p",27),V_(4),hd(),Xs(5,"small",28),V_(6),hd()()()),i&2){let e=s.$implicit,t=l_(2);_C(),ay("src",t.getUserProfileImg(e.profilePicPath),Vg$1),_C(3),Dd(" ",e.phoneNumber," "),_C(2),ky(e.email);}}function xt(i,s){if(i&1&&V_(0),i&2){let e=s.$implicit;Dd(" ",e.name," ");}}function bt(i,s){if(i&1&&V_(0),i&2){let e=s.$implicit;Dd(" ",e.nickname," ");}}function wt(i,s){if(i&1&&(Xs(0,"div",29),cy(1,"app-user-presence-dot",30),Xs(2,"span",31),V_(3),hd()()),i&2){let e=s.$implicit,t=l_(2);_C(),ay("status",t.getUserPresenceStatus(e.id)),_C(2),Dd(" ",t.getUserLastSeen(e.id)," ");}}function Ut(i,s){if(i&1&&cy(0,"app-status-icon",32),i&2){let e=s.$implicit;ay("isActive",e.isAvaliableForChat)("iconType","check");}}function yt(i,s){if(i&1&&(Xs(0,"div",33),cy(1,"img",34)(2,"img",35)(3,"img",36),hd()),i&2){let e=s.$implicit,t=l_(2);_C(),Ty("filter",e.isVerifiedSMS===true?"brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(118%) contrast(119%)":"brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%)"),ay("src","/assets/images/icons/sms.png",Vg$1)("matTooltip","SMS: "+t.getVerificationStatus(e.isVerifiedSMS)),_C(),Ty("filter",e.isVerifiedEmail===true?"brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(118%) contrast(119%)":"brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%)"),ay("src","/assets/images/icons/email.png",Vg$1)("matTooltip","Email: "+t.getVerificationStatus(e.isVerifiedEmail)),_C(),Ty("filter",e.isVerifiedWhatsApp===true?"brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(118%) contrast(119%)":"brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%)"),ay("src","/assets/images/icons/whatsapp.png",Vg$1)("matTooltip","WhatsApp: "+t.getVerificationStatus(e.isVerifiedWhatsApp));}}
1function Tt(i,s){if(i&1&&(yd(0),Xs(1,"a",39)(2,"mat-icon",15),V_(3,"person"),hd(),Xs(4,"span"),V_(5),fS(6,"translate"),hd()(),Da()),i&2){let e=l_().$implicit;_C(),ay("routerLink",Y_("/apps/customers/customer-profile/",e.customerId)),_C(4),ky(hS(6,3,"View as customer"));}}function Et(i,s){if(i&1){let e=o_();yd(0),Xs(1,"button",41),my("click",function(l){Pp(e);let o=l_().$implicit;return l_(2).openUpdateDialog(o),Lp(l.stopPropagation())}),Xs(2,"mat-icon",15),V_(3,"edit"),hd(),Xs(4,"span"),V_(5),fS(6,"translate"),hd()(),Da();}i&2&&(_C(5),ky(hS(6,1,"Edit user")));}function kt(i,s){if(i&1){let e=o_();Xs(0,"button",41),my("click",function(l){Pp(e);let o=l_(2).$implicit;return l_(2).resendVerification(o),Lp(l.stopPropagation())}),Xs(1,"mat-icon",15),V_(2,"mark_email_unread"),hd(),Xs(3,"span"),V_(4),fS(5,"translate"),hd()();}i&2&&(_C(4),ky(hS(5,1,"Resend verification email")));}function Lt(i,s){if(i&1&&(yd(0),qT(1,kt,6,3,"button",42),Da()),i&2){let e=l_().$implicit;_C(),ZT(e.isVerifiedEmail?-1:1);}}function It(i,s){if(i&1&&(Xs(0,"div",37)(1,"button",38),my("click",function(t){return t.stopPropagation()}),Xs(2,"mat-icon"),V_(3,"more_vert"),hd()(),Xs(4,"mat-menu",null,1)(6,"a",39)(7,"mat-icon",15),V_(8,"visibility"),hd(),Xs(9,"span"),V_(10),fS(11,"translate"),hd()(),Qm(12,Tt,7,5,"ng-container",40)(13,Et,7,3,"ng-container",40)(14,Lt,2,1,"ng-container",40),hd()()),i&2){let e=s.$implicit,t=v_(5);_C(),ay("matMenuTriggerFor",t),_C(5),ay("routerLink",Y_("/apps/users/user-profile/",e.id)),_C(4),ky(hS(11,7,"View user")),_C(2),ay("ngxPermissionsOnly",tS(9,Mt)),_C(),ay("ngxPermissionsOnly",tS(10,ct)),_C(),ay("ngxPermissionsOnly",tS(11,ct));}}function Pt(i,s){if(i&1){let e=o_();Xs(0,"mat-card",3)(1,"mat-card-content",4)(2,"app-responsive-table",16),my("rowClick",function(l){Pp(e);let o=l_();return Lp(o.onRowClicked(l))}),Qm(3,Ct,7,3,"ng-template",17)(4,xt,1,1,"ng-template",18)(5,bt,1,1,"ng-template",19)(6,wt,4,2,"ng-template",20)(7,Ut,1,2,"ng-template",21)(8,yt,4,12,"ng-template",22)(9,It,15,12,"ng-template",23),hd()()();}if(i&2){let e=l_();_C(2),ay("dataSource",e.filteredUsers)("columns",e.columns)("loading",e.isLoading);}}var Gi=(()=>{class i{constructor(e,t,l,o,f,pt,dt,ut,ft,_t){this.usersService=e,this.loadingService=t,this.errorService=l,this.datePipe=o,this.authService=f,this.toastr=pt,this.dialogConfigService=dt,this.router=ut,this.translate=ft,this.presenceService=_t,this.dialog=g(gr),this.users=[],this.filteredUsers=[],this.isLoading=false,this.expandedElement=null,this.columns=[{key:"username",label:"Username",priority:1},{key:"name",label:"Name",priority:1},{key:"nickname",label:"Nickname",priority:2},{key:"presence",label:"Status",priority:2},{key:"isAvaliableForChat",label:"Available for Chat",priority:2},{key:"verificationStatus",label:"Verification Status",priority:3},{key:"actions",label:"",priority:1,hideLabel:true,stickyEnd:true}];}ngOnInit(){this.getUsers();}ngOnDestroy(){this.sub&&this.sub.unsubscribe();}openUpdateDialog(e){let t=this.dialogConfigService.getDefaultDialogConfig();this.dialog.open(oi,E(D({},t),{data:{userId:e.id}})).afterClosed().subscribe(o=>{o!==void 0&&o.submitted&&this.getUsers();});}searchUsers(){let e=this.searchInput.nativeElement.value.toLowerCase().trim();if(e)this.filteredUsers=this.users.filter(t=>t.name.toLowerCase().includes(e)||t.phoneNumber.includes(e)||t.email.includes(e)||t.nickname.includes(e));else {this.filteredUsers=[...this.users];return}}getUsers(){let e=this.searchInput.nativeElement.value;this.isLoading=true,this.loadingService.beginSuppress(),this.sub=this.usersService.getUsers(e,null,0,100).pipe(Xr(()=>{this.isLoading=false,this.loadingService.endSuppress();})).subscribe({next:t=>{this.users=t.data,this.filteredUsers=t.data;},error:t=>{this.errorService.setError(t,"Error while getting the data"),this.searchInput.nativeElement.value=null;}});}getUserProfileImg(e){return this.authService.getProfilePath(e)}getUserPresenceStatus(e){return this.presenceService.getUserPresence(e)?.status??o.Offline}getUserLastSeen(e){let t=this.presenceService.getUserPresence(e);if(!t||t.status!==o.Offline)return "";let l=Date.now()-new Date(t.lastSeen).getTime(),o$1=Math.floor(l/6e4);if(o$1<1)return this.translate.instant("Just now");if(o$1<60)return `${o$1} ${this.translate.instant("min ago")}`;let f=Math.floor(o$1/60);return f<24?`${f} ${this.translate.instant("h ago")}`:`${Math.floor(f/24)} ${this.translate.instant("d ago")}`}getVerificationStatus(e){return e==null?this.translate.instant("Not Verified"):e?this.translate.instant("Verified"):this.translate.instant("Not Verified")}addSocialLabSupportUser(){this.loadingService.loadingOn(),this.sub=this.usersService.createUser({phoneNumber:"966530901484",nickname:"\u062F\u0639\u0645 \u0633\u0648\u0634\u0644 \u0644\u0627\u0628",name:"\u062F\u0639\u0645 \u0633\u0648\u0634\u0644 \u0644\u0627\u0628",email:"[email protected]",roles:["Reader","Writer","ContactsManager","Admin"],password:"aa@@dd
1BB66"}).subscribe({next:e=>{e.succeeded?(this.loadingService.loadingOff(),this.toastr.info("Added Successfully"),this.searchUsers()):this.errorService.setError(e,"Error while adding the user");},error:e=>{this.errorService.setError(e,"Error while adding the user");}});}hasSocialLabSupportUser(){return this.users.some(e=>e.email==="[email protected]")}goToAddUserRoute(){this.router.navigate(["/apps/users/add-user"]);}resendVerification(e){this.loadingService.loadingOn(),this.usersService.resendVerificationEmail(e.id).pipe(Xr(()=>this.loadingService.loadingOff())).subscribe({next:t=>{t.succeeded?this.toastr.success(this.translate.instant("Verification email sent.")):this.errorService.setError(t,"Error while sending the verification email");},error:t=>{this.errorService.setError(t,"Error while sending the verification email");}});}onRowClicked(e){this.router.navigate(["/apps/users/user-profile",e.id]);}static{this.\u0275fac=function(t){return new(t||i)(H(f),H(P),H(Gt),H(zM),H(Ao),H(lt),H(c$1),H(G),H(O),H(Ke))};}
1static{this.\u0275cmp=Kb({type:i,selectors:[["app-users-list"]],viewQuery:function(t,l){if(t&1&&Ey(ht,7),t&2){let o;g_(o=m_())&&(l.searchInput=o.first);}},features:[eS([zM])],decls:15,vars:9,consts:[["searchInput",""],["actionMenu","matMenu"],["helpKey","users-list","intro","The people in your team who can log into SocialLab, and what each of them is allowed to do.","warning","A user who never verifies their email cannot log in, even though they appear in this list.",3,"steps"],[1,"cardWithShadow"],[1,"p-24"],[1,"row","justify-content-between"],[1,"col-lg-4"],[1,"w-100","hide-hint"],["matInput","","id","searchInput","autocomplete","off",3,"input","placeholder"],["matSuffix","",1,"icon-18","m-r-8",3,"click"],[1,"col-lg-8","d-flex","align-items-center","justify-content-end"],["permission","Manage_Users","className","m-10","icon","person_add","label","Add User","color","primary",3,"clickAction"],["mat-flat-button","","color","accent",1,"m-10"],["class","cardWithShadow",4,"ngxPermissionsOnly"],["mat-flat-button","","color","accent",1,"m-10",3,"click"],[1,"icon-18"],[3,"rowClick","dataSource","columns","loading"],["rtColumnDef","username"],["rtColumnDef","name"],["rtColumnDef","nickname"],["rtColumnDef","presence"],["rtColumnDef","isAvaliableForChat"],["rtColumnDef","verificationStatus"],["rtColumnDef","actions"],[1,"d-flex","align-items-center"],["width","40","alt","",1,"rounded-circle",3,"src"],[1,"m-l-16"],[1,"f-w-600","mat-subtitle-1","f-s-16","m-t-0"],[1,"mat-body-1","f-s-14"],[1,"d-flex","align-items-center",2,"gap","6px"],[3,"status"],[1,"f-s-12",2,"color","var(--mat-sys-on-surface-variant, #9e9e9e)"],[3,"isActive","iconType"],[1,"d-flex","align-items-center",2,"gap","8px"],["width","24","height","24","alt","SMS",1,"cursor-pointer",3,"src","matTooltip"],["width","24","height","24","alt","Email",1,"cursor-pointer",3,"src","matTooltip"],["width","24","height","24","alt","WhatsApp",1,"cursor-pointer",3,"src","matTooltip"],[1,"action-links-row"],["mat-icon-button","","aria-label","more vert",3,"click","matMenuTriggerFor"],["mat-menu-item","",3,"routerLink"],[4,"ngxPermissionsOnly"],["mat-menu-item","",3,"click"],["mat-menu-item",""]],template:function(t,l){t&1&&(cy(0,"app-page-help",2),Xs(1,"mat-card",3)(2,"mat-card-content",4)(3,"div",5)(4,"div",6)(5,"mat-form-field",7)(6,"input",8,0),fS(8,"translate"),my("input",function(){return l.searchUsers()}),hd(),Xs(9,"mat-icon",9),my("click",function(){return l.searchUsers()}),V_(10,"search"),hd()()(),Xs(11,"div",10)(12,"app-permission-button",11),my("clickAction",function(){return l.goToAddUserRoute()}),hd(),qT(13,St,5,3,"button",12),hd()()()(),Qm(14,Pt,10,3,"mat-card",13)),t&2&&(ay("steps",tS(7,gt)),_C(6),ay("placeholder",Z_(hS(8,5,"Search"))),_C(7),ZT(l.hasSocialLabSupportUser()?-1:13),_C(),ay("ngxPermissionsOnly",tS(8,vt)));},dependencies:[ce,Pg,Tt$1,Vg,ai,aE,pe,Pe,Bt,S,En,De,P$1,Kv,b0,L0,Yx,dn,da,Ch,Vw,Pw,nk,td,tC,bC,sv,ta,pr,ov,NC,XC,_D,oD,lD,il,XD,rM,Fb,t1,A1,gS,Vs,zs,Fi,NS,ZS,EI,us,ms,HI,ZI,Dn,kE,Jv,go,qd,on,YE,OT,lA,mt],encapsulation:2,changeDetection:1});}}return i})();export{Gi as UsersListComponent};
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.