PageSourceSearch

https://congresoenfermeria.com/editorial/chunk-ADJKM7SB.js

js congresoenfermeria.com collected 2026-10-08 11:22:31 UTC 3,922 bytes, 1 lines download raw bytes

1import{a as G}from"./chunk-URA7OFDZ.js";import{a as O}from"./chunk-UY2YAVVH.js";import{a as P}from"./chunk-QR5KC65N.js";import{A,a as E,b as k,e as T,ja as F,s as N}from"./chunk-6KU5ZMGK.js";import"./chunk-E4V53SDG.js";import{d as w}from"./chunk-4VR26DP5.js";import{i as U}from"./chunk-6YEMMJB4.js";import"./chunk-V4HVBC63.js";import{Ja as s,Mb as d,Nb as C,S as c,Wb as I,X as b,Xa as h,Y as R,ac as M,bc as x,hb as p,hc as D,ia as a,ib as u,kb as _,lb as y,mb as g,nb as i,ob as r,pb as l,tb as S,xb as v,zb as f}from"./chunk-XIVMOII7.js";import"./chunk-2NFLSA4Y.js";var q=(o,e)=>e.id;function j(o,e){o&1&&(i(0,"div",5),l(1,"div",14),r())}function B(o,e){if(o&1){let n=S();i(0,"div",9)(1,"label",15)(2,"input",16),v("change",function(){let m=b(n).$implicit,$=f();return R($.toggleRole(m.id))}),r(),i(3,"div",17)(4,"div",18),l(5,"span",19),r(),i(6,"div",20)(7,"span",21),d(8),M(9,"translate"),r()()()()()}if(o&2){let n=e.$implicit,t=f();s(2),g("checked",t.isRoleSelected(n.id)),s(6),C(x(9,2,n.name))}}function L(o,e){o&1&&l(0,"span",12)}function z(o,e){o&1&&l(0,"i-tabler",13)}var V=class o{route=c(w);rolesService=c(G);userRolesService=c(O);userId=a(null);allRoles=a([]);userRoleIds=a(new Set);loading=a(!0);saving=a(!1);globalRoles=D(()=>this.allRoles().filter(e=>e.is_global&&e.name!=="Authenticated"&&e.name!=="Anonymous"));ngOnInit(){let e=this.route.parent?.snapshot.paramMap.get("userId");e&&(this.userId.set(e),this.loadData(e))}loadData(e){this.loading.set(!0),this.rolesService.rolesGetRolesEndpoint({limit:100}).subscribe(n=>{this.allRoles.set(n.data),this.userRolesService.userRolesGetUserRolesEndpoint({userId:e}).subscribe({next:t=>{this.userRoleIds.set(new Set(t.data.map(m=>m.id))),this.loading.set(!1)},error:()=>this.loading.set(!1)})})}isRoleSelected(e){return this.userRoleIds().has(e)}toggleRole(e){this.userRoleIds.update(n=>{let t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})}saveRoles(){let e=this.userId();e&&(this.saving.set(!0),this.userRolesService.userRolesSetUserRolesEndpoint({iSetUserRolesRequest:{user_id:e,role_ids:Array.from(this.userRoleIds())}}).subscribe({next:()=>{this.saving.set(!1)},error:n=>{this.saving.set(!1),alert(n.error?.detail||"No se pudieron guardar los roles.")}}))}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=h({type:o,selectors:[["app-user-roles-management"]],features:[I([k({IconShieldLock:F,IconDeviceFloppy:A,IconCheck:N,IconAlertCircle:T})])],decls:18,vars:3,consts:[[1,"row","row-cards"],[1,"col-12"],[1,"card"],[1,"card-header"],[1,"card-title"],[1,"progress","progress-sm","card-progress"],[1,"card-body"],[1,"text-secondary","mb-4"],[1,"row","g-3"],[1,"col-md-6","col-lg-4"],[1,"card-footer","text-end"],["type","button",1,"btn","btn-primary",3,"click","disabled"],["role","status",1,"spinner-border","spinner-border-sm","me-2"],["name","device-floppy",1,"icon","me-2"],[1,"progress-bar","progress-bar-indeterminate"],[1,"form-selectgroup-item","flex-fill"],["type","checkbox",1,"form-selectgroup-input",3,"change","checked"],[1,"form-selectgroup-label","d-flex","align-items-center","p-3"],[1,"me-3"],[1,"form-selectgroup-check"],[1,"form-selectgroup-label-content"],[1,"d-block","font-weight-medium"]],template:function(n,t){n&1&&(i(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"h3",4),d(5,"Asignaci\xF3n de roles globales"),r()(),p(6,j,2,0,"div",5),i(7,"div",6)(8,"p",7),d(9," Selecciona los roles que deseas asignar a este usuario. Estos roles se aplican a nivel global en toda la plataforma. "),r(),i(10,"div",8),_(11,B,10,4,"div",9,q),r()(),i(13,"div",10)(14,"button",11),v("click",function(){return t.saveRoles()}),p(15,L,1,0,"span",12)(16,z,1,0,"i-tabler",13),d(17," Guardar roles "),r()()()()()),n&2&&(s(6),u(t.loading()?6:-1),s(5),y(t.globalRoles()),s(3),g("disabled",t.saving()||t.loading()),s(),u(t.saving()?15:16))},dependencies:[U,E,P],encapsulation:2,changeDetection:0})};export{V as UserRolesManagementComponent};

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.