Projekt

Obecné

Profil

Stáhnout (2.33 KB) Statistiky
| Větev: | Tag: | Revize:
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';
4
import {UsersService} from '../../services/users.service';
5
import {Requests} from '../../models/requests.model';
6
import {UserService} from '../../services/user.service';
7
import {ProfileService} from '../../services/profile.service';
8
import {UserProfile} from '../../models/user.model';
9

    
10
@Component({
11
  selector: 'app-employer-dashboard',
12
  templateUrl: './employer-dashboard.component.html',
13
  styleUrls: ['./employer-dashboard.component.sass']
14
})
15
export class EmployerDashboardComponent implements OnInit {
16

    
17
  @Input() profile: UserProfile;
18
  private authorizationRequests: Requests;
19
  private daysOffRequests: Requests;
20

    
21
  constructor(
22
    public dialog: MatDialog,
23
    private profileService: ProfileService,
24
    // API
25
    private userService: UserService,
26
    private usersService: UsersService
27
  ) { }
28

    
29
  ngOnInit() {
30
    // this.profileService.getProfile()
31
    //   .subscribe((data: UserProfile) => this.profile = data);
32
    //
33
    // this.usersService.getAuthorizationRequests()
34
    //   .subscribe((data: Requests) => this.authorizationRequests = data);
35
    //
36
    // this.usersService.getVacationRequests()
37
    //   .subscribe((data: Requests) => this.daysOffRequests = data);
38

    
39
    // Tmp mock
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
    // };
59
  }
60

    
61
  private userApproved(requestId: number, approved: boolean) {
62
    // TODO api post call
63
    this.authorizationRequests.authorization.splice(0, 1);
64
  }
65

    
66
  private daysOffApproved(requestId: number, approved: boolean) {
67
    // TODO api post call
68
    this.daysOffRequests.vacation.splice(0, 1);
69
  }
70

    
71
  onDateSelect( date: Date ) {
72
    this.dialog.open(AddDaysOffDialogComponent, {
73
      data: {
74
        fromDate: date
75
      }
76
    });
77
  }
78

    
79
  onMonthSelect(month: number) {
80
    // TODO API CALL
81
    console.log(month);
82
  }
83
}
(3-3/4)