@@ -4,6 +4,8 @@ import {MatTableDataSource} from '@angular/material/table';
44import { MatSort } from '@angular/material/sort' ;
55import { MatchingService } from '../../_services/matching.service' ;
66import { ExcelServiceService } from '../../_services/excel/excel-service.service' ;
7+ import { Job } from '../../_models/Job' ;
8+ import { JobsService } from '../../_services/jobs.service' ;
79
810@Component ( {
911 selector : 'app-recruitment' ,
@@ -44,6 +46,7 @@ export class RecruitmentComponent implements OnInit {
4446 ] ;
4547 //listOfCandidates = [];
4648
49+ jobs : Job [ ] ;
4750 recruits = [ ] ; //this.listOfCandidates;
4851 canvas : any ;
4952 ctx : any ;
@@ -89,7 +92,7 @@ export class RecruitmentComponent implements OnInit {
8992 public ChartType = 'pie' ;
9093
9194
92- constructor ( private matchingService : MatchingService , private excelService :ExcelServiceService ) { }
95+ constructor ( private jobService : JobsService , private matchingService : MatchingService , private excelService :ExcelServiceService ) { }
9396
9497 //displayedColumns: string[] = ['id', 'title', 'action'];
9598 displayedColumns : string [ ] = [ 'id' , 'name' , 'role' , 'available' , 'expsalary' , 'score' , 'action' ] ;
@@ -111,8 +114,8 @@ export class RecruitmentComponent implements OnInit {
111114 console . log ( this . dataSource ) ;
112115 this . dataSource . sort = this . sort ;
113116 this . dataSource . paginator = this . paginator ;
114- this . getMatchedCVs ( 'Job1' ) ;
115-
117+ // this.getMatchedCVs('Job1');
118+ this . getAvailableJobs ( ) ;
116119 }
117120
118121 processSeacrhJobForm ( ) {
@@ -157,6 +160,17 @@ export class RecruitmentComponent implements OnInit {
157160
158161}
159162
163+ getAvailableJobs ( ) {
164+ this . jobService . getJobs ( )
165+ . subscribe ( ( data : Job [ ] ) => {
166+ this . jobs = data ;
167+ console . log ( data ) ;
168+ } ,
169+ err => {
170+ console . log ( err ) ;
171+ } ) ;
172+ }
173+
160174exportExcel ( ) {
161175 this . excelService . exportAsExcelFile ( this . listOfCandidates , 'list_of_candidates' ) ;
162176}
0 commit comments