2018-07-06 21:01:23 +02:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnInit,
|
|
|
|
} from '@angular/core';
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
|
|
|
import { ApiService } from 'jslib/abstractions/api.service';
|
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
|
|
|
|
|
|
|
import { OrganizationUserUserDetailsResponse } from 'jslib/models/response/organizationUserResponse';
|
|
|
|
|
2018-07-06 21:45:35 +02:00
|
|
|
import { OrganizationUserStatusType } from 'jslib/enums/organizationUserStatusType';
|
|
|
|
import { OrganizationUserType } from 'jslib/enums/organizationUserType';
|
|
|
|
|
2018-07-06 21:01:23 +02:00
|
|
|
import { Utils } from 'jslib/misc/utils';
|
2018-07-06 16:21:08 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-org-people',
|
|
|
|
templateUrl: 'people.component.html',
|
|
|
|
})
|
2018-07-06 21:01:23 +02:00
|
|
|
export class PeopleComponent implements OnInit {
|
|
|
|
loading = true;
|
|
|
|
organizationId: string;
|
|
|
|
users: OrganizationUserUserDetailsResponse[];
|
|
|
|
searchText: string;
|
2018-07-06 21:45:35 +02:00
|
|
|
organizationUserType = OrganizationUserType;
|
|
|
|
organizationUserStatusType = OrganizationUserStatusType;
|
2018-07-06 21:01:23 +02:00
|
|
|
|
|
|
|
constructor(private apiService: ApiService, private route: ActivatedRoute,
|
|
|
|
private i18nService: I18nService) { }
|
|
|
|
|
|
|
|
async ngOnInit() {
|
|
|
|
this.route.parent.parent.params.subscribe(async (params) => {
|
|
|
|
this.organizationId = params.organizationId;
|
2018-07-07 05:08:10 +02:00
|
|
|
await this.load();
|
2018-07-06 21:01:23 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async load() {
|
|
|
|
const response = await this.apiService.getOrganizationUsers(this.organizationId);
|
|
|
|
const users = response.data != null && response.data.length > 0 ? response.data : [];
|
|
|
|
users.sort(Utils.getSortFunction(this.i18nService, 'email'));
|
|
|
|
this.users = users;
|
|
|
|
this.loading = false;
|
|
|
|
}
|
|
|
|
}
|