Projekt

Obecné

Profil

Stáhnout (1.38 KB) Statistiky
| Větev: | Tag: | Revize:
1 37333849 Václav Jirák
import { Component, Inject } from '@angular/core';
2
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
3 9cc55d8d Václav Jirák
import {DateToolsService} from '../services/util/date-tools.service';
4 78eacb99 Václav Jirák
import {DateFormatterService} from '../services/util/date-formatter.service';
5 37333849 Václav Jirák
6
@Component({
7
  selector: 'app-profile-settings',
8
  templateUrl: './profile-settings.component.html',
9
  styleUrls: ['./profile-settings.component.sass']
10
})
11
export class ProfileSettingsComponent {
12 78eacb99 Václav Jirák
  private date: Date;
13
  private time: string;
14 9cc55d8d Václav Jirák
15 37333849 Václav Jirák
  constructor(
16 9cc55d8d Václav Jirák
    private dateToolsService: DateToolsService,
17
    private dateFormatterService: DateFormatterService,
18 37333849 Václav Jirák
    public dialogRef: MatDialogRef<ProfileSettingsComponent>,
19
    @Inject(MAT_DIALOG_DATA) public data: ProfileSettingsDialogData,
20
  ) {
21 9cc55d8d Václav Jirák
    const parsedDatetime = this.dateToolsService.toDateAndTime(this.data.notification);
22
23
    this.date = parsedDatetime.date;
24
    this.time = parsedDatetime.time;
25 37333849 Václav Jirák
  }
26
27
  onConfirmClick(): void {
28 696f3358 Václav Jirák
    this.dialogRef.close({
29
      isConfirmed: true,
30 9cc55d8d Václav Jirák
      notification: this.dateFormatterService.formatDatetime(
31
        this.dateToolsService.toDate(
32
          this.dateFormatterService.formatDate(this.date),
33
          this.time
34
        )
35
      )
36 696f3358 Václav Jirák
    });
37 37333849 Václav Jirák
  }
38
39
  onCloseClick(): void {
40 696f3358 Václav Jirák
    this.dialogRef.close({
41
      isConfirmed: false
42
    });
43 37333849 Václav Jirák
  }
44
}
45
46
export interface ProfileSettingsDialogData {
47 9cc55d8d Václav Jirák
  notification: string; // yyyy/mm/dd hh:mm:ss
48 37333849 Václav Jirák
}