Projekt

Obecné

Profil

Stáhnout (1.38 KB) Statistiky
| Větev: | Tag: | Revize:
1
import { Component, Inject } from '@angular/core';
2
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
3
import {DateToolsService} from '../services/util/date-tools.service';
4
import {DateFormatterService} from '../services/util/date-formatter.service';
5

    
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
  private date: Date;
13
  private time: string;
14

    
15
  constructor(
16
    private dateToolsService: DateToolsService,
17
    private dateFormatterService: DateFormatterService,
18
    public dialogRef: MatDialogRef<ProfileSettingsComponent>,
19
    @Inject(MAT_DIALOG_DATA) public data: ProfileSettingsDialogData,
20
  ) {
21
    const parsedDatetime = this.dateToolsService.toDateAndTime(this.data.notification);
22

    
23
    this.date = parsedDatetime.date;
24
    this.time = parsedDatetime.time;
25
  }
26

    
27
  onConfirmClick(): void {
28
    this.dialogRef.close({
29
      isConfirmed: true,
30
      notification: this.dateFormatterService.formatDatetime(
31
        this.dateToolsService.toDate(
32
          this.dateFormatterService.formatDate(this.date),
33
          this.time
34
        )
35
      )
36
    });
37
  }
38

    
39
  onCloseClick(): void {
40
    this.dialogRef.close({
41
      isConfirmed: false
42
    });
43
  }
44
}
45

    
46
export interface ProfileSettingsDialogData {
47
  notification: string; // yyyy/mm/dd hh:mm:ss
48
}
(3-3/4)