Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Component, OnInit, ChangeDetectorRef, ViewChild} from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { MediaMatcher } from '@angular/cdk/layout';
import { NotificationService } from './notification.service';
import { LANG } from './translate.component';
import { MatDialog, MatDialogRef, MatSidenav, MatExpansionPanel } from '@angular/material';
declare var angularGlobals: any;
declare function $j(selector: any): any;
@Component({
templateUrl: "../../../Views/activate-user.component.html",
providers: [NotificationService],
})
export class ActivateUserComponent implements OnInit {
private _mobileQueryListener: () => void;
coreUrl : string;
mobileQuery : MediaQueryList;
lang : any = LANG;
loading : boolean = false;
user : any = {
}
constructor( media: MediaMatcher, changeDetectorRef: ChangeDetectorRef, public http: HttpClient, private notify: NotificationService){
this.mobileQuery = media.matchMedia('(max-width: 768px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener);
}
ngOnInit() : void {
this.coreUrl = angularGlobals.coreUrl;
this.loading = true;
this.http.get('../../rest/currentUser/profile')
.subscribe((data: any) => {
this.user = data;
this.loading = false;
});
}
deleteAbsence() : void {
this.http.put('../../rest/users/'+this.user.id+'/status', {'id' : this.user.id, 'status' : 'OK'})
.subscribe(() => {
this.notify.success(this.lang.statusUpdated);
location.href = "index.php";
},
(err : any) => {
this.notify.error(err.error.errors);
});
}
redirect() {
location.href = "index.php";
}
logout() {
location.href = "index.php?display=true&page=logout&logout=true";
}
}