Revize 696f3358
Přidáno uživatelem Václav Jirák před téměř 6 roky(ů)
webapp/src/app/header/header.component.ts | ||
---|---|---|
1 | 1 |
import { Component, Input } from '@angular/core'; |
2 | 2 |
import { MatDialog } from '@angular/material'; |
3 | 3 |
import { ProfileSettingsComponent } from '../profile-settings/profile-settings.component'; |
4 |
import { ProfileService } from '../services/api/profile.service'; |
|
5 | 4 |
import {LocalizationService} from '../localization/localization.service'; |
5 |
import {UserService} from '../services/api/user.service'; |
|
6 |
import {UserProfile} from '../models/user.model'; |
|
6 | 7 |
|
7 | 8 |
@Component({ |
8 | 9 |
selector: 'app-header', |
... | ... | |
10 | 11 |
styleUrls: ['./header.component.sass'] |
11 | 12 |
}) |
12 | 13 |
export class HeaderComponent { |
13 |
@Input() name = 'John Doe'; |
|
14 |
|
|
15 |
private notificationSettings: Date; |
|
14 |
profile: UserProfile; |
|
16 | 15 |
|
17 | 16 |
constructor( |
18 | 17 |
private dialog: MatDialog, |
19 |
private profileService: ProfileService,
|
|
20 |
private localizationService: LocalizationService
|
|
18 |
private localizationService: LocalizationService,
|
|
19 |
private userService: UserService
|
|
21 | 20 |
) { |
22 |
// profileService.getProfile()
|
|
23 |
// .subscribe((data: UserProfile) => this.notificationSettings = new Date(data.settings.notification));
|
|
21 |
userService.getLoggedUserProfile()
|
|
22 |
.subscribe((data: UserProfile) => this.profile = data);
|
|
24 | 23 |
} |
25 | 24 |
|
26 | 25 |
onProfileClick(): void { |
27 |
this.dialog.open(ProfileSettingsComponent, {
|
|
28 |
data: {
|
|
29 |
shouldNotify: this.notificationSettings, // TODO potřeba?
|
|
30 |
notifyDate: this.notificationSettings, |
|
31 |
notifyTime: { |
|
32 |
hour: this.notificationSettings.getHours(), |
|
33 |
minute: this.notificationSettings.getMinutes() |
|
34 |
} |
|
35 |
} |
|
36 |
}); |
|
26 |
// TODO (až bude hotovej endpoint na post notifikace)
|
|
27 |
// this.dialog.open(ProfileSettingsComponent, {
|
|
28 |
// data: {
|
|
29 |
// notifyDate: this.notificationSettings,
|
|
30 |
// notifyTime: {
|
|
31 |
// hour: this.notificationSettings.getHours(),
|
|
32 |
// minute: this.notificationSettings.getMinutes()
|
|
33 |
// }
|
|
34 |
// }
|
|
35 |
// });
|
|
37 | 36 |
} |
38 | 37 |
} |
Také k dispozici: Unified diff
Re #7494 Components connected to API - except profile settings and add vacation components