|
|
@@ -1,13 +1,11 @@
|
|
1
|
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
|
-import { Component, OnInit, ViewChild } from '@angular/core';
|
|
3
|
|
-import { FormBuilder } from '@angular/forms';
|
|
|
2
|
+import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
|
|
3
|
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
4
|
4
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
5
|
|
-import { Table } from 'primeng/table';
|
|
|
5
|
+import { ModalDismissReasons, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
6
|
6
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
7
|
|
-import { tap } from 'rxjs/operators';
|
|
8
|
7
|
import { AppBreadcrumbService } from 'src/app/app.breadcrumb.service';
|
|
9
|
8
|
import { Candidate } from 'src/app/shared/models/candidate';
|
|
10
|
|
-import { CandidateService } from 'src/app/shared/services/candidate.service';
|
|
11
|
9
|
import { candidatListService } from './candidat-list.service';
|
|
12
|
10
|
|
|
13
|
11
|
@Component({
|
|
|
@@ -16,14 +14,17 @@ import { candidatListService } from './candidat-list.service';
|
|
16
|
14
|
styleUrls: ['./candidat-list.component.scss']
|
|
17
|
15
|
})
|
|
18
|
16
|
export class CandidatListComponent implements OnInit {
|
|
19
|
|
-
|
|
|
17
|
+
|
|
20
|
18
|
candidates: Observable<Candidate[]>;
|
|
21
|
19
|
candidate: Candidate;
|
|
22
|
20
|
currentPage = 1;
|
|
23
|
21
|
itemsPerPage = 5;
|
|
24
|
22
|
pageSize: number;
|
|
25
|
23
|
cp: number = 1;
|
|
26
|
|
- constructor(private breadcrumbService: AppBreadcrumbService,private http: HttpClient, private candidatListService: candidatListService, private route: ActivatedRoute,private router: Router, private candidatService: CandidateService) {
|
|
|
24
|
+
|
|
|
25
|
+ constructor(private breadcrumbService: AppBreadcrumbService,private http: HttpClient,
|
|
|
26
|
+ private candidatListService: candidatListService, private route: ActivatedRoute,private router: Router,
|
|
|
27
|
+ private modalService: NgbModal,private formBuilder: FormBuilder) {
|
|
27
|
28
|
this.breadcrumbService.setItems([
|
|
28
|
29
|
{ label: 'Candidats' },
|
|
29
|
30
|
{ label: 'List', routerLink: ['/candidat/candidat-list'] }
|
|
|
@@ -34,6 +35,9 @@ export class CandidatListComponent implements OnInit {
|
|
34
|
35
|
this.route.data.subscribe((data: { candidats: Observable<Candidate[]> }) => this.candidates = data.candidats);
|
|
35
|
36
|
this.candidates = this.candidatListService.getCandidats();
|
|
36
|
37
|
}
|
|
|
38
|
+ receiveSearchList(list: Observable<Candidate[]>) {
|
|
|
39
|
+ this.candidates = list;
|
|
|
40
|
+ }
|
|
37
|
41
|
showDetail(candidateId: string){
|
|
38
|
42
|
var myurl = `${"/candidat/candidat-detail"}/${candidateId}`;
|
|
39
|
43
|
this.router.navigateByUrl(myurl);
|
|
|
@@ -43,15 +47,8 @@ export class CandidatListComponent implements OnInit {
|
|
43
|
47
|
this.router.navigateByUrl("/candidat/candidat-sidebar");
|
|
44
|
48
|
}
|
|
45
|
49
|
|
|
46
|
|
- search(){
|
|
47
|
|
- this.candidates = this.candidatService.search("","","");
|
|
|
50
|
+ open(content) {
|
|
|
51
|
+ this.modalService.open(content, {ariaLabelledBy: 'search-modal'});
|
|
48
|
52
|
}
|
|
49
|
53
|
|
|
50
|
|
- public onPageChange(pageNum: number): void {
|
|
51
|
|
- this.pageSize = this.itemsPerPage*(pageNum - 1);
|
|
52
|
|
- }
|
|
53
|
|
-
|
|
54
|
|
- public changePagesize(num: number): void {
|
|
55
|
|
- this.itemsPerPage = this.pageSize + num;
|
|
56
|
|
-}
|
|
57
|
54
|
}
|