Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 366930a6

Přidáno uživatelem Václav Jirák před téměř 6 roky(ů)

Re #7499 User profile component initialized

Zobrazit rozdíly:

webapp/src/app/employees/employees-list.component.ts
88 88
  private toSettings(data): Settings {
89 89
    return {
90 90
      sickdayCount: data.sickdayCount,
91
      notification: this.dateFormatterService.formatDate(data.notificationDatetime)
91
      notification: this.dateFormatterService.formatDatetime(data.notificationDatetime)
92 92
    };
93 93
  }
94 94

  
webapp/src/app/employees/employees.module.ts
16 16
import {DefaultSettingsDialogComponent} from './default-settings-dialog/default-settings-dialog.component';
17 17
import {NgbTimepickerModule} from '@ng-bootstrap/ng-bootstrap';
18 18
import {SharedModule} from '../shared/shared.module';
19
import { UserProfileDialogComponent } from './user-profile/user-profile-dialog.component';
19 20

  
20 21
@NgModule({
21 22
  declarations: [
22 23
    EmployeesListComponent,
23 24
    EditEmployeeDialogComponent,
24
    DefaultSettingsDialogComponent
25
    DefaultSettingsDialogComponent,
26
    UserProfileDialogComponent
25 27
  ],
26 28
  imports: [
27 29
    CommonModule,
......
38 40
  ],
39 41
  entryComponents: [
40 42
    EditEmployeeDialogComponent,
41
    DefaultSettingsDialogComponent
43
    DefaultSettingsDialogComponent,
44
    UserProfileDialogComponent
42 45
  ]
43 46
})
44 47
export class EmployeesModule { }
webapp/src/app/employees/user-profile/user-profile-dialog.component.html
1
<p>
2
  user-profile works!
3
</p>
webapp/src/app/employees/user-profile/user-profile-dialog.component.ts
1
import {Component, Inject, OnInit} from '@angular/core';
2
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
3
import {UserProfile} from '../../models/user.model';
4
import {Calendar} from '../../models/calendar.model';
5

  
6
@Component({
7
  selector: 'app-user-profile',
8
  templateUrl: './user-profile-dialog.component.html',
9
  styleUrls: ['./user-profile-dialog.component.sass']
10
})
11
export class UserProfileDialogComponent implements OnInit {
12

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

  
18
  ngOnInit() {
19
  }
20

  
21
  onCloseClick(): void {
22
    this.dialogRef.close({
23
      isConfirmed: false
24
    });
25
  }
26
}
27

  
28
export class UserProfileDialogData {
29
  profile: UserProfile;
30
  calendar: Calendar[];
31
}
webapp/src/app/services/api/user.service.ts
78 78
    return this.makeGetCalendarApiCall('me', from, to, language, status);
79 79
  }
80 80

  
81
  /**
82
   * Returns vacation and sick days in interval between given dates
83
   * @param id user's id
84
   * @param from days from this date forward
85
   * @param to limit returned days, returns <from, to>
86
   * @param language error's language
87
   * @param status filter by status
88
   */
89
  getUserCalendarWithOptions(id: string, from: Date, to: Date, language: Languages, status: RequestStatus) {
90
    return this.makeGetCalendarApiCall(id, from, to, language, status);
91
  }
92

  
81 93
  /**
82 94
   * Post user calendar using POST
83 95
   * @param calendar to be posted
webapp/src/app/services/util/date-formatter.service.ts
10 10
   * Formats date to a following format: yyyy/mm/dd hh:mm:ss
11 11
   * @param date Date which is formatted
12 12
   */
13
  formatDate(date: Date): string {
13
  formatDatetime(date: Date): string {
14 14
    let result = '';
15 15

  
16 16
    result += this.formatToDoubleDigits(date.getFullYear()) + '/';
......
24 24
    return result;
25 25
  }
26 26

  
27
  /**
28
   * Formats date to a following format: yyyy/mm/dd
29
   * @param date Date which is formatted
30
   */
31
  formatDate(date: Date): string {
32
    let result = '';
33

  
34
    result += this.formatToDoubleDigits(date.getFullYear()) + '/';
35
    result += this.formatToDoubleDigits(date.getMonth() + 1) + '/';
36
    result += this.formatToDoubleDigits(date.getDate());
37

  
38
    return result;
39
  }
40

  
27 41
  /**
28 42
   * Formats passed number to double digits format (e.g. - 3 -> '03')
29 43
   * @param number Number which is formatted

Také k dispozici: Unified diff