Projekt

Obecné

Profil

Stáhnout (1.12 KB) Statistiky
| Větev: | Tag: | Revize:
1
import { Component, Input } from '@angular/core';
2
import { MatDialog } from '@angular/material';
3
import { ProfileSettingsComponent } from '../profile-settings/profile-settings.component';
4
import { ProfileService } from '../services/profile.service';
5
import { UserProfile } from '../models/user-profile.model';
6

    
7
@Component({
8
  selector: 'app-header',
9
  templateUrl: './header.component.html',
10
  styleUrls: ['./header.component.sass']
11
})
12
export class HeaderComponent {
13
  @Input() name = 'John Doe';
14

    
15
  private notificationSettings: Date;
16

    
17
  constructor(
18
    private dialog: MatDialog,
19
    private profileService: ProfileService
20
    ) {
21
    profileService.getProfile()
22
      .subscribe((data: UserProfile) => this.notificationSettings = new Date(data.settings.notification));
23
  }
24

    
25
  onProfileClick(): void {
26
    this.dialog.open(ProfileSettingsComponent, {
27
      data: {
28
        shouldNotify: this.notificationSettings, // TODO potřeba?
29
        notifyDate: this.notificationSettings,
30
        notifyTime: {
31
          hour: this.notificationSettings.getHours(),
32
          minute: this.notificationSettings.getMinutes()
33
        }
34
      }
35
    });
36
  }
37
}
(3-3/3)