1"use strict";(self.webpackChunktruMobile=self.webpackChunktruMobile||[]).push([[229],{99938:(N,y,a)=>{a.d(y,{h:()=>S});var p=a(65938),c=a(94650),e=a(36895),T=a(4859),A=a(89383);function C(f,P){if(1&f&&(c.TgZ(0,"h2",3),c._uU(1),c.qZA()),2&f){const _=c.oxw();c.xp6(1),c.Oqu(_.data.title)}}let S=(()=>{class f{constructor(_){this.data=_}}return f.\u0275fac=function(_){return new(_||f)(c.Y36(p.WI))},f.\u0275cmp=c.Xpm({type:f,selectors:[["app-alert-dialog"]],decls:7,vars:5,consts:[["mat-dialog-title","",4,"ngIf"],[2,"white-space","pre-line"],["mat-raised-button","","color","secondary","type","button","cdkFocusInitial","",1,"test__close",3,"mat-dialog-close"],["mat-dialog-title",""]],template:function(_,O){1&_&&(c.YNc(0,C,2,1,"h2",0),c.TgZ(1,"mat-dialog-content",1),c._uU(2),c.ALo(3,"translate"),c.qZA(),c.TgZ(4,"mat-dialog-actions")(5,"button",2),c._uU(6,"Close"),c.qZA()()),2&_&&(c.Q6J("ngIf",O.data.title),c.xp6(2),c.Oqu(c.lcZ(3,3,O.data.content)),c.xp6(3),c.Q6J("mat-dialog-close",!0))},dependencies:[e.O5,p.ZT,p.uh,p.xY,p.H8,T.lW,A.X$],encapsulation:2}),f})()},88660:(N,y,a)=>{a.d(y,{p:()=>A});var p=a(36895),c=a(56075),e=a(14180),T=a(94650);let A=(()=>{class C{}return C.\u0275fac=function(f){return new(f||C)},C.\u0275mod=T.oAB({type:C}),C.\u0275inj=T.cJS({imports:[p.ez,c.NDt,e.Z,c.NDt]}),C})()},229:(N,y,a)=>{a.r(y),a.d(y,{PermissionsModule:()=>Ae});var p=a(34793),c=a(36895),e=a(94650),T=a(3848),A=a(89383);let C=(()=>{class i{constructor(){}}return i.\u0275fac=function(t){return new(t||i)},i.\u0275cmp=e.Xpm({type:i,selectors:[["app-permissions"]],decls:11,vars:8,consts:[[1,"container"],["mat-tab-nav-bar",""],["mat-tab-link","","routerLinkActive","","routerLink","/admin/permissions/broker-users",1,"test__users-tab",3,"active"],["rla","routerLinkActive"],["mat-tab-link","","routerLinkActive","","routerLink","/admin/permissions/roles",1,"test__roles-tab",3,"active"],["rlb","routerLinkActive"]],template:function(t,o){if(1&t&&(e.TgZ(0,"div",0)(1,"nav",1)(2,"a",2,3),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"a",4,5),e._uU(8),e.ALo(9,"translate"),e.qZA()(),e._UZ(10,"router-outlet"),e.qZA()),2&t){const r=e.MAs(3),n=e.MAs(7);e.xp6(2),e.Q6J("active",r.isActive),e.xp6(2),e.Oqu(e.lcZ(5,4,"permissions.users_tab")),e.xp6(2),e.Q6J("active",n.isActive),e.xp6(2),e.Oqu(e.lcZ(9,6,"permissions.teams_tab"))}},dependencies:[p.lC,p.yS,p.Od,T.BU,T.Nj,A.X$],encapsulation:2}),i})();var S=a(88660),f=a(90455),P=a(4859),_=a(97392),O=a(97681),Z=a(57381),R=a(53510),B=a(99938),M=a(87025),g=a(65938),F=a(44497),k=a(42329),J=a(60977),b=a(17805);function j(i,l){1&i&&e._UZ(0,"dxi-column",9),2&i&&e.Q6J("caption","Actions")("dataField","id")("allowSorting",!1)("allowFiltering",!1)("allowReordering",!1)("dataType","string")("alignment","center")("cssClass","dx-command-edit dx-command-edit-with-icons")("cellTemplate","idCellTemplate")}function L(i,l){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"a",10),e.NdJ("click",function(){const n=e.CHM(t).$implicit,s=e.oxw();return e.KtG(s.editRole(n.data.name))}),e._uU(2,"\xa0"),e.qZA(),e.TgZ(3,"a",11),e.NdJ("click",function(){const n=e.CHM(t).$implicit,s=e.oxw();return e.KtG(s.deleteRole(n.data.name))}),e._uU(4,"\xa0"),e.qZA()()}}function W(i,l){if(1&i){const t=e.EpF();e.TgZ(0,"button",12),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.createCustomRole())}),e.TgZ(1,"mat-icon"),e._uU(2,"add"),e.qZA()()}}let q=(()=>{class i{constructor(t,o,r,n,s){this.rolesService=t,this.router=o,this.dialog=r,this.alertService=n,this.permissions=s}ngOnInit(){this.rolesService.guardRolesGet().toPromise().then(t=>this.rolesArray=t.data).catch(t=>this.alertService.openDanger(t.error.errors[0].message))}editRole(t){this.router.navigate(["/admin/permissions/roles/edit",t])}deleteRole(t){this.rolesService.guardRolesNameUsersGet(t).toPromise().then(o=>{o.users.length?this.abortDeleteRole():this.continueDeleteRole(t)}).catch(o=>this.alertService.openDanger(o.errors[0].message))}continueDeleteRole(t){this.dialog.open(R.$,{data:{title:"alerts.confirm_delete_role",message:"alerts.are_you_sure_you_want_delete_role"}}).afterClosed().toPromise().then(r=>
1{r&&this.rolesService.guardRolesNameDelete(t).toPromise().then(()=>{this.rolesArray=this.rolesArray.filter(n=>n.name!==t),this.alertService.openSuccess("permissions.role_has_deleted")})}).catch(r=>this.alertService.openDanger(r.errors[0].message))}abortDeleteRole(){this.dialog.open(B.h,{data:{content:"alerts.role_cannot_be_deleted_it_has_assigned_users"}})}createCustomRole(){this.router.navigate(["/admin/permissions/roles/add"])}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(M.f),e.Y36(p.F0),e.Y36(g.uw),e.Y36(F.f),e.Y36(k.q))},i.\u0275cmp=e.Xpm({type:i,selectors:[["app-roles"]],viewQuery:function(t,o){if(1&t&&e.Gf(Z.e,7),2&t){let r;e.iGM(r=e.CRH())&&(o.dataGrid=r.first)}},decls:10,vars:24,consts:[[1,"global-grid",3,"dataSource","allowColumnReordering","remoteOperations","hoverStateEnabled","allowColumnResizing"],[3,"enabled"],[3,"visible"],[3,"pageSize"],[3,"showPageSizeSelector","showInfo","visible"],[3,"caption","dataField","allowSorting","allowFiltering","dataType"],["width","150px",3,"caption","dataField","allowSorting","allowFiltering","allowReordering","dataType","alignment","cssClass","cellTemplate",4,"ngIf"],[4,"dxTemplate","dxTemplateOf"],["class","test__add","mat-fab","","color","primary",3,"click",4,"ngIf"],["width","150px",3,"caption","dataField","allowSorting","allowFiltering","allowReordering","dataType","alignment","cssClass","cellTemplate"],["tooltip","Edit","href","javascript:void(0)",1,"dx-link","dx-link-edit","dx-icon-edit","test__edit","dx-action-icon",3,"click"],["tooltip","Delete","href","javascript:void(0)",1,"dx-link","dx-link-edit","dx-icon-trash","test__edit","dx-action-icon",3,"click"],["mat-fab","","color","primary",1,"test__add",3,"click"]],template:function(t,o){1&t&&(e.TgZ(0,"dx-data-grid",0),e._UZ(1,"dxo-load-panel",1)(2,"dxo-filter-row",2)(3,"dxo-paging",3)(4,"dxo-pager",4)(5,"dxi-column",5)(6,"dxi-column",5),e.YNc(7,j,1,9,"dxi-column",6),e.YNc(8,L,5,0,"div",7),e.qZA(),e.YNc(9,W,3,0,"button",8)),2&t&&(e.Q6J("dataSource",o.rolesArray)("allowColumnReordering",!0)("remoteOperations",!0)("hoverStateEnabled",!0)("allowColumnResizing",!0),e.xp6(1),e.Q6J("enabled",!1),e.xp6(1),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize","10"),e.xp6(1),e.Q6J("showPageSizeSelector",!0)("showInfo",!0)("visible",!0),e.xp6(1),e.Q6J("caption","Name")("dataField","name")("allowSorting",!0)("allowFiltering",!0)("dataType","string"),e.xp6(1),e.Q6J("caption","Description")("dataField","description")("allowSorting",!0)("allowFiltering",!0)("dataType","string"),e.xp6(1),e.Q6J("ngIf",o.permissions.canEditRoles()),e.xp6(1),e.Q6J("dxTemplateOf","idCellTemplate"),e.xp6(1),e.Q6J("ngIf",o.permissions.canEditRoles()))},dependencies:[c.O5,J.p6,Z.e,b.qvW,b.I62,b.mKI,b.ilc,b.sXh,P.lW,_.Hw],encapsulation:2}),i})();var D=a(2220),E=a(40704),Y=a(32737);const K=["editUserRoleForm"];function V(i,l){if(1&i){const t=e.EpF();e.TgZ(0,"mat-dialog-content")(1,"jf-form",4,5),e.NdJ("handleChange",function(r){e.CHM(t);const n=e.oxw();return e.KtG(n.onFormChange(r))}),e.qZA()()}if(2&i){const t=e.oxw();e.xp6(1),e.Q6J("data",t.formData)("schema",t.editUserRoleSchema)}}let X=(()=>{class i{constructor(t,o,r,n,s){this.dialogRef=t,this.data=o,this.rolesService=r,this.usersService=n,this.alertService=s,this.editUserRoleSchema={title:"edit user roles",type:"object",properties:{roles:{enum:[],enumNames:[]}},required:["roles"]},this.loading=!0}ngOnInit(){this.userId=this.data.id,this.formData={roles:this.data.role},this.rolesService.guardRolesGet().toPromise().then(t=>{const r=t.data.map(n=>n.name);this.editUserRoleSchema.properties.roles.enum=r,this.editUserRoleSchema.properties.roles.enumNames=r,this.loading=!1}).catch(t=>console.warn(t))}onFormChange(t){this.formData=t.data}editUserRole(){}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(g.so),e.Y36(g.WI),e.Y36(M.f),e.Y36(D.f),e.Y36(E.c))},i.\u0275cmp=e.Xpm({type:i,selectors:[["app-edit-user-role"]],viewQuery:function(t,o){if(1&t&&e.Gf(K,7),2&t){let r;e.iGM(r=e.CRH())&&(o.editUserRoleForm=r.first)}},decls:11,vars:10,consts:[["mat-dialog-title",""],[4,"ngIf"],["color","primary","mat-raised-button","",1,"test__save",3,"click"],["color","secondary","mat-raised-button","","mat-dialog-close","",1,"test__close"],[3,"data","schema","handleChange"],["editUserRoleForm",""]],template:function(t,o){1&t&&(e.TgZ(0,"h2",0),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.YNc(3,V,3,2,"mat-dialog-content",1),e.TgZ(4,"mat-dialog-actions")(5,"button",2),e.NdJ("click",function(){return o.editUserRole()}),e._uU(6),e.ALo(7,"translate"),e.qZA(),e.TgZ(8,"button",3),e._uU(9),e.ALo(10,"translate"),e.qZA()()),2&t&&(e.xp6(1),e.Oqu(e.l
1cZ(2,4,"permissions.edit_user_role")),e.xp6(2),e.Q6J("ngIf",!o.loading),e.xp6(3),e.Oqu(e.lcZ(7,6,"permissions.save")),e.xp6(3),e.Oqu(e.lcZ(10,8,"permissions.cancel")))},dependencies:[c.O5,g.ZT,g.uh,g.xY,g.H8,P.lW,Y.u4,A.X$]}),i})();var Q=a(49096),ee=a(12537);const te=["addAdminUserForm"];let oe=(()=>{class i{constructor(t,o,r,n,s,d){this.dialogRef=t,this.rolesService=o,this.usersService=r,this.resetPasswordService=n,this.alertService=s,this.registerService=d,this.schema={title:"Add admin user",type:"object",properties:{name:{type:"string"},email:{type:"string",format:"email"},role:{enum:[],enumNames:[]}},required:["name","email","role"]}}ngOnInit(){this.rolesService.guardRolesGet().toPromise().then(t=>{const r=t.data.map(n=>n.name);this.schema.properties.role.enum=r,this.schema.properties.role.enumNames=r}).catch(t=>this.alertService.showSnackbar(`${t?.error?.errors&&t?.error?.errors[0]?.message||"general.error"}`))}onFormChange(t){this.userData=t.data}onSubmitForm(){this.addAdminUserForm.isValid()}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(g.so),e.Y36(M.f),e.Y36(D.f),e.Y36(Q.B),e.Y36(E.c),e.Y36(ee.a))},i.\u0275cmp=e.Xpm({type:i,selectors:[["app-add-broker-user"]],viewQuery:function(t,o){if(1&t&&e.Gf(te,7),2&t){let r;e.iGM(r=e.CRH())&&(o.addAdminUserForm=r.first)}},decls:12,vars:7,consts:[["mat-dialog-title",""],[3,"schema","handleChange"],["addAdminUserForm",""],["color","primary","mat-raised-button","",1,"test__save",3,"click"],["color","secondary","mat-raised-button","","mat-dialog-close","",1,"test__close"]],template:function(t,o){1&t&&(e.TgZ(0,"h2",0),e._uU(1,"Add Admin User"),e.qZA(),e.TgZ(2,"mat-dialog-content")(3,"jf-form",1,2),e.NdJ("handleChange",function(n){return o.onFormChange(n)}),e.qZA()(),e.TgZ(5,"mat-dialog-actions")(6,"button",3),e.NdJ("click",function(){return o.onSubmitForm()}),e._uU(7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"button",4),e._uU(10),e.ALo(11,"translate"),e.qZA()()),2&t&&(e.xp6(3),e.Q6J("schema",o.schema),e.xp6(4),e.Oqu(e.lcZ(8,3,"general.submit")),e.xp6(3),e.Oqu(e.lcZ(11,5,"general.cancel")))},dependencies:[g.ZT,g.uh,g.xY,g.H8,P.lW,Y.u4,A.X$]}),i})();var U=a(17489),re=a(401),H=a(10266);function ie(i,l){1&i&&e._UZ(0,"dxi-column",9),2&i&&e.Q6J("caption","Actions")("dataField","id")("allowSorting",!1)("allowFiltering",!1)("allowReordering",!1)("dataType","string")("alignment","center")("cssClass","dx-command-edit dx-command-edit-with-icons")("cellTemplate","idCellTemplate")}function ne(i,l){if(1&i){const t=e.EpF();e.TgZ(0,"a",14),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().$implicit,n=e.oxw();return e.KtG(n.resetBrokerMFA(r.data.email,r.data.firstName))}),e._UZ(1,"mat-icon",15),e.qZA()}}function se(i,l){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"a",10),e.NdJ("click",function(){const n=e.CHM(t).$implicit,s=e.oxw();return e.KtG(s.editUserRole(n.data.attributes.tm_userId[0],n.data.role))}),e.qZA(),e._uU(2,"\xa0 "),e.TgZ(3,"a",11),e.NdJ("click",function(){const n=e.CHM(t).$implicit,s=e.oxw();return e.KtG(s.changePassword(n.data.email))}),e.qZA(),e._uU(4,"\xa0 "),e.YNc(5,ne,2,0,"a",12),e._uU(6,"\xa0 "),e.TgZ(7,"mat-slide-toggle",13),e.NdJ("change",function(r){const s=e.CHM(t).$implicit,d=e.oxw();return e.KtG(d.onStatusToggle(s.data.attributes.tm_userId[0],s.data.enabled,r))}),e.qZA()()}if(2&i){const t=l.$implicit;e.xp6(5),e.Q6J("ngIf",(null==t||null==t.data||null==t.data.attributes||null==t.data.attributes.mobile_number?null:t.data.attributes.mobile_number.length)||(null==t||null==t.data||null==t.data.attributes||null==t.data.attributes.mobile_number_verified?null:t.data.attributes.mobile_number_verified.length)),e.xp6(2),e.Q6J("checked",t.data.enabled)}}function ae(i,l){if(1&i){const t=e.EpF();e.TgZ(0,"button",16),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.addBrokerUser())}),e.TgZ(1,"mat-icon"),e._uU(2,"add"),e.qZA()()}}let le=(()=>{class i{constructor(t,o,r,n,s,d,m,h,x){this.usersService=t,this.router=o,this.route=r,this.dialog=n,this.alertService=s,this.resetPasswordService=d,this.permissions=m,this.rolesService=h,this.resetMFA=x}ngOnInit(){this.getUsers()}getUsers(){return this.rolesService.guardRolesWithUsersGet().toPromise().then(t=>{const o=t.data;let r=[];for(const n of o)r=[...r,...n.users.map(s=>({...s,role:n.role}))];this.users=(0,U.sortBy)(r,"id"),this.route.queryParams.subscribe(n=>{n&&n.system_user_email&&this.resetBrokerMFA(n.system_user_email,this.users.find(s=>s.email===n.system_user_email).username)})}).catch(t=>this.alertService.openDanger(t.error.errors[0].message))}editUserRole(t,o){this.dialog.open(X,{width:"40%",data:{id:t,role:o}}).afterClosed().toPromise().then(n=>
1{n&&this.getUsers().then(()=>{this.dataGrid.instance.refresh()})})}addBrokerUser(){this.dialog.open(oe,{width:"60%"}).afterClosed().toPromise().then(o=>{o&&this.getUsers().then(()=>{this.dataGrid.instance.refresh()})})}disableUser(t,o){this.dialog.open(R.$,{data:{title:"alerts.confirm_deactivate_user",message:"alerts.are_you_sure_you_want_deactivate_user?"}}).afterClosed().toPromise().then(n=>{n?this.usersService.usersIdPut(t,{status:0}).toPromise().then(()=>{this.alertService.openSuccess("notifications.user_deactivated"),this.getUsers().then(()=>{this.dataGrid.instance.refresh()})}).catch(s=>{this.alertService.openDanger(`${s?.error?.errors?.length?s?.error?.errors[0]?.message:"An error occured"}`),o.source.checked=!o.source.checked}):o.source.checked=!o.source.checked})}enableUser(t,o){this.dialog.open(R.$,{data:{title:"alerts.confirm_reactivate_user",message:"alerts.are_you_sure_you_want_reactivate_user?"}}).afterClosed().toPromise().then(n=>{n?this.usersService.usersIdPut(t,{status:1}).toPromise().then(()=>{this.alertService.openSuccess("notifications.user_reactivated"),this.getUsers().then(()=>{this.dataGrid.instance.refresh()})}).catch(s=>{this.alertService.openDanger(s.errors[0].message),o.source.checked=!o.source.checked}):o.source.checked=!o.source.checked})}resetBrokerMFA(t,o){this.dialog.open(R.$,{data:{type:"verify_password",title:"Reset MFA Mobile Number",message:"When you reset the number the user will set new number next time he log in",email:t,userName:o}}).afterClosed().toPromise().then(n=>{"verified"===n&&this.resetMFA.resetMFAResetByBrokerPost({email:t}).toPromise().then(s=>{this.alertService.openSuccess("MFA reset successfully"),this.reloadPage()}).catch(s=>{this.alertService.openDanger(s?.errors?.length?s?.errors[0]?.message:"An error occured")})})}reloadPage(){const t=this.router.url.split("?"),o=t[1]&&JSON.parse('{"'+decodeURI(t[1]).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}');this.router.routeReuseStrategy.shouldReuseRoute=()=>!1,this.router.onSameUrlNavigation="reload",this.router.urlUpdateStrategy="eager",this.router.navigate([t[0]],{queryParams:o,queryParamsHandling:"merge"})}changePassword(t){this.dialog.open(R.$,{data:{title:"alerts.confirm_reset_password",message:"alerts.are_you_sure_you_want_reset_password",email:t}}).afterClosed().toPromise().then(r=>{r&&this.resetPasswordService.resetPasswordPost({email:t}).toPromise().then(()=>{this.alertService.openSuccess("alerts.email_sent_to_reset_password")}).catch(n=>{this.alertService.openDanger(`${n?.error?.errors?.length?n?.error?.errors[0]?.message:"An error occured"}`)})})}onStatusToggle(t,o,r){return o?this.disableUser(t,r):this.enableUser(t,r)}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(D.f),e.Y36(p.F0),e.Y36(p.gz),e.Y36(g.uw),e.Y36(F.f),e.Y36(Q.B),e.Y36(k.q),e.Y36(M.f),e.Y36(re.n))},i.\u0275cmp=e.Xpm({type:i,selectors:[["app-permissions-users"]],viewQuery:function(t,o){if(1&t&&e.Gf(Z.e,7),2&t){let r;e.iGM(r=e.CRH())&&(o.dataGrid=r.first)}},decls:11,vars:29,consts:[[1,"global-grid",3,"dataSource","allowColumnReordering","remoteOperations","hoverStateEnabled","allowColumnResizing"],[3,"enabled"],[3,"visible"],[3,"pageSize"],[3,"showPageSizeSelector","showInfo","visible"],[3,"caption","dataField","allowSorting","allowFiltering","dataType"],["width","180px",3,"caption","dataField","allowSorting","allowFiltering","allowReordering","dataType","alignment","cssClass","cellTemplate",4,"ngIf"],[4,"dxTemplate","dxTemplateOf"],["class","test__add","mat-fab","","color","primary",3,"click",4,"ngIf"],["width","180px",3,"caption","dataField","allowSorting","allowFiltering","allowReordering","dataType","alignment","cssClass","cellTemplate"],["matTooltip","Edit user role","href","javascript:void(0)",1,"dx-link","dx-link-edit","dx-icon-edit","test__edit","dx-action-icon",2,"font-size","22px",3,"click"],["matTooltip","Change password","href","javascript:void(0)",1,"dx-link","dx-link-key","dx-icon-key","test__change-password","dx-action-icon",2,"font-size","22px",3,"click"],["matTooltip","Re
1set MFA","style","font-size: 22px;height: 22px !important;","class","dx-link dx-action-icon","href","javascript:void(0)",3,"click",4,"ngIf"],["matTooltip","Status","color","primary",1,"dx-action-icon",3,"checked","change"],["matTooltip","Reset MFA","href","javascript:void(0)",1,"dx-link","dx-action-icon",2,"font-size","22px","height","22px !important",3,"click"],["svgIcon","resetmfa",2,"height","22px!important"],["mat-fab","","color","primary",1,"test__add",3,"click"]],template:function(t,o){1&t&&(e.TgZ(0,"dx-data-grid",0),e._UZ(1,"dxo-load-panel",1)(2,"dxo-filter-row",2)(3,"dxo-paging",3)(4,"dxo-pager",4)(5,"dxi-column",5)(6,"dxi-column",5)(7,"dxi-column",5),e.YNc(8,ie,1,9,"dxi-column",6),e.YNc(9,se,8,2,"div",7),e.qZA(),e.YNc(10,ae,3,0,"button",8)),2&t&&(e.Q6J("dataSource",o.users)("allowColumnReordering",!0)("remoteOperations",!0)("hoverStateEnabled",!0)("allowColumnResizing",!0),e.xp6(1),e.Q6J("enabled",!1),e.xp6(1),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize",10),e.xp6(1),e.Q6J("showPageSizeSelector",!0)("showInfo",!0)("visible",!0),e.xp6(1),e.Q6J("caption","Name")("dataField","firstName")("allowSorting",!0)("allowFiltering",!0)("dataType","string"),e.xp6(1),e.Q6J("caption","Email")("dataField","email")("allowSorting",!0)("allowFiltering",!0)("dataType","string"),e.xp6(1),e.Q6J("caption","Role")("dataField","role")("allowSorting",!0)("allowFiltering",!0)("dataType","string"),e.xp6(1),e.Q6J("ngIf",o.permissions.canEditUsers()),e.xp6(1),e.Q6J("dxTemplateOf","idCellTemplate"),e.xp6(1),e.Q6J("ngIf",o.permissions.canEditUsers()&&o.permissions.canViewRoles()))},dependencies:[c.O5,J.p6,Z.e,b.qvW,b.I62,b.mKI,b.ilc,b.sXh,P.lW,_.Hw,H.gM,f.Rr],encapsulation:2}),i})();var v=a(24006),w=a(80529),ce=a(85784),de=a(45763),G=a(49741);let me=(()=>{class i{constructor(t,o,r){this.httpClient=t,this.basePath="http://localhost:8000",this.defaultHeaders=new w.WM,this.configuration=new G.V,r&&(this.configuration=r),"string"!=typeof this.configuration.basePath&&(Array.isArray(o)&&o.length>0&&(o=o[0]),"string"!=typeof o&&(o=this.basePath),this.configuration.basePath=o),this.encoder=this.configuration.encoder||new ce.H}addToHttpParams(t,o,r){return"object"!=typeof o||o instanceof Date?this.addToHttpParamsRecursive(t,o,r):this.addToHttpParamsRecursive(t,o)}addToHttpParamsRecursive(t,o,r){if(null==o)return t;if("object"==typeof o)if(Array.isArray(o))o.forEach(n=>t=this.addToHttpParamsRecursive(t,n,r));else if(o instanceof Date){if(null==r)throw Error("key may not be null if value is Date");t=t.append(r,o.toISOString().substr(0,10))}else Object.keys(o).forEach(n=>t=this.addToHttpParamsRecursive(t,o[n],null!=r?`${r}.${n}`:n));else{if(null==r)throw Error("key may not be null if value is not object or array");t=t.append(r,o)}return t}guardPoliciesGet(t,o="body",r=!1,n){let s=new w.LE({encoder:this.encoder});null!=t&&(s=this.addToHttpParams(s,t,"role"));let d=this.defaultHeaders,m=n&&n.httpHeaderAccept;void 0===m&&(m=this.configuration.selectHeaderAccept(["application/json"])),void 0!==m&&(d=d.set("Accept",m));let h=n&&n.context;void 0===h&&(h=new w.qT);let x="json";return m&&(x=m.startsWith("text")?"text":this.configuration.isJsonMime(m)?"json":"blob"),this.httpClient.request("get",`${this.configuration.basePath}/guard/policies`,{context:h,params:s,responseType:x,withCredentials:this.configuration.withCredentials,headers:d,observe:o,reportProgress:r})}guardPoliciesPut(t,o="body",r=!1,n){if(null==t)throw new Error("Required parameter guardPolicesRequest was null or undefined when calling guardPoliciesPut.");let s=this.defaultHeaders,d=n&&n.httpHeaderAccept;void 0===d&&(d=this.configuration.selectHeaderAccept(["application/json"])),void 0!==d&&(s=s.set("Accept",d));let m=n&&n.context;void 0===m&&(m=new w.qT);const x=this.configuration.selectHeaderContentType(["application/json"]);void 0!==x&&(s=s.set("Content-Type",x));let u="json";return d&&(u=d.startsWith("text")?"text":this.configuration.isJsonMime(d)?"json":"blob"),this.httpClient.request("put",`${this.configuration.basePath}/guard/policies`,{context:m,body:t,responseType:u,withCredentials:this.configuration.withCredentials,headers:s,observe:o,reportProgress:r})}}return i.\u0275fac=function(t){return new(t||i)(e.LFG(w.eN),e.LFG(de.G,8),e.LFG(G.V,8))},i.\u0275prov=e.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();var pe=a(45510),$=a(56709);
1function ue(i,l){1&i&&(e.TgZ(0,"div")(1,"h5"),e._uU(2,"Loading ..."),e.qZA()())}function fe(i,l){1&i&&(e.TgZ(0,"span",16),e._uU(1,"This field is required"),e.qZA())}function ge(i,l){1&i&&(e.TgZ(0,"span",16),e._uU(1,"This field is required"),e.qZA())}function he(i,l){if(1&i&&(e.TgZ(0,"div",21)(1,"mat-checkbox",22),e._uU(2),e.qZA()()),2&i){const t=l.$implicit,o=l.index,r=e.oxw().$implicit,n=e.oxw(2);e.xp6(1),e.Q6J("checked",!1)("formControl",t),e.xp6(1),e.hij("",n.getPermission(r,o)," ")}}function _e(i,l){1&i&&e._UZ(0,"hr")}function ve(i,l){if(1&i&&(e.TgZ(0,"div")(1,"h5",17),e._uU(2),e.qZA(),e.TgZ(3,"div",18),e.YNc(4,he,3,3,"div",19),e.qZA(),e.YNc(5,_e,1,0,"hr",20),e.qZA()),2&i){const t=l.$implicit,o=l.last,r=e.oxw(2);e.xp6(2),e.Oqu(r.capitalize(t)),e.xp6(2),e.Q6J("ngForOf",r.addUpdateRoleForm.controls.policies.controls[t].controls),e.xp6(1),e.Q6J("ngIf",!o)}}function xe(i,l){if(1&i){const t=e.EpF();e.TgZ(0,"form",3),e.NdJ("ngSubmit",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.submitForm())}),e.TgZ(1,"div",4)(2,"div",5)(3,"label",6),e._uU(4,"Name"),e.qZA(),e._UZ(5,"input",7),e.YNc(6,fe,2,0,"span",8),e.qZA(),e.TgZ(7,"div",5)(8,"label",9),e._uU(9,"Description"),e.qZA(),e._UZ(10,"textarea",10),e.YNc(11,ge,2,0,"span",8),e.qZA(),e.TgZ(12,"div",11),e.YNc(13,ve,6,3,"div",12),e.qZA()(),e.TgZ(14,"div",13)(15,"button",14),e._uU(16),e.ALo(17,"translate"),e.qZA(),e.TgZ(18,"button",15),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.handleCancel())}),e._uU(19),e.ALo(20,"translate"),e.qZA()()()}if(2&i){const t=e.oxw();e.Q6J("formGroup",t.addUpdateRoleForm),e.xp6(6),e.Q6J("ngIf",t.addUpdateRoleForm.get("role").invalid&&t.addUpdateRoleForm.get("role").dirty),e.xp6(5),e.Q6J("ngIf",t.addUpdateRoleForm.get("description").invalid&&t.addUpdateRoleForm.get("description").dirty),e.xp6(2),e.Q6J("ngForOf",t.permissionsTitlesArr),e.xp6(2),e.Q6J("disabled",t.addUpdateRoleForm.invalid),e.xp6(1),e.Oqu(e.lcZ(17,7,"permissions.save")),e.xp6(3),e.Oqu(e.lcZ(20,9,"permissions.cancel"))}}let z=(()=>{class i{constructor(t,o,r,n,s,d,m,h){this.rolesService=t,this.formBuilder=o,this.permissionsService=r,this.alertService=n,this.authGuardService=s,this.activatedRoute=d,this.gaurdPoliciesService=m,this.router=h,this.isFormReady=!1}ngOnInit(){this.permissions=this.permissionsService.permissions,this.permissionsMaps=this.permissionsService.permissionMaps,this.permissionsTitlesArr=Object.keys(this.permissionsMaps),this.activatedRoute.snapshot.params.name?(this.roleName=this.activatedRoute.snapshot.params.name,this.gaurdPoliciesService.guardPoliciesGet(this.roleName).toPromise().then(t=>{this.roleData=t.data,this.intializeForm(this.roleData)}).catch(t=>this.alertService.openDanger(t.error.errors[0].message))):this.intializeForm()}intializeForm(t){let o,r;t&&(o=this.isReadonly(this.roleData),r=this.roleData.policies.map(n=>n.id)),this.addUpdateRoleForm=this.formBuilder.group({role:[{value:t?t.name:"",disabled:!!this.roleName},v.kI.required],description:[t?t.description:"",v.kI.required],policies:this.formBuilder.group(this.permissionsTitlesArr.reduce((n,s)=>(n[`${s}`]=this.formBuilder.array(Object.keys(this.permissionsMaps[`${s}`]).map(d=>!!t&&this.hasPermissionPolicy(this.permissionsMaps[`${s}`][`${d}`].id,r))),n),{}))}),this.isFormReady=!0}submitForm(){if(this.addUpdateRoleForm.valid){let t=[];const o={...this.addUpdateRoleForm.value};if(Object.keys(o.policies).map(s=>{o.policies[`${s}`].map((d,m)=>{if(d){const h=U.keys(this.permissionsMaps[`${s}`])[`${m}`];t=[...t].concat({id:this.permissionsMaps[`${s}`][`${h}`].id,action:"add"})}})}),o.policies=t,this.roleData){const s=o.policies.map(u=>u.id),d=this.roleData.policies.map(u=>u.id),m=U.difference(d,s),h=U.difference(s,d),x=[].concat(m.map(u=>({id:u,action:"remove"}))).concat(h.map(u=>({id:u,action:"add"})));o.policies=[...x]}else o.role=o.role.replace(/ /g,"-");const r={name:o.role||this.roleName,description:o.description},n=[...o.policies];this.addOrUpdateRole(r).then(()=>{U.isEmpty(n)?this.alertService.navigateAndShowSnackbar(this.roleName?"permissions.role_has_updated":"permissions.role_added_successfully","/admin/permissions/roles"):this.updateRolePolicies(r.name,n).then(()=>this.alertService.navigateAndShowSnackbar(this.roleName?"permissions.role_has_updated":"permissions.role_added_successfully","/admin/permissions/roles")).catch(s=>this.alertService.openDanger(s.error.errors[0].message))}).catch(s=>this.alertService.openDanger(s.error.errors[0].message))}}
1addOrUpdateRole(t){return this.roleName?this.rolesService.guardRolesNamePut(this.roleName,t).toPromise():this.rolesService.guardRolesPost(t).toPromise()}updateRolePolicies(t,o){return this.gaurdPoliciesService.guardPoliciesPut({role:t,policies:o}).toPromise()}getPermission(t,o){return this.capitalize(this.permissionsMaps[`${t}`][`${o}`].name.replace(/^.*-/,"").replace(/ policy/,""))}capitalize(t){return U.startCase(t)}isReadonly(t){return!this.permissionsService.isServiceUser()&&t.name&&["producers","manager","csr","communications","brokers admin"].includes(t.name.toLowerCase())}hasPermissionPolicy(t,o){return o.includes(t)}handleCancel(){this.router.navigate(["/admin/permissions/roles"])}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(M.f),e.Y36(v.QS),e.Y36(k.q),e.Y36(F.f),e.Y36(pe.P),e.Y36(p.gz),e.Y36(me),e.Y36(p.F0))},i.\u0275cmp=e.Xpm({type:i,selectors:[["app-update-role"]],decls:4,vars:2,consts:[[1,"add-update-role-form-container"],["loading",""],["class","tru-form",3,"formGroup","ngSubmit",4,"ngIf","ngIfElse"],[1,"tru-form",3,"formGroup","ngSubmit"],[1,"form-controls"],[1,"tru-form-control"],["for","role",1,"tru-form-control__label"],["id","role","formControlName","role",1,"tru-form-control__field"],["class","tru-form-control__error",4,"ngIf"],["for","description",1,"tru-form-control__label"],["id","description","formControlName","description",1,"tru-form-control__field"],[1,"permissions-names-title-container"],[4,"ngFor","ngForOf"],[1,"actions"],["color","primary","mat-raised-button","","type","submit",1,"test__save",3,"disabled"],["color","secondary","mat-raised-button","",1,"test__close",3,"click"],[1,"tru-form-control__error"],[1,"headline"],[1,"permissions-names"],["class","permission",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"permission"],["color","primary",3,"checked","formControl"]],template:function(t,o){if(1&t&&(e.TgZ(0,"div",0),e.YNc(1,ue,3,0,"ng-template",null,1,e.W1O),e.YNc(3,xe,21,11,"form",2),e.qZA()),2&t){const r=e.MAs(2);e.xp6(3),e.Q6J("ngIf",o.isFormReady)("ngIfElse",r)}},dependencies:[c.sg,c.O5,P.lW,$.oG,v._Y,v.Fj,v.JJ,v.JL,v.oH,v.sg,v.u,A.X$],styles:[".add-update-role-form-container[_ngcontent-%COMP%]{background:#fff;border-radius:8px;padding:20px 40px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%]{margin-bottom:15px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .tru-form-control[_ngcontent-%COMP%]{margin-bottom:12px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .tru-form-control[_ngcontent-%COMP%] label.tru-form-control__label[_ngcontent-%COMP%]{display:block;color:#8c8c8c;font-family:Source Sans Pro;font-size:14px;margin-bottom:6px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .tru-form-control[_ngcontent-%COMP%] .tru-form-control__field[_ngcontent-%COMP%]{box-sizing:border-box;height:32px;width:100%;padding:8px 10px;color:#8c8c8c;font-family:Source Sans Pro;font-size:14px;border:.55px solid rgba(208,208,208,.5);border-radius:6px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .tru-form-control[_ngcontent-%COMP%] .tru-form-control__field[_ngcontent-%COMP%]:focus{outline:none}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .tru-form-control[_ngcontent-%COMP%] .tru-form-control__field.ng-dirty.ng-invalid[_ngcontent-%COMP%]{border-color:#db0000}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .tru-form-control[_ngcontent-%COMP%] textarea.tru-form-control__field[_ngcontent-%COMP%]{resize:none;height:100px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .tru-form-control[_ngcontent-%COMP%] .tru-form-control__error[_ngcontent-%COMP%]{color:#db0000;font-family:Source Sans Pro;font-size:14px;margin-top:6px;display:block}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .permissions-names-title-container[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:10px 0}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .permissions-names-title-container[_ngcontent-%COMP%] hr[_ngcontent-%COMP%]{height:1.1px;background:#8c8c8c;opacity:.13;margin:20px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .permissions-names-title-container[_ngcontent-%COMP%] .permissions-names[_ngcontent-%COMP%]{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row;padding-left:20px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .permissions-names-title-container[_ngcontent-%COMP%] .permissions-names[_ngcontent-%COMP%] .permission[_ngcontent-%COMP%]{-webkit-box-flex:0;-webkit-flex:0 0 33.3333%;flex:0 0 33.3333%}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .permissions-names-title-container[_ngcontent-%COMP%] .permissions-names[_ngcontent-%COMP%] .permission[_ngcontent-%COMP%] .mat-checkbox-label{color:#8c8c8c;font-family:Source Sans Pro;font-size:16px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .actions[_ngcontent-%COMP%]{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:end;
1-webkit-justify-content:flex-end;justify-content:flex-end;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row;margin-top:20px}.add-update-role-form-container[_ngcontent-%COMP%] form.tru-form[_ngcontent-%COMP%] .actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-left:15px}"]}),i})();var Ce=a(59549),Pe=a(44144);const be=[{path:"",component:C,children:[{path:"",redirectTo:"broker-users",pathMatch:"full"},{path:"broker-users",component:le,data:{title:"Permissions - Users"}},{path:"roles",component:q,data:{title:"Permissions - Roles"}},{path:"roles/add",component:z,data:{title:"Permissions - Roles - Add Role"}},{path:"roles/edit/:name",component:z,data:{title:"Permissions - Roles - Update Role"}}]}];let Ae=(()=>{class i{}return i.\u0275fac=function(t){return new(t||i)},i.\u0275mod=e.oAB({type:i}),i.\u0275inj=e.cJS({imports:[c.ez,p.Bz,p.Bz.forChild(be),S.p,A.aw,T.Nh,O.S,P.ot,_.Ps,H.AV,f.rP,$.p9,Ce.lN,v.u5,v.UX,Pe.c]}),i})()}}]);
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.