40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import {ChangeDetectionStrategy, Component, OnInit, ViewChild} from '@angular/core';
|
|
import {MatTableDataSource} from '@angular/material/table';
|
|
import {MatPaginator} from '@angular/material/paginator';
|
|
import {MatSort} from '@angular/material/sort';
|
|
import {AuthService} from '@app/_services';
|
|
import {Staff} from '@app/_models/staff';
|
|
|
|
@Component({
|
|
selector: 'app-settings',
|
|
templateUrl: './settings.component.html',
|
|
styleUrls: ['./settings.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class SettingsComponent implements OnInit {
|
|
date: string;
|
|
dataSource: MatTableDataSource<any>;
|
|
displayedColumns = ['name', 'email', 'userId'];
|
|
trustedUsers: Staff[];
|
|
|
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
|
@ViewChild(MatSort) sort: MatSort;
|
|
|
|
constructor(
|
|
private authService: AuthService
|
|
) { }
|
|
|
|
ngOnInit(): void {
|
|
const d = new Date();
|
|
this.date = `${d.getDate()}/${d.getMonth()}/${d.getFullYear()}`;
|
|
this.trustedUsers = this.authService.getTrustedUsers();
|
|
this.dataSource = new MatTableDataSource<any>(this.trustedUsers);
|
|
this.dataSource.paginator = this.paginator;
|
|
this.dataSource.sort = this.sort;
|
|
}
|
|
|
|
doFilter(value: string): void {
|
|
this.dataSource.filter = value.trim().toLocaleLowerCase();
|
|
}
|
|
}
|