Revize 3bcb12a4
Přidáno uživatelem Václav Jirák před téměř 6 roky(ů)
webapp/src/app/add-vacation-dialog/add-vacation-dialog.component.html | ||
---|---|---|
1 | 1 |
<h1 mat-dialog-title>Výběr volna</h1> |
2 | 2 |
|
3 | 3 |
<div mat-dialog-content> |
4 |
<div> |
|
4 |
<div class="vacation-selection-container">
|
|
5 | 5 |
<label id="vacation-type-radio-group-label" class="dialog-label">Typ volna: </label> |
6 | 6 |
<mat-radio-group aria-labelledby="vacation-type-radio-group-label" class="vacation-type-radio-group" [(ngModel)]="selectedVacationType"> |
7 | 7 |
<mat-radio-button class="vacation-type-radio-button" [value]=vacationType.SICKDAY> |
... | ... | |
12 | 12 |
</mat-radio-button> |
13 | 13 |
</mat-radio-group> |
14 | 14 |
</div> |
15 |
|
|
16 |
<div class="datetime-interval"> |
|
17 |
<div class="from-datetime"> |
|
18 |
<span class="datetime-interval-label">Od:</span> |
|
19 |
<app-datetime [(date)]="data.fromDate" [(time)]="data.fromTime" [minuteStep]="MINUTE_STEP"></app-datetime> |
|
15 |
<div class="datetime-selection-container"> |
|
16 |
<div class="date-selection"> |
|
17 |
<span class="dialog-label">Datum:</span> |
|
18 |
<mat-form-field class="date-input"> |
|
19 |
<input id="date-input" matInput [matDatepicker]="datePicker" [(ngModel)]="data.date"> |
|
20 |
<mat-datepicker-toggle matSuffix [for]="datePicker"></mat-datepicker-toggle> |
|
21 |
<mat-datepicker #datePicker></mat-datepicker> |
|
22 |
</mat-form-field> |
|
20 | 23 |
</div> |
21 |
<div class="to-datetime"> |
|
22 |
<span class="datetime-interval-label">Do:</span> |
|
23 |
<app-datetime [(date)]="data.toDate" [(time)]="data.toTime" [minuteStep]="MINUTE_STEP"></app-datetime> |
|
24 |
<div class="datetime-interval" *ngIf="selectedVacationType == vacationType.VACATION"> |
|
25 |
<div class="from-time"> |
|
26 |
<span class="dialog-label">Od:</span> |
|
27 |
<div class="time-input-container"> |
|
28 |
<input class="time-input" [format]="24" [value]="data.fromTime" [ngxTimepicker]="fromTimePicker"> |
|
29 |
<ngx-material-timepicker [minutesGap]="MINUTE_STEP" (timeSet)="data.fromTime = $event" #fromTimePicker></ngx-material-timepicker> |
|
30 |
<i class="material-icons">access_time</i> |
|
31 |
</div> |
|
32 |
</div> |
|
33 |
<div class="to-time"> |
|
34 |
<span class="dialog-label">Do:</span> |
|
35 |
<div class="time-input-container"> |
|
36 |
<input class="time-input" [format]="24" [value]="data.toTime" [ngxTimepicker]="toTimePicker"> |
|
37 |
<ngx-material-timepicker [minutesGap]="MINUTE_STEP" (timeSet)="data.toTime = $event" #toTimePicker></ngx-material-timepicker> |
|
38 |
<i class="material-icons">access_time</i> |
|
39 |
</div> |
|
40 |
</div> |
|
24 | 41 |
</div> |
25 | 42 |
</div> |
26 | 43 |
</div> |
webapp/src/app/add-vacation-dialog/add-vacation-dialog.component.sass | ||
---|---|---|
1 | 1 |
.dialog-label |
2 | 2 |
display: block |
3 | 3 |
font-weight: bold |
4 |
color: grey |
|
4 | 5 |
|
5 | 6 |
.datetime-picker > * |
6 | 7 |
display: table-cell |
... | ... | |
10 | 11 |
flex-direction: column |
11 | 12 |
margin: 15px 0 |
12 | 13 |
|
13 |
.datetime-interval-label |
|
14 |
font-weight: bold |
|
15 |
display: block |
|
14 |
.date-input |
|
15 |
width: 200px |
|
16 |
|
|
17 |
.from-time |
|
18 |
display: inline-block |
|
19 |
|
|
20 |
.to-time |
|
21 |
display: inline-block |
|
22 |
margin-left: 3px |
|
23 |
|
|
24 |
.datetime-selection-container |
|
25 |
margin-bottom: 10px |
|
26 |
|
|
27 |
.time-input-container |
|
28 |
display: inline-block |
|
29 |
padding: 2px |
|
30 |
border-bottom: 1px solid grey |
|
31 |
|
|
32 |
.time-input |
|
33 |
background-color: transparent |
|
34 |
border: 0 |
|
35 |
outline: none |
|
36 |
width: 85px |
|
37 |
|
|
38 |
.material-icons |
|
39 |
font-size: 12px |
|
40 |
font-weight: bold |
|
41 |
color: grey |
webapp/src/app/add-vacation-dialog/add-vacation-dialog.component.ts | ||
---|---|---|
1 |
import { Component, Inject } from '@angular/core';
|
|
2 |
import { MAT_DIALOG_DATA, MatDialogRef, MatSnackBar } from '@angular/material';
|
|
1 |
import {Component, Inject} from '@angular/core';
|
|
2 |
import {MAT_DIALOG_DATA, MatDialogRef, MatSnackBar} from '@angular/material';
|
|
3 | 3 |
import {VacationType} from '../enums/common.enum'; |
4 |
import {FormControl} from '@angular/forms'; |
|
5 |
import {DateFormatterService} from '../services/util/date-formatter.service'; |
|
4 | 6 |
|
5 | 7 |
@Component({ |
6 | 8 |
selector: 'app-add-days-off-dialog', |
... | ... | |
14 | 16 |
|
15 | 17 |
selectedVacationType: VacationType; |
16 | 18 |
|
19 |
dateFormControl: FormControl = new FormControl(); |
|
20 |
|
|
17 | 21 |
constructor( |
18 | 22 |
public dialogRef: MatDialogRef<AddVacationDialogComponent>, |
19 | 23 |
@Inject(MAT_DIALOG_DATA) public data: AddVacationDialogData, |
20 |
private snackBar: MatSnackBar |
|
24 |
private snackBar: MatSnackBar, |
|
25 |
private dateFormatterService: DateFormatterService |
|
21 | 26 |
) { |
22 |
if (this.data.toDate == null) { |
|
23 |
this.data.toDate = this.data.fromDate; |
|
24 |
} |
|
25 | 27 |
if (this.data.fromTime == null) { |
26 | 28 |
this.data.fromTime = '08:00'; |
27 | 29 |
} |
28 | 30 |
if (data.toTime == null) { |
29 | 31 |
this.data.toTime = '16:00'; |
30 | 32 |
} |
33 |
|
|
34 |
this.dateFormControl.setValue(data.date); |
|
31 | 35 |
} |
32 | 36 |
|
33 | 37 |
onConfirmClick(): void { |
34 | 38 |
if (this.selectedVacationType == null) { |
35 | 39 |
this.snackBar.open('Nevybrán typ volna', 'Zavřít', { duration: 5000 }); |
36 |
} else if (this.data.fromDate > this.data.toDate) { |
|
37 |
this.snackBar.open('Datum "od" nemůže být větší než "do"', 'Zavřít', { duration: 5000 }); |
|
38 | 40 |
} else { |
39 |
this.dialogRef.close({ |
|
40 |
isConfirmed: true, |
|
41 |
vacationType: this.selectedVacationType, |
|
42 |
fromDate: this.data.fromDate, |
|
43 |
fromTime: this.data.fromTime, |
|
44 |
toDate: this.data.toDate, |
|
45 |
toTime: this.data.toTime |
|
46 |
}); |
|
41 |
let data; |
|
42 |
const formattedDate = this.dateFormatterService.formatDate(this.data.date); |
|
43 |
|
|
44 |
if (this.selectedVacationType === VacationType.VACATION) { |
|
45 |
data = { |
|
46 |
isConfirmed: true, |
|
47 |
vacationType: this.selectedVacationType, |
|
48 |
date: formattedDate, |
|
49 |
fromTime: this.data.fromTime, |
|
50 |
toTime: this.data.toTime |
|
51 |
}; |
|
52 |
} else { |
|
53 |
data = { |
|
54 |
isConfirmed: true, |
|
55 |
vacationType: this.selectedVacationType, |
|
56 |
date: formattedDate |
|
57 |
}; |
|
58 |
} |
|
59 |
|
|
60 |
this.dialogRef.close(data); |
|
47 | 61 |
} |
48 | 62 |
} |
49 | 63 |
|
... | ... | |
56 | 70 |
} |
57 | 71 |
|
58 | 72 |
export interface AddVacationDialogData { |
59 |
fromDate: Date; |
|
60 |
toDate: Date; |
|
73 |
date: Date; |
|
61 | 74 |
fromTime: string; // 'HH:mm' format |
62 | 75 |
toTime: string; // 'HH:mm' format |
63 | 76 |
} |
webapp/src/app/add-vacation-dialog/add-vacation-dialog.module.ts | ||
---|---|---|
13 | 13 |
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; |
14 | 14 |
import {BrowserModule} from '@angular/platform-browser'; |
15 | 15 |
import {SharedModule} from '../shared/shared.module'; |
16 |
import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker'; |
|
17 |
|
|
16 | 18 |
|
17 | 19 |
@NgModule({ |
18 | 20 |
declarations: [AddVacationDialogComponent], |
... | ... | |
30 | 32 |
MatInputModule, |
31 | 33 |
MatRadioModule, |
32 | 34 |
MatSnackBarModule, |
33 |
SharedModule |
|
35 |
SharedModule, |
|
36 |
NgxMaterialTimepickerModule |
|
34 | 37 |
], |
35 | 38 |
exports: [ |
36 | 39 |
AddVacationDialogComponent |
webapp/src/app/dashboard/employer-dashboard/employer-dashboard.component.ts | ||
---|---|---|
23 | 23 |
private vacationRequests: VacationRequest[]; |
24 | 24 |
private oncomingVacation: Calendar[]; |
25 | 25 |
|
26 |
private selectedMonth: Date; |
|
26 | 27 |
constructor( |
27 | 28 |
public dialog: MatDialog, |
28 | 29 |
private localizationService: LocalizationService, |
... | ... | |
32 | 33 |
) { } |
33 | 34 |
|
34 | 35 |
ngOnInit() { |
36 |
this.selectedMonth = this.dateToolsService.toStartOfMonth(new Date()); |
|
37 |
|
|
35 | 38 |
this.loadProfile(); |
36 | 39 |
this.loadAuthorizationRequests(); |
37 | 40 |
this.loadVacationRequests(); |
38 |
this.loadMonthVacation(this.dateToolsService.toStartOfMonth(new Date()));
|
|
41 |
this.loadMonthVacation(this.selectedMonth);
|
|
39 | 42 |
this.loadOncomingVacation(); |
40 | 43 |
} |
41 | 44 |
|
... | ... | |
75 | 78 |
this.dialog |
76 | 79 |
.open(AddVacationDialogComponent, { |
77 | 80 |
data: { |
78 |
fromDate: date
|
|
81 |
date |
|
79 | 82 |
} |
80 | 83 |
}) |
81 | 84 |
.afterClosed().subscribe(data => { |
82 | 85 |
if (data && data.isConfirmed) { |
83 |
// TODO |
|
86 |
this.userService.postCalendarWithLanguage( |
|
87 |
{ |
|
88 |
date: data.date, |
|
89 |
from: data.fromTime, |
|
90 |
to: data.toTime, |
|
91 |
type: data.vacationType |
|
92 |
}, |
|
93 |
this.localizationService.getCurrentLanguage() |
|
94 |
).subscribe(() => this.loadMonthVacation(this.selectedMonth)); |
|
84 | 95 |
} |
85 | 96 |
}); |
86 | 97 |
} |
87 | 98 |
|
88 | 99 |
onSelectedMonthChange(monthStart: Date) { |
100 |
this.selectedMonth = monthStart; |
|
89 | 101 |
this.loadMonthVacation(monthStart); |
90 | 102 |
} |
91 | 103 |
|
webapp/src/app/models/calendar.model.ts | ||
---|---|---|
9 | 9 |
status: RequestStatus; |
10 | 10 |
} |
11 | 11 |
|
12 |
|
|
13 | 12 |
export interface PostCalendar { |
14 | 13 |
date: string; |
15 | 14 |
from: string; |
webapp/src/app/services/api/user.service.ts | ||
---|---|---|
221 | 221 |
); |
222 | 222 |
} |
223 | 223 |
|
224 |
|
|
225 | 224 |
/** |
226 | 225 |
* Změna nastavení uživatele podle id |
227 | 226 |
* PUT /user/settings?[lang=<CZ,EN>] |
webapp/src/app/user-approval/user-approval.component.html | ||
---|---|---|
7 | 7 |
<table class="table text-center table-hover"> |
8 | 8 |
<thead class="thead-light"> |
9 | 9 |
<tr> |
10 |
<th style="width: 40%"> Jméno </th>
|
|
11 |
<th style="width: 40%"> Datum žádosti </th>
|
|
10 |
<th style="width: 35%"> Jméno </th>
|
|
11 |
<th style="width: 35%"> Datum žádosti </th>
|
|
12 | 12 |
<th></th> |
13 | 13 |
</tr> |
14 | 14 |
</thead> |
Také k dispozici: Unified diff
Re #7532 'Add vacation component' connected to the api