PageSourceSearch

https://app.23degrees.io/roles-admin.routes-SRBFPXFZ.js

js 23degrees.io collected 2026-10-02 07:21:31 UTC 9,014 bytes, 4 lines download raw bytes

1import{a as X,b as Y}from"./chunk-VUMLVBOW.js";import{a as G}from"./chunk-Y3ATY43H.js";import{a as U}from"./chunk-W6X54PLF.js";import"./chunk-JSPFG5AB.js";import{b as J,j as K}from"./chunk-D54GPU5Y.js";import"./chunk-ZI2K5PH3.js";import"./chunk-5GTHTHUT.js";import"./chunk-35ETZAED.js";import{G as q,c as $,h as z,n as j}from"./chunk-OW6Z7FU2.js";import{b as W}from"./chunk-VR4LST6R.js";import{a as L}from"./chunk-R5FILQJL.js";import"./chunk-IXPQ4YSX.js";import"./chunk-EMTLGGWS.js";import"./chunk-X3OOVOFF.js";import"./chunk-AXIZ66QO.js";import"./chunk-ZRR533S2.js";import{h as H}from"./chunk-DCHDPVE2.js";import"./chunk-44NCBIU6.js";import"./chunk-5EURWJ5U.js";import"./chunk-ZNHBYH4P.js";import"./chunk-FT5JUZ6Y.js";import"./chunk-BYDGKSEJ.js";import"./chunk-FHHRU6AR.js";import"./chunk-E6DR7SCE.js";import"./chunk-ZO6NNOUN.js";import"./chunk-D72VTV4J.js";import"./chunk-XS6SHF3A.js";import"./chunk-W5PWV7UU.js";import"./chunk-KFFT3W7Z.js";import"./chunk-GNAZMTIA.js";import"./chunk-HRDOBA46.js";import"./chunk-DRTO2RYR.js";import"./chunk-Y52S3CXK.js";import{c as B,d as D,g as w,h as b,j as Q}from"./chunk-S5EK5JRJ.js";import"./chunk-2LL7AVK7.js";import"./chunk-DUGZJGFN.js";import"./chunk-QB4CW3DZ.js";import"./chunk-G4SGAC4J.js";import"./chunk-7DJH2DDJ.js";import"./chunk-KKZS3G5S.js";import"./chunk-4NYYINTD.js";import"./chunk-5GJ343PP.js";import"./chunk-CJLZHYZK.js";import{Ac as r,Da as u,Ea as _,Jc as h,Pa as R,Pc as d,Rb as M,Sc as c,Sd as I,Ua as y,Xb as P,_d as V,de as N,fd as a,hd as g,ld as A,md as F,nd as T,sc as S,tc as k,uc as E,va as v,vc as O,wc as x,xc as C,yb as m,yc as f,zc as o}from"./chunk-RL33O6RN.js";
1import"./chunk-FQIUDVNS.js";var ee=(s,p)=>p._id;function te(s,p){if(s&1){let e=h();o(0,"button",10),d("click",function(){let i=u(e).$implicit,n=c();return _(n.setRole(i))}),a(1),r()}if(s&2){let e=p.$implicit,t=c();f("color",t.currentRole===e?"primary":""),m(),g(" ",e.name," ")}}function ie(s,p){if(s&1){let e=h();o(0,"button",10),d("click",function(){let i=u(e).$implicit,n=c(2);return _(n.removePermissionFromRole(i,n.currentRole))}),a(1),r()}if(s&2){let e=p.$implicit;f("color","accent"),m(),g(" ",e.name," ")}}function ne(s,p){if(s&1){let e=h();o(0,"button",10),d("click",function(){let i=u(e).$implicit,n=c(2);return _(n.addPermissionToRole(i,n.currentRole))}),a(1),r()}if(s&2){let e=p.$implicit;f("color","warn"),m(),g(" ",e.name," ")}}function oe(s,p){if(s&1){let e=h();o(0,"div",2)(1,"h3",3),a(2,"Role Editor"),r(),o(3,"div"),a(4),r(),o(5,"div")(6,"mat-form-field",11)(7,"mat-label"),a(8,"Name"),r(),o(9,"input",12),T("ngModelChange",function(i){u(e);let n=c();return F(n.currentRole.name,i)||(n.currentRole.name=i),_(i)}),r()()(),o(10,"div")(11,"div",11)(12,"mat-form-field",13)(13,"mat-label"),a(14,"Description"),r(),o(15,"textarea",14),d("ngModelChange",function(i){u(e);let n=c();return _(n.currentRole.description=i)}),r()()()(),o(16,"div")(17,"h4"),a(18,"Permissions"),r(),o(19,"div",15)(20,"div"),a(21,"Already added Permissions"),r(),o(22,"div",16),x(23,ie,2,2,"button",8,E),r()(),o(25,"button",9),d("click",function(){u(e);let i=c();return _(i.exportToFeature(i.currentRole))}),a(26,"Export permissions to features"),r(),o(27,"div",17)(28,"div"),a(29,"Available Permissions"),r(),o(30,"div",16),x(31,ne,2,2,"button",8,ee),r()()(),o(33,"button",18),d("click",function(){u(e);let i=c();return _(i.save(i.currentRole))}),a(34,"Save"),r()()}if(s&2){let e=c();m(4),g("id: ",e.currentRole._id||"NEW ROLE"),m(5),f("placeholder","Role Name"),A("ngModel",e.currentRole.name),m(6),f("placeholder","Role Description")("ngModel",e.currentRole.description),m(8),C(e.currentRole.permissions),m(8),C(e.availablePermissionsForRole(e.currentRole))}}var Z=(()=>{class s extends L{constructor(){super(...arguments),this.permissionsService=v(G),this.notificationService=v(W),this.roles=N.required(),this.filterQuery=R(""),this.filteredRoles=I(()=>this.roles().filter(e=>(console.log("filteredRoles filterQuery",this.filterQuery()),this.filterQuery()?e.name.toLowerCase().includes(this.filterQuery().toLowerCase())||e.permissions.some(t=>t.name.toLowerCase().includes(this.filterQuery().toLowerCase())):!0))),this.permissions=V.required(),this.isLoading=!0,this.setupPage=async()=>{this.isLoading=!1,console.log("Authorized!",{roles:this.roles(),permissions:this.permissions()})},this.setRole=e=>{this.newItem=!1,this.currentRole=e},this.createRole=()=>{this.newItem=!0,this.currentRole={name:"",description:"",permissions:[]}},this.removePermissionFromRole=(e,t)=>{Y(e,t,"permissions")},this.exportToFeature=e=>{let t=e.permissions,i={};for(let l of this.permissions())i[l.name]={name:l.name,products:[],tier:0,description:"",label:l.name,permission:l.name};let n={};for(let l of t)switch(n[l.name]=i[l.name],e.name){case"free":n[l.name].products.push("free"),n[l.name].tier=0;break;case"pro":n[l.name].products.push("basic"),n[l.name].tier=1;break;case"ciBundle":case"printBundle":n[l.name].products.push("pro"),n[l.name].tier=2;break;default:n[l.name].tier=-1}console.log(n)},this.addPermissionToRole=(e,t)=>{X(e,t,"permissions")},this.availablePermissionsForRole=e=>this.permissions().filter(t=>!e.permissions.find(i=>t._id===i._id)),this.save=async e=>{e.hasOwnProperty("permissions")&&(e.permissions=e.permissions.map(t=>t._id)),console.log("[save]",{item:e});try{this.newItem?e=await this.permissionsService.createRolePromise(e):e=await this.permissionsService.updateRolePromise(e),this.currentRole=e,this.notificationService.success("Success","Saving roles worked fine")}catch(t){throw this.notificationService.error("No. Not working","Something went badly wrong... Maybe"),t}this.newItem?(this.roles.update(t=>[...t,e]),this.newItem=!1):this.roles.update(t=>{let i=t.findIndex(n=>e._id===n._id);return t[i]=e,[...t]}
1),console.log("[Save]","savedItem",e),e=void 0}}ngOnInit(){this.setupPage()}applyFilter(e){let t=e.target.value;console.log("filterValue",t),this.filterQuery.set(t.trim().toLowerCase())}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=y(s)))(i||s)}})()}static{this.\u0275cmp=M({type:s,selectors:[["roles-admin"]],inputs:{roles:[1,"roles"],permissions:[1,"permissions"]},outputs:{roles:"rolesChange"},features:[P],decls:16,vars:2,consts:[["input",""],[1,"px-4"],[1,"my-4"],[1,"text-4xl"],[1,"flex","justify-between","gap-2","px-4"],[1,"flex-1"],["matInput","",3,"keyup","placeholder"],[1,"my-2","flex","flex-wrap","gap-1"],["mat-raised-button","",1,"tt-mat-button-small",3,"color"],[3,"click"],["mat-raised-button","",1,"tt-mat-button-small",3,"click","color"],[1,"w-full"],["matInput","",3,"ngModelChange","placeholder","ngModel"],[1,"fuse-mat-textarea","w-full","flex-auto"],["matInput","","matTextareaAutosize","",3,"ngModelChange","placeholder","ngModel"],[2,"color","green","padding","1em"],[1,"flex","flex-wrap","gap-1"],[2,"color","red","padding","1em"],["color","warn","mat-raised-button","",3,"click"]],template:function(t,i){t&1&&(o(0,"div",1)(1,"div",2)(2,"h3",3),a(3,"Role Chooser"),r(),o(4,"div",4)(5,"mat-form-field",5)(6,"mat-label"),a(7,"Search"),r(),o(8,"input",6,0),d("keyup",function(l){return i.applyFilter(l)}),r()()(),o(10,"div",7),x(11,te,2,2,"button",8,O),o(13,"button",9),d("click",function(){return i.createRole()}),a(14,"+ Create"),r()()(),S(15,oe,35,5,"div",2),r()),t&2&&(m(8),f("placeholder","Filter users..."),m(3),C(i.filteredRoles()),m(4),k(i.currentRole?15:-1))},dependencies:[H,K,J,U,q,$,z,j],styles:[`.example-element-detail[_ngcontent-%COMP%]{overflow:hidden;display:flex}tr.example-detail-row[_ngcontent-%COMP%]{height:0}.example-element-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{border-bottom-width:0}.mat-mdc-table[_ngcontent-%COMP%]{max-height:calc(100dvh - 269px);min-height:calc(100dvh - 269px)}.mat-mdc-table[_ngcontent-%COMP%]   .mat-mdc-cell[_ngcontent-%COMP%]{vertical-align:middle}.mat-mdc-table[_ngcontent-%COMP%]   tr.mat-mdc-header-row[_ngcontent-%COMP%]{height:48px;position:sticky;top:0;z-index:10;background-color:var(--color-background-body)!important}.mat-mdc-table[_ngcontent-%COMP%]   tr.mat-mdc-header-row[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{vertical-align:middle}.mat-mdc-table[_ngcontent-%COMP%]   .mat-mdc-cell[_ngcontent-%COMP%]{background-color:transparent!important}.mat-mdc-table[_ngcontent-%COMP%]   .mat-column-name[_ngcontent-%COMP%]{width:40%}.mat-mdc-table[_ngcontent-%COMP%]   .mat-column-email[_ngcontent-%COMP%]{width:35%}.mat-mdc-table[_ngcontent-%COMP%]   .mat-column-created[_ngcontent-%COMP%]{width:20%}.mat-mdc-table[_ngcontent-%COMP%]   .mat-column-expand[_ngcontent-%COMP%]{width:5%}
2
3/*# sourceMappingURL=roles-admin.component-JWICERK5.css.map */`],data:{animation:[B("detailExpand",[b("collapsed",w({height:"0px",minHeight:"0",overflow:"hidden"})),b("expanded",w({height:"*"})),Q("expanded <=> collapsed",D("225ms cubic-bezier(0.4, 0.0, 0.2, 1)"))])]}})}}return s})();var re=[{path:"",component:Z,data:{icon:"heroicons_outline:credit-card",title:"Roles Control"}}],we=re;export{we as default};
4//# sourceMappingURL=roles-admin.routes-SRBFPXFZ.js.map

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.