header-right.component.ts 1.51 KB
Newer Older
Alex ORLUC's avatar
Alex ORLUC committed
1
2
3
4
5
6
7
8
import { Component, OnInit }    from '@angular/core';
import { HttpClient }           from '@angular/common/http';
import { LANG }                 from '../translate.component';
import { HeaderService }        from '../../service/header.service';
import { MatDialog, MatDialogRef } from '@angular/material';
import { IndexingGroupModalComponent } from '../menu/menu-shortcut.component';
import { Router } from '@angular/router';

Alex ORLUC's avatar
Alex ORLUC committed
9
10
declare var angularGlobals: any;

Alex ORLUC's avatar
Alex ORLUC committed
11
12
13
14
15
16
17
18
19
20
21
22
23
@Component({
    selector: 'header-right',
    styleUrls: ['header-right.component.scss'],
    templateUrl : "header-right.component.html",
})
export class HeaderRightComponent implements OnInit {

    lang        : any       = LANG;
    mobileMode  : boolean   = false;

    dialogRef   : MatDialogRef<any>;
    config      : any       = {};

Alex ORLUC's avatar
Alex ORLUC committed
24
25
26
    constructor(public http: HttpClient, private router: Router, public headerService: HeaderService, public dialog: MatDialog) {
        this.mobileMode = angularGlobals.mobileMode;
     }
Alex ORLUC's avatar
Alex ORLUC committed
27

Alex ORLUC's avatar
Alex ORLUC committed
28
    ngOnInit(): void {}
Alex ORLUC's avatar
Alex ORLUC committed
29
30
31
32
33
34
35
36
37
38
39
40

    gotToMenu(shortcut:any) {
        if (shortcut.id == 'index_mlb' && this.headerService.user.indexingGroups.length > 1) {
            this.config = { data: { indexingGroups:this.headerService.user.indexingGroups, link:shortcut.servicepage } };
            this.dialogRef = this.dialog.open(IndexingGroupModalComponent, this.config);
        } else if (shortcut.angular == 'true') {
            this.router.navigate([shortcut.servicepage]);
        } else {
            location.href = shortcut.servicepage;
        }
    }
}