Revize 3fcf8b67
Přidáno uživatelem Hung Hoang před téměř 6 roky(ů)
webapp/src/app/dashboard/employer-dashboard/employer-dashboard.component.ts | ||
---|---|---|
1 | 1 |
import {Component, Input, OnInit} from '@angular/core'; |
2 |
import { MatDialog } from '@angular/material';
|
|
3 |
import { AddDaysOffDialogComponent } from '../../add-days-off-dialog/add-days-off-dialog.component';
|
|
2 |
import {MatDialog} from '@angular/material';
|
|
3 |
import {AddDaysOffDialogComponent} from '../../add-days-off-dialog/add-days-off-dialog.component';
|
|
4 | 4 |
import {UsersService} from '../../services/users.service'; |
5 | 5 |
import {Requests} from '../../models/requests.model'; |
6 |
import {UserProfile} from '../../models/user-profile.model'; |
|
7 | 6 |
import {UserService} from '../../services/user.service'; |
8 | 7 |
import {ProfileService} from '../../services/profile.service'; |
9 |
import {TimeUnit} from '../../enums/common.enum';
|
|
8 |
import {UserProfile} from '../../models/user.model';
|
|
10 | 9 |
|
11 | 10 |
@Component({ |
12 | 11 |
selector: 'app-employer-dashboard', |
... | ... | |
38 | 37 |
// .subscribe((data: Requests) => this.daysOffRequests = data); |
39 | 38 |
|
40 | 39 |
// Tmp mock |
41 |
this.profile = { |
|
42 |
id: 1, |
|
43 |
name: { |
|
44 |
first: 'Jon', |
|
45 |
last: 'Doe', |
|
46 |
}, |
|
47 |
photo: 'http://mosaddek.com/theme/diverse/assets/img/user1.png', |
|
48 |
settings: { |
|
49 |
notification: new Date(2019, 3, 25, 18, 0) |
|
50 |
}, |
|
51 |
vacation: { |
|
52 |
value: 5, |
|
53 |
unit: TimeUnit.DAY, |
|
54 |
}, |
|
55 |
sickDay: { |
|
56 |
value: 10, |
|
57 |
unit: TimeUnit.DAY |
|
58 |
} |
|
59 |
}; |
|
40 |
// this.profile = {
|
|
41 |
// id: 1,
|
|
42 |
// name: {
|
|
43 |
// first: 'Jon',
|
|
44 |
// last: 'Doe',
|
|
45 |
// },
|
|
46 |
// photo: 'http://mosaddek.com/theme/diverse/assets/img/user1.png',
|
|
47 |
// settings: {
|
|
48 |
// notification: new Date(2019, 3, 25, 18, 0)
|
|
49 |
// },
|
|
50 |
// vacation: {
|
|
51 |
// value: 5,
|
|
52 |
// unit: TimeUnit.DAY,
|
|
53 |
// },
|
|
54 |
// sickDay: {
|
|
55 |
// value: 10,
|
|
56 |
// unit: TimeUnit.DAY
|
|
57 |
// }
|
|
58 |
// };
|
|
60 | 59 |
} |
61 | 60 |
|
62 | 61 |
private userApproved(requestId: number, approved: boolean) { |
webapp/src/app/employees/employees-list.component.ts | ||
---|---|---|
1 | 1 |
import {Component, OnInit} from '@angular/core'; |
2 |
import {UserBasicInformation} from '../models/user-basic-information.model'; |
|
3 | 2 |
import {UsersService} from '../services/users.service'; |
4 | 3 |
import {VacationType} from '../enums/common.enum'; |
5 | 4 |
import {MatDialog} from '@angular/material'; |
6 | 5 |
import {EditEmployeeDialogComponent} from './edit-employee-dialog/edit-employee-dialog.component'; |
7 | 6 |
import {DayInfo, User} from './user.model'; |
8 |
import {AuthorizationRequest} from '../models/requests.model';
|
|
7 |
import {UserBasicInformation} from '../models/user.model';
|
|
9 | 8 |
|
10 | 9 |
const daysOfWeek: string[] = [ |
11 | 10 |
'po', |
webapp/src/app/header/header.component.ts | ||
---|---|---|
1 |
import { Component, Input } from '@angular/core'; |
|
2 |
import { MatDialog } from '@angular/material'; |
|
3 |
import { ProfileSettingsComponent } from '../profile-settings/profile-settings.component'; |
|
4 |
import { ProfileService } from '../services/profile.service'; |
|
5 |
import { UserProfile } from '../models/user-profile.model'; |
|
6 |
import {LocalizationService} from "../localization/localization.service"; |
|
1 |
import {Component, Input} from '@angular/core'; |
|
2 |
import {MatDialog} from '@angular/material'; |
|
3 |
import {ProfileSettingsComponent} from '../profile-settings/profile-settings.component'; |
|
4 |
import {ProfileService} from '../services/profile.service'; |
|
5 |
import {LocalizationService} from '../localization/localization.service'; |
|
7 | 6 |
|
8 | 7 |
@Component({ |
9 | 8 |
selector: 'app-header', |
webapp/src/app/models/post-requests.model.ts | ||
---|---|---|
1 |
import {RequestStatus} from '../enums/common.enum'; |
|
2 |
|
|
3 |
export interface UserRequest { |
|
4 |
id: number; |
|
5 |
status: RequestStatus; |
|
6 |
} |
webapp/src/app/models/requests.model.ts | ||
---|---|---|
53 | 53 |
} |
54 | 54 |
]; |
55 | 55 |
} |
56 |
|
|
57 |
export interface UserRequest { |
|
58 |
id: number; |
|
59 |
status: RequestStatus; |
|
60 |
} |
webapp/src/app/models/user-basic-information.model.ts | ||
---|---|---|
1 |
import {VacationType} from '../enums/common.enum'; |
|
2 |
import {Time} from '@angular/common'; |
|
3 |
|
|
4 |
export interface UserBasicInformation { |
|
5 |
id: number; |
|
6 |
firstName: string; |
|
7 |
lastName: string; |
|
8 |
photo: string; |
|
9 |
calendar: [ |
|
10 |
{ |
|
11 |
id: number, |
|
12 |
date: Date, |
|
13 |
from: Time, |
|
14 |
to: Time, |
|
15 |
type: VacationType; |
|
16 |
} |
|
17 |
]; |
|
18 |
} |
webapp/src/app/models/user-profile.model.ts | ||
---|---|---|
1 |
import {RequestStatus, UserType} from '../enums/common.enum'; |
|
2 |
|
|
3 |
export interface UserProfile { |
|
4 |
id: number; |
|
5 |
firstName: string; |
|
6 |
lastName: string; |
|
7 |
photo: string; |
|
8 |
vacationCount: number; |
|
9 |
sickdayCount: number; |
|
10 |
status: RequestStatus; |
|
11 |
role: UserType; |
|
12 |
notification: Date; |
|
13 |
} |
|
14 |
|
webapp/src/app/models/user.model.ts | ||
---|---|---|
1 |
import {Time} from '@angular/common'; |
|
2 |
import {RequestStatus, UserType, VacationType} from '../enums/common.enum'; |
|
3 |
|
|
4 |
export interface UserBasicInformation { |
|
5 |
id: number; |
|
6 |
firstName: string; |
|
7 |
lastName: string; |
|
8 |
photo: string; |
|
9 |
calendar: [ |
|
10 |
{ |
|
11 |
id: number, |
|
12 |
date: Date, |
|
13 |
from: Time, |
|
14 |
to: Time, |
|
15 |
type: VacationType; |
|
16 |
} |
|
17 |
]; |
|
18 |
} |
|
19 |
|
|
20 |
export interface UserProfile { |
|
21 |
id: number; |
|
22 |
firstName: string; |
|
23 |
lastName: string; |
|
24 |
photo: string; |
|
25 |
vacationCount: number; |
|
26 |
sickdayCount: number; |
|
27 |
status: RequestStatus; |
|
28 |
role: UserType; |
|
29 |
notification: Date; |
|
30 |
} |
webapp/src/app/services/profile.service.ts | ||
---|---|---|
1 |
import { Injectable } from '@angular/core'; |
|
2 |
import {UserProfile} from '../models/user-profile.model'; |
|
1 |
import {Injectable} from '@angular/core'; |
|
3 | 2 |
import {UserService} from './user.service'; |
4 | 3 |
import {Observable} from 'rxjs'; |
4 |
import {UserProfile} from '../models/user.model'; |
|
5 | 5 |
|
6 | 6 |
@Injectable({ |
7 | 7 |
providedIn: 'root' |
webapp/src/app/services/user.service.ts | ||
---|---|---|
1 | 1 |
import {Injectable} from '@angular/core'; |
2 | 2 |
import {HttpClient, HttpParams} from '@angular/common/http'; |
3 | 3 |
|
4 |
import {UserProfile} from '../models/user-profile.model'; |
|
5 | 4 |
import {Calendar, CalendarEdit, PostCalendar} from '../models/calendar.model'; |
6 | 5 |
import {BasicService} from './basic.service'; |
7 | 6 |
import {catchError} from 'rxjs/operators'; |
8 | 7 |
import {Languages, RequestStatus, RequestTypes} from '../enums/common.enum'; |
9 |
import {UserRequest} from '../models/post-requests.model'; |
|
10 | 8 |
import {PostUserSettings} from '../models/settings.model'; |
9 |
import {UserProfile} from '../models/user.model'; |
|
10 |
import {UserRequest} from '../models/requests.model'; |
|
11 | 11 |
|
12 | 12 |
@Injectable({ |
13 | 13 |
providedIn: 'root' |
webapp/src/app/services/users.service.ts | ||
---|---|---|
3 | 3 |
import {BasicService} from './basic.service'; |
4 | 4 |
import {catchError} from 'rxjs/operators'; |
5 | 5 |
|
6 |
import {UserBasicInformation} from '../models/user-basic-information.model'; |
|
7 | 6 |
import {AuthorizationRequest, VacationRequest} from '../models/requests.model'; |
8 | 7 |
import {Languages, ProfileStatus} from '../enums/common.enum'; |
9 | 8 |
import {Observable} from 'rxjs'; |
9 |
import {UserBasicInformation} from '../models/user.model'; |
|
10 | 10 |
|
11 | 11 |
@Injectable({ |
12 | 12 |
providedIn: 'root' |
Také k dispozici: Unified diff
Refactored all models