import{a as p}from"./chunk-C72E7DYO.js";import{S as m,X as l,q as n}from"./chunk-56X5LYJH.js";var c=class r{constructor(s){this.api=s}loadPermissionsAsAccordion(s=!1){return this.api.Get("permission/showAll/facility").pipe(n(o=>(console.log("response for all accordion",o),o.data.map((i,t)=>({type:"accordion",controlName:"facilities",title:i.name,fields:[{type:"hidden",controlName:"id",title:"",value:i.id},{type:"accordion",controlName:"",title:"manualPermissions.fixedPermissions",fields:i.permissions?.length?[{type:"checkbox",controlName:"Permissions",title:"",formArrayName:"facilities",arrayIndex:t,class:"col",options:i.permissions.map(e=>({id:e.id,name:e.name})),validators:[]}]:[]},{type:"accordion",controlName:"",title:"manualPermissions.Manualpermissions",fields:i.roles?.length?i.roles.filter(e=>e.permissions?.length).map(e=>({type:"accordion",controlName:"",title:e.name,fieldId:e.id,actions:s?[{type:"update",routerLink:"/home/permissions/update/:id"},{type:"delete",endpoint:"role"}]:[],fields:[{type:"checkbox",controlName:`roles_${e.id}`,title:"",class:"col",formArrayName:"facilities",arrayIndex:t,options:e.permissions.map(a=>({id:a.id,name:a.name})),validators:[]}]})):[]}]})))))}static \u0275fac=function(o){return new(o||r)(l(p))};static \u0275prov=m({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c as a};
