Revize 93fb3695
Přidáno uživatelem Václav Jirák před téměř 6 roky(ů)
webapp/src/app/dashboard/employer-dashboard/employer-dashboard.component.html | ||
---|---|---|
39 | 39 |
|
40 | 40 |
<div class="days-off-info" *ngIf="profile"> |
41 | 41 |
<app-vacation-info |
42 |
[sickDaysRemaining]="profile.sickdayCount"
|
|
42 |
[sickDaysRemaining]="profile.sickDayCount"
|
|
43 | 43 |
[extraVacationRemaining]="profile.vacationCount" |
44 | 44 |
></app-vacation-info> |
45 | 45 |
</div> |
webapp/src/app/employees/default-settings-dialog/default-settings-dialog.component.html | ||
---|---|---|
7 | 7 |
<div class="sickday-count"> |
8 | 8 |
<label for="sickdays-count-input" class="dialog-label">Počet sickdays:</label> |
9 | 9 |
<mat-form-field> |
10 |
<input id="sickdays-count-input" type="number" matInput [(ngModel)]="data.sickdaysCount">
|
|
10 |
<input id="sickdays-count-input" type="number" matInput [(ngModel)]="data.sickDayCount">
|
|
11 | 11 |
</mat-form-field> |
12 | 12 |
</div> |
13 | 13 |
</div> |
webapp/src/app/employees/default-settings-dialog/default-settings-dialog.component.ts | ||
---|---|---|
19 | 19 |
this.dialogRef.close({ |
20 | 20 |
isConfirmed: true, |
21 | 21 |
notificationDatetime: this.toNotificationDatetime(), |
22 |
sickdayCount: this.data.sickdaysCount
|
|
22 |
sickDayCount: this.data.sickDayCount
|
|
23 | 23 |
}); |
24 | 24 |
} |
25 | 25 |
|
... | ... | |
46 | 46 |
export class DefaultSettingsDialogData { |
47 | 47 |
notificationDate: Date; |
48 | 48 |
notificationTime: string; |
49 |
sickdaysCount: number;
|
|
49 |
sickDayCount: number;
|
|
50 | 50 |
} |
webapp/src/app/employees/edit-employee-dialog/edit-employee-dialog.component.ts | ||
---|---|---|
21 | 21 |
constructor(public dialogRef: MatDialogRef<EditEmployeeDialogComponent>, |
22 | 22 |
@Inject(MAT_DIALOG_DATA) public data: UserProfile, |
23 | 23 |
private snackBar: MatSnackBar) { |
24 |
this._sickDaysCount = data.sickdayCount;
|
|
24 |
this._sickDaysCount = data.sickDayCount;
|
|
25 | 25 |
this._vacationDaysCount = data.vacationCount; |
26 | 26 |
this._userType = data.role; |
27 | 27 |
this._userId = data.id; |
... | ... | |
37 | 37 |
this.postUserSettings.emit({ |
38 | 38 |
id: this._userId, |
39 | 39 |
role: this._userType, |
40 |
sickdayCount: this._sickDaysCount,
|
|
40 |
sickDayCount: this._sickDaysCount,
|
|
41 | 41 |
vacationCount: this._vacationDaysCount |
42 | 42 |
}); |
43 | 43 |
|
webapp/src/app/employees/employees-list.component.ts | ||
---|---|---|
123 | 123 |
const parsedSettings = { |
124 | 124 |
notificationDate: new Date(parsedDate.getFullYear(), parsedDate.getMonth(), parsedDate.getDate()), |
125 | 125 |
notificationTime: parsedDate.getHours() + ':' + parsedDate.getMinutes(), |
126 |
sickdaysCount: settingsData.sickdayCount
|
|
126 |
sickdaysCount: settingsData.sickDayCount
|
|
127 | 127 |
}; |
128 | 128 |
|
129 | 129 |
this.dialog.open(DefaultSettingsDialogComponent, { |
... | ... | |
142 | 142 |
|
143 | 143 |
private toSettings(data): Settings { |
144 | 144 |
return { |
145 |
sickdayCount: data.sickdayCount,
|
|
145 |
sickDayCount: data.sickDayCount,
|
|
146 | 146 |
notification: this.dateFormatterService.formatDatetime(data.notificationDatetime) |
147 | 147 |
}; |
148 | 148 |
} |
webapp/src/app/employees/user-profile/user-profile-dialog.component.html | ||
---|---|---|
12 | 12 |
<span class="user-name">{{profile.firstName}} {{profile.lastName}}</span> |
13 | 13 |
</div> |
14 | 14 |
<app-vacation-info |
15 |
[sickDaysRemaining]="profile.sickdayCount"
|
|
15 |
[sickDaysRemaining]="profile.sickDayCount"
|
|
16 | 16 |
[extraVacationRemaining]="profile.vacationCount" |
17 | 17 |
></app-vacation-info> |
18 | 18 |
</div> |
webapp/src/app/enums/common.enum.ts | ||
---|---|---|
17 | 17 |
|
18 | 18 |
export enum VacationType { |
19 | 19 |
VACATION = 'VACATION', |
20 |
SICKDAY = 'SICKDAY', |
|
20 |
SICKDAY = 'SICK_DAY',
|
|
21 | 21 |
NONE = 'NONE', |
22 | 22 |
} |
23 | 23 |
|
webapp/src/app/models/settings.model.ts | ||
---|---|---|
1 | 1 |
import {UserType} from '../enums/common.enum'; |
2 | 2 |
|
3 | 3 |
export interface Settings { |
4 |
sickdayCount: number;
|
|
4 |
sickDayCount: number;
|
|
5 | 5 |
notification: string; |
6 | 6 |
} |
7 | 7 |
|
8 | 8 |
export interface UserSettings { |
9 | 9 |
id: number; |
10 | 10 |
vacationCount: number; |
11 |
sickdayCount: number;
|
|
11 |
sickDayCount: number;
|
|
12 | 12 |
role: UserType; |
13 | 13 |
} |
14 | 14 |
|
webapp/src/app/models/user.model.ts | ||
---|---|---|
23 | 23 |
lastName: string; |
24 | 24 |
photo: string; |
25 | 25 |
vacationCount: number; |
26 |
sickdayCount: number;
|
|
26 |
sickDayCount: number;
|
|
27 | 27 |
status: RequestStatus; |
28 | 28 |
role: UserType; |
29 | 29 |
notification: Date; |
webapp/src/app/services/tests/settings.service.spec.ts | ||
---|---|---|
23 | 23 |
|
24 | 24 |
it('getDefaultSettings', () => { |
25 | 25 |
const dummyData = { |
26 |
sickdayCount: 3,
|
|
26 |
sickDayCount: 3,
|
|
27 | 27 |
notification: '2019/05/25 14:41:31' |
28 | 28 |
}; |
29 | 29 |
|
30 | 30 |
service.getDefaultSettings().subscribe((data: any) => { |
31 |
expect(data.sickdayCount).toBeDefined();
|
|
32 |
expect(data.sickdayCount).toBe(3);
|
|
31 |
expect(data.sickDayCount).toBeDefined();
|
|
32 |
expect(data.sickDayCount).toBe(3);
|
|
33 | 33 |
expect(data.notification).toBeDefined(); |
34 | 34 |
}); |
35 | 35 |
|
... | ... | |
40 | 40 |
|
41 | 41 |
it('getDefaultSettingsWithLanguage', () => { |
42 | 42 |
const dummyData = { |
43 |
sickdayCount: 3,
|
|
43 |
sickDayCount: 3,
|
|
44 | 44 |
notification: '2019/05/25 14:41:31' |
45 | 45 |
}; |
46 | 46 |
|
47 | 47 |
service.getDefaultSettingsWithLanguage(Languages.ENGLISH).subscribe((data: any) => { |
48 |
expect(data.sickdayCount).toBeDefined();
|
|
49 |
expect(data.sickdayCount).toBe(3);
|
|
48 |
expect(data.sickDayCount).toBeDefined();
|
|
49 |
expect(data.sickDayCount).toBe(3);
|
|
50 | 50 |
expect(data.notification).toBeDefined(); |
51 | 51 |
}); |
52 | 52 |
|
... | ... | |
61 | 61 |
answer: 'ok', |
62 | 62 |
}; |
63 | 63 |
|
64 |
service.postDefaultSettings({sickdayCount: 3, notification: '2019/04/25 18:23:36'})
|
|
64 |
service.postDefaultSettings({sickDayCount: 3, notification: '2019/04/25 18:23:36'})
|
|
65 | 65 |
.subscribe((data: any) => expect(data.answer).toBe('ok')); |
66 | 66 |
|
67 | 67 |
const req = httpMock.expectOne(baseUrl + '/api/settings'); |
... | ... | |
74 | 74 |
answer: 'ok', |
75 | 75 |
}; |
76 | 76 |
|
77 |
service.postDefaultSettingsWithLanguage({sickdayCount: 3, notification: '2019/04/25 18:23:36'}, Languages.ENGLISH)
|
|
77 |
service.postDefaultSettingsWithLanguage({sickDayCount: 3, notification: '2019/04/25 18:23:36'}, Languages.ENGLISH)
|
|
78 | 78 |
.subscribe((data: any) => expect(data.answer).toBe('ok')); |
79 | 79 |
|
80 | 80 |
const req = httpMock.expectOne(baseUrl + '/api/settings?lang=EN'); |
webapp/src/app/services/tests/user.service.spec.ts | ||
---|---|---|
28 | 28 |
lastName: 'Novak', |
29 | 29 |
photo: 'https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg', |
30 | 30 |
vacationCount: 8.5, |
31 |
sickdayCount: 3,
|
|
31 |
sickDayCount: 3,
|
|
32 | 32 |
status: 'ACCEPTED', |
33 | 33 |
role: 'EMPLOYER', |
34 | 34 |
notification: '2000/12/01 09:00:00' |
... | ... | |
38 | 38 |
service.getLoggedUserProfile().subscribe((data: any) => { |
39 | 39 |
expect(data.id).toBe(1); |
40 | 40 |
expect(data.vacationCount).toBe(8.5); |
41 |
expect(data.sickdayCount).toBe(3);
|
|
41 |
expect(data.sickDayCount).toBe(3);
|
|
42 | 42 |
expect(data.status).toBe(RequestStatus.ACCEPTED); |
43 | 43 |
expect(data.role).toBe(UserType.EMPLOYER); |
44 | 44 |
expect(data.notification).toBeDefined(); |
... | ... | |
56 | 56 |
lastName: 'Novak', |
57 | 57 |
photo: 'https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg', |
58 | 58 |
vacationCount: 8.5, |
59 |
sickdayCount: 3,
|
|
59 |
sickDayCount: 3,
|
|
60 | 60 |
status: 'ACCEPTED', |
61 | 61 |
role: 'EMPLOYER', |
62 | 62 |
notification: '2000/12/01 09:00:00' |
... | ... | |
66 | 66 |
service.getLoggedUserProfileWithLanguage(Languages.ENGLISH).subscribe((data: any) => { |
67 | 67 |
expect(data.id).toBe(1); |
68 | 68 |
expect(data.vacationCount).toBe(8.5); |
69 |
expect(data.sickdayCount).toBe(3);
|
|
69 |
expect(data.sickDayCount).toBe(3);
|
|
70 | 70 |
expect(data.status).toBe(RequestStatus.ACCEPTED); |
71 | 71 |
expect(data.role).toBe(UserType.EMPLOYER); |
72 | 72 |
expect(data.notification).toBeDefined(); |
Také k dispozici: Unified diff
sickday refactored to sickDay