Projekt

Obecné

Profil

Stáhnout (1.23 KB) Statistiky
| Větev: | Tag: | Revize:
1
import {Component, Inject} from '@angular/core';
2
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
3

    
4
@Component({
5
  selector: 'app-default-settings',
6
  templateUrl: './default-settings-dialog.component.html',
7
  styleUrls: ['./default-settings.component.sass']
8
})
9
export class DefaultSettingsDialogComponent {
10
  MINUTE_STEP = 15;
11

    
12
  constructor(
13
    public dialogRef: MatDialogRef<DefaultSettingsDialogComponent>,
14
    @Inject(MAT_DIALOG_DATA) public data: DefaultSettingsDialogData
15
  ) {
16
  }
17

    
18
  onConfirmClick(): void {
19
    this.dialogRef.close({
20
      isConfirmed: true,
21
      notificationDatetime: this.toNotificationDatetime(),
22
      sickdayCount: this.data.sickdaysCount
23
    });
24
  }
25

    
26
  onCloseClick(): void {
27
    this.dialogRef.close({
28
      isConfirmed: false
29
    });
30
  }
31

    
32
  private toNotificationDatetime(): Date {
33
    const splittedTime = this.data.notificationTime.split(':');
34

    
35
    return new Date(
36
      this.data.notificationDate.getFullYear(),
37
      this.data.notificationDate.getMonth(),
38
      this.data.notificationDate.getDate(),
39
      Number(splittedTime[0]),
40
      Number(splittedTime[1])
41
    );
42
  }
43

    
44
}
45

    
46
export class DefaultSettingsDialogData {
47
  notificationDate: Date;
48
  notificationTime: string;
49
  sickdaysCount: number;
50
}
(2-2/3)