| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { Router } from '@angular/router';
- import { ProfilesResponse, ProfileResponse } from './../../../interfaces/profiles.interface';
- import { UsersProfilesService } from './../../../services/users-profiles.service';
- import { Component, OnInit } from '@angular/core';
- @Component({
- selector: 'app-profiles-admin',
- templateUrl: './profiles-admin.component.html',
- styleUrls: ['./profiles-admin.component.css']
- })
- export class ProfilesAdminComponent implements OnInit {
- isLoading: boolean;
- hasError: boolean;
- errorStr: string;
- profiles: Array<ProfileResponse>;
- profilesFinded: Array<ProfileResponse>;
- searching: boolean;
- constructor(private usersProfilesService: UsersProfilesService, private router: Router) {
- this.isLoading = true;
- this.hasError = false;
- this.errorStr = "";
- this.profiles = [];
- this.profilesFinded = [];
- this.searching = false;
- }
- ngOnInit(): void {
- this.usersProfilesService.getProfiles().subscribe((data: ProfilesResponse) => {
- this.isLoading = false;
- this.hasError = data.error;
- this.errorStr = data.msg;
- if(!this.hasError){
- this.profiles = data.response;
- this.profilesFinded = this.profiles;
- }
- }, error => {
- this.isLoading = false;
- this.hasError = true;
- this.errorStr = error.error.msg;
- });
- }
- search(value: string){}
- clearSearch(){}
- openPermissions(profile: number, profileName: string, action: string){
- this.router.navigate(['permissions'], {
- queryParams: {
- profile: profile,
- profileName: profileName,
- action: action
- }
- });
- }
- }
|