From 9ed3c2d5b22802d10cd370175e79673b75363da2 Mon Sep 17 00:00:00 2001 From: Ahmad Mehrbod Date: Thu, 7 May 2020 11:27:21 +0100 Subject: [PATCH 01/13] Adjust Job List page to Backend apply changes to job list page to work with the backend --- src/app/_components/jobs/jobs.component.html | 24 +++++++++++++++----- src/app/_components/jobs/jobs.component.ts | 23 +++++++++---------- src/assets/i18n/el.json | 2 ++ src/assets/i18n/en.json | 2 ++ src/assets/i18n/pt.json | 2 ++ src/environments/environment.ts | 2 +- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/app/_components/jobs/jobs.component.html b/src/app/_components/jobs/jobs.component.html index 5bbf1013..dcbe61ee 100644 --- a/src/app/_components/jobs/jobs.component.html +++ b/src/app/_components/jobs/jobs.component.html @@ -60,24 +60,36 @@

{{ 'JOBS.TITLE' | translate }}

- + {{ 'JOB.TITLE.LABEL' | translate }} - {{element.title}} + {{element.label}} + + + + {{ 'JOB.Description' | translate }} + {{ element.jobDescription | translate }} + + - - + - + + + + Location + {{element.jobLocation}} + diff --git a/src/app/_components/jobs/jobs.component.ts b/src/app/_components/jobs/jobs.component.ts index e2541561..a6c67128 100644 --- a/src/app/_components/jobs/jobs.component.ts +++ b/src/app/_components/jobs/jobs.component.ts @@ -31,7 +31,9 @@ const ELEMENT_DATA: AvailableJobs[] = [ {id: 666, Label:"Javascript developer",department:"department6",employmentType:"2",level:"1",JobDescription:"JS developer",SkillReq:[{SkillLabel:"JS",proficiencyLevel:"2",skillPriority:"1"},{SkillLabel:"HTML",proficiencyLevel:"3",skillPriority:"3"}]} ]; */ -const ELEMENT_DATA: Job[] = [ +const ELEMENT_DATA: Job[] = []; +/* +[ {id: 111, creator_id: 1, date: "24-4-2020", start_date: "24-4-2020", end_date: "24-4-2020", title:"DEMO FE developer", job_description:"department1", employment_type:"4", level:"5", skills: [{SkillLabel: "skillA", assign: "True", priority: "high", proficiencyLevel: "expert"}]}, {id: 222, creator_id: 1, date: "24-4-2020", start_date: "24-4-2020", end_date: "24-4-2020", title:"DEMO BE developer", job_description:"department2", employment_type:"3", level:"2", skills: [{SkillLabel: "skillB", assign: "True", priority: "high", proficiencyLevel: "expert"}]}, {id: 333, creator_id: 1, date: "24-4-2020", start_date: "24-4-2020", end_date: "24-4-2020", title:"DEMO FE developer 2", job_description:"department3", employment_type:"2", level:"1", skills: [{SkillLabel: "skillC", assign: "True", priority: "high", proficiencyLevel: "expert"}]}, @@ -39,7 +41,7 @@ const ELEMENT_DATA: Job[] = [ {id: 555, creator_id: 1, date: "24-4-2020", start_date: "24-4-2020", end_date: "24-4-2020", title:"DEMO FE developer 3", job_description:"department5", employment_type:"3", level:"3", skills: [{SkillLabel: "skillF", assign: "True", priority: "high", proficiencyLevel: "expert"}]}, {id: 666, creator_id: 1, date: "24-4-2020", start_date: "24-4-2020", end_date: "24-4-2020", title:"DEMO Javascript developer", job_description:"department6", employment_type:"2", level:"1", skills: [{SkillLabel: "skillD", assign: "True", priority: "high", proficiencyLevel: "expert"}]} ]; - +*/ /* const ELEMENT_DATA: AvailableJobs[] = [ {id: 1, skill: 'Angular', required_level: 'req. level 1', priority: '1'}, @@ -74,7 +76,7 @@ export class JobsComponent implements OnInit { */ export class JobsComponent implements OnInit { - displayedColumns: string[] = ['id', 'title', 'employment_type', 'level', 'action']; + displayedColumns: string[] = ['id', 'label' , 'jobDescription', 'jobLocation', 'action']; //dataSource = ELEMENT_DATA; dataSource = new MatTableDataSource(ELEMENT_DATA); @@ -128,25 +130,22 @@ export class JobsComponent implements OnInit { jobsList = []; ngOnInit() { + this.getJobList(); this.dataSource.sort = this.sort; this.dataSource.paginator = this.paginator; + } - + getJobList() { this.js .getJobs() .subscribe((data: Job[]) => { this.jobs = data; console.log(data); - - ELEMENT_DATA.forEach(element => { - data.push(element); - //console.log(element); - }); this.dataSource.data = data; - + }, + err => { + console.log(err); }); - - } exportExcel(){ diff --git a/src/assets/i18n/el.json b/src/assets/i18n/el.json index db48ac65..1411cb1c 100644 --- a/src/assets/i18n/el.json +++ b/src/assets/i18n/el.json @@ -59,6 +59,8 @@ "LABEL": "Title", "PLACEHOLDER": "Position" }, + "Description":"Description" + , "DEPARTMENT": { "LABEL": "Deparment", "PLACEHOLDER": "Deparment" diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index ce7dd130..33356671 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -59,6 +59,8 @@ "LABEL": "Title", "PLACEHOLDER": "Position" }, + "Description":"Description" + , "DEPARTMENT": { "LABEL": "Deparment", "PLACEHOLDER": "Deparment" diff --git a/src/assets/i18n/pt.json b/src/assets/i18n/pt.json index 3fbd88c7..577906be 100644 --- a/src/assets/i18n/pt.json +++ b/src/assets/i18n/pt.json @@ -59,6 +59,8 @@ "LABEL": "Title", "PLACEHOLDER": "Position" }, + "Description":"Description" + , "DEPARTMENT": { "LABEL": "Deparment", "PLACEHOLDER": "Deparment" diff --git a/src/environments/environment.ts b/src/environments/environment.ts index f3a02d53..ca84bc43 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -6,7 +6,7 @@ export const environment = { production: false, authUrl : 'http://qualichain.epu.ntua.gr:5000/auth', usersUrl : 'http://qualichain.epu.ntua.gr:5000/users', - jobsUrl : 'http://qualichain.epu.ntua.gr:5000/jobs', + jobsUrl : 'http://localhost:8000/jobs', smartBadgesManagementUrl : 'https://localhost:4000/smartBadgesManagement', verificationAndEquivalenceUrl : 'https://localhost:4000/verificationAndEquivalence', profileUrl : 'https://localhost:4000/profile', From 7dc01a7a7d889b647b24e5d6dcb2bbecd799b3bb Mon Sep 17 00:00:00 2001 From: Ahmad Mehrbod Date: Thu, 7 May 2020 12:30:25 +0100 Subject: [PATCH 02/13] Recruitment page Adopting Recruitement Page to the backend (first draft) --- .../recruitment/recruitment.component.ts | 16 ++++++---------- src/app/_services/matching.service.ts | 14 +++----------- src/environments/environment.ts | 2 +- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/app/_components/recruitment/recruitment.component.ts b/src/app/_components/recruitment/recruitment.component.ts index 86991600..4771579b 100644 --- a/src/app/_components/recruitment/recruitment.component.ts +++ b/src/app/_components/recruitment/recruitment.component.ts @@ -44,7 +44,7 @@ export class RecruitmentComponent implements OnInit { ]; //listOfCandidates = []; - recruits = this.listOfCandidates; + recruits = [];//this.listOfCandidates; canvas: any; ctx: any; seachJobTextInput: string; @@ -125,15 +125,11 @@ export class RecruitmentComponent implements OnInit { this.matchingService.matchJob(jobID) .subscribe( CVs => { - console.log(CVs); - for (const CV of CVs) { - console.log(CV); - const data = this.dataSource.data; - data.push(CV); - this.dataSource.data = data; - } - - + this.recruits = CVs; + this.recruits.sort((a, b) => b.score - a.score); + + this.dataSource.data = this.recruits; + }, err => { console.log(err); diff --git a/src/app/_services/matching.service.ts b/src/app/_services/matching.service.ts index 182e0b8c..499aff8f 100644 --- a/src/app/_services/matching.service.ts +++ b/src/app/_services/matching.service.ts @@ -14,18 +14,10 @@ export class MatchingService { public matchJob (jobID): Observable { + // const params = new HttpParams().set('jobid', jobID); + // return this.httpClient.get(this.serverurl, {responseType: 'json', params}); + return this.httpClient.get(`${this.serverurl}/${jobID}/candidates`, {responseType: 'json'}); - /* - const httpOptions = { - headers: new HttpHeaders({ 'Content-Type': 'application/json'}), - params: new HttpParams().set('jobid', jobID) - }; - */ -console.log(jobID) - const params = new HttpParams().set('jobid', jobID); - console.log(params); - console.log(this.serverurl); - return this.httpClient.get(this.serverurl, {responseType: 'json', params}); } } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index ca84bc43..c7e09fdb 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -13,7 +13,7 @@ export const environment = { educationManagementUrl : 'https://localhost:4000/educationManagement', competencyManagementUrl : 'https://localhost:4000/competencyManagement', cvUrl : 'http://qualichain.epu.ntua.gr:5000/CV', - jobmatchingUrl : 'http://localhost:8000/jobmatching', + jobmatchingUrl : 'http://localhost:8000/jobs', jobpostGet : 'https://localhost:8000/jobget', jobpostUrl : 'https://localhost:8000/jobpost' }; From 2e639a81bddd08d2bb15b1674fe778c457d85af4 Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Tue, 12 May 2020 19:32:01 +0100 Subject: [PATCH 03/13] Get list of available jobs for Recruitment --- .../recruitment/recruitment.component.html | 15 +++++++++++++- .../recruitment/recruitment.component.ts | 20 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/app/_components/recruitment/recruitment.component.html b/src/app/_components/recruitment/recruitment.component.html index 026109c4..e99631be 100644 --- a/src/app/_components/recruitment/recruitment.component.html +++ b/src/app/_components/recruitment/recruitment.component.html @@ -14,8 +14,9 @@

{{ 'RECRUITMENT.TITLE' | translate }}

+ + {{ 'RECRUITMENT.TITLE' | translate }} required minlength="3" #seachJobTextInputModel="ngModel"> + --> + +
+ + {{ 'RECRUITMENT.SEARCH_LABEL' | translate }} + + + {{job.label}} + + +
+ diff --git a/src/app/_components/recruitment/recruitment.component.ts b/src/app/_components/recruitment/recruitment.component.ts index 4771579b..c63ac2ec 100644 --- a/src/app/_components/recruitment/recruitment.component.ts +++ b/src/app/_components/recruitment/recruitment.component.ts @@ -4,6 +4,8 @@ import {MatTableDataSource} from '@angular/material/table'; import {MatSort} from '@angular/material/sort'; import { MatchingService } from '../../_services/matching.service'; import { ExcelServiceService } from '../../_services/excel/excel-service.service'; +import { Job } from '../../_models/Job'; +import { JobsService } from '../../_services/jobs.service'; @Component({ selector: 'app-recruitment', @@ -44,6 +46,7 @@ export class RecruitmentComponent implements OnInit { ]; //listOfCandidates = []; + jobs: Job[]; recruits = [];//this.listOfCandidates; canvas: any; ctx: any; @@ -89,7 +92,7 @@ export class RecruitmentComponent implements OnInit { public ChartType = 'pie'; - constructor(private matchingService: MatchingService, private excelService:ExcelServiceService) { } + constructor(private jobService: JobsService, private matchingService: MatchingService, private excelService:ExcelServiceService) { } //displayedColumns: string[] = ['id', 'title', 'action']; displayedColumns: string[] = ['id', 'name', 'role', 'available', 'expsalary', 'score', 'action']; @@ -111,8 +114,8 @@ export class RecruitmentComponent implements OnInit { console.log(this.dataSource); this.dataSource.sort = this.sort; this.dataSource.paginator = this.paginator; - this.getMatchedCVs('Job1'); - + //this.getMatchedCVs('Job1'); + this.getAvailableJobs(); } processSeacrhJobForm() { @@ -157,6 +160,17 @@ export class RecruitmentComponent implements OnInit { } + getAvailableJobs() { + this.jobService.getJobs() + .subscribe((data: Job[]) => { + this.jobs = data; + console.log(data); + }, + err => { + console.log(err); + }); +} + exportExcel(){ this.excelService.exportAsExcelFile(this.listOfCandidates, 'list_of_candidates'); } From 62c8d2a9e3753c59ef15fb3ea5eb83546d366e34 Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Fri, 15 May 2020 10:26:03 +0100 Subject: [PATCH 04/13] Job Posting Adopt the job creation page with the backend --- .../jobs-add/jobs-add.component.html | 24 ++++++++++++------- .../jobs-add/jobs-add.component.ts | 21 ++++++++-------- src/app/_models/Job.ts | 21 +++++++++++++--- src/app/_services/jobs.service.ts | 12 ++++++---- 4 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/app/_components/jobs-add/jobs-add.component.html b/src/app/_components/jobs-add/jobs-add.component.html index b30534a7..1475a9b0 100644 --- a/src/app/_components/jobs-add/jobs-add.component.html +++ b/src/app/_components/jobs-add/jobs-add.component.html @@ -9,35 +9,43 @@

{{ 'JOBS.TITLE' | translate }} - Create< {{ 'JOB.TITLE.LABEL' | translate }} - +
Description - +
+ + + Location + + +
+ + {{ 'JOB.START_DATE.PLACEHOLDER' | translate }} - + - +
{{ 'JOB.END_DATE.PLACEHOLDER' | translate }} - + - +
{{ 'JOB.EMPLOYMENT_TYPE.LABEL' | translate }} - + {{ 'JOB.EMPLOYMENT_TYPE.OPTIONS.FULL_TIME' | translate }} {{ 'JOB.EMPLOYMENT_TYPE.OPTIONS.PART_TIME' | translate }} {{ 'JOB.EMPLOYMENT_TYPE.OPTIONS.CONTRACT' | translate }} @@ -73,7 +81,7 @@

{{ 'JOBS.TITLE' | translate }} - Create<
-
+

{{ 'JOB.SKILL.TITLE' | translate }} {{i + 1}}

diff --git a/src/app/_components/jobs-add/jobs-add.component.ts b/src/app/_components/jobs-add/jobs-add.component.ts index 8d6de142..d525815c 100644 --- a/src/app/_components/jobs-add/jobs-add.component.ts +++ b/src/app/_components/jobs-add/jobs-add.component.ts @@ -76,13 +76,13 @@ export class JobsAddComponent implements OnInit { //this.control.push(this.initSkill()); let newJobSkill = {} as JobSkill; newJobSkill.SkillLabel = ""; - newJobSkill.assign = ""; - newJobSkill.priority = ""; + //newJobSkill.assign = ""; + //newJobSkill.priority = ""; newJobSkill.proficiencyLevel = ""; - if (!this.dataIn.skills) { - this.dataIn.skills = [newJobSkill]; + if (!this.dataIn.SkillReq) { + this.dataIn.SkillReq = [newJobSkill]; } else { - this.dataIn.skills.push(newJobSkill); + this.dataIn.SkillReq.push(newJobSkill); } @@ -92,12 +92,12 @@ export class JobsAddComponent implements OnInit { // remove address from the list //this.control = this.angForm.controls['SkillReq']; //this.control.removeAt(i); - this.dataIn.skills.splice(i, 1); + this.dataIn.SkillReq.splice(i, 1); } addJob() { - this.dataIn.creator_id = 1; - this.dataIn.date = "24-4-2020"; + //this.dataIn.creator_id = 1; + //this.dataIn.date = "24-4-2020"; let dataToSend = this.dataIn; delete dataToSend.id; @@ -135,7 +135,8 @@ export class JobsAddComponent implements OnInit { console.log("loadDataJob"); if (!dataObject) { - this.dataIn = {id: 111, creator_id: 1, date: "24-4-2020", start_date: "24-4-2020", end_date: "24-4-2020", title:"DEMO FE developer", job_description:"department1", employment_type:"4", level:"5", skills: [{SkillLabel: "skillA", assign: "True", priority: "high", proficiencyLevel: "expert"}]}; + this.dataIn = {id: null, Label: "DEMO FE developer", JobLocation: "department1", employmentType:"", level:"",JobDescription:"",startDate: "",endDate: "",SkillReq:[]}; + } else { this.dataIn = dataObject; @@ -156,7 +157,7 @@ export class JobsAddComponent implements OnInit { ngOnInit() { - this.dataIn = {id: null, creator_id: null, date: "", start_date: "", end_date: "", title:"", job_description:"", employment_type:"", level:"" }; + this.dataIn = {id: null, Label: null, employmentType:"", level:"",JobDescription:"",JobLocation:"",startDate: "",endDate: "",SkillReq:[]}; this.route.params.subscribe(params => { const id = +params.id; this.mode = ""; diff --git a/src/app/_models/Job.ts b/src/app/_models/Job.ts index d7beb1a5..8df6aff5 100644 --- a/src/app/_models/Job.ts +++ b/src/app/_models/Job.ts @@ -8,14 +8,28 @@ export default class Product { */ export class JobSkill { - SkillLabel: string; + SkillLabel: string; // required field + proficiencyLevel: string; + skillPriority: string; + +/* assign: string; priority: string; - proficiencyLevel: string; + */ } export class Job { - id: number; + id: string; + Label: string; // Position + employmentType: string; + level: string; // Seniority Level + JobDescription: String; + JobLocation: String; + // SkillReq?: string []; + SkillReq: JobSkill []; + startDate: string; + endDate: string; + /* id: number; creator_id: number; date: string; employment_type: string; @@ -25,4 +39,5 @@ export class JobSkill { skills?: [JobSkill]; start_date: string; title: string; + */ } \ No newline at end of file diff --git a/src/app/_services/jobs.service.ts b/src/app/_services/jobs.service.ts index 90754e11..6d7a142b 100644 --- a/src/app/_services/jobs.service.ts +++ b/src/app/_services/jobs.service.ts @@ -1,30 +1,32 @@ import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { environment } from './../../environments/environment'; import { throwError } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; +import { Job } from '../_models/Job'; @Injectable({ providedIn: 'root' }) export class JobsService { - //uri = 'http://localhost:4000/jobs'; private jobsURL = environment.jobsUrl; private uriGet = environment.jobpostGet; private uriPost = environment.jobpostUrl; constructor(private http: HttpClient) { } - addJob(dataIn: any) { - return this.http.post(`${this.jobsURL}`, dataIn). - pipe( + addJob(dataIn: Job){ + return this.http.post(`${this.jobsURL}`, JSON.stringify(dataIn)) + /* + .pipe( map((data: any) => { return data; }), catchError( error => { return throwError( 'Something went wrong!' ); }) ) + */ } getJobs() { From f6e8b3c800394392294c2010c0e9adba4f2d000b Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Wed, 20 May 2020 12:29:07 +0100 Subject: [PATCH 05/13] Profile Person --- src/app/_components/profiles/profiles.component.ts | 7 ++++++- src/app/_services/users.service.ts | 1 - src/environments/environment.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/_components/profiles/profiles.component.ts b/src/app/_components/profiles/profiles.component.ts index ab15ba0e..3e0a13da 100644 --- a/src/app/_components/profiles/profiles.component.ts +++ b/src/app/_components/profiles/profiles.component.ts @@ -48,12 +48,17 @@ export class ProfilesComponent implements OnInit { this.us .getUsers() .subscribe((data: User[]) => { - + /* ELEMENT_DATA.forEach(element => { data.push(element); }); + */ + //this.users = data; + console.log(data); this.dataSource.data = data; + }, err => { + console.log(err); }); } diff --git a/src/app/_services/users.service.ts b/src/app/_services/users.service.ts index 0790e24d..d9f595e4 100644 --- a/src/app/_services/users.service.ts +++ b/src/app/_services/users.service.ts @@ -9,7 +9,6 @@ import { map, catchError } from 'rxjs/operators'; }) export class UsersService { - //uri = 'http://localhost:4000/users'; private uriUsers = environment.usersUrl; constructor(private http: HttpClient) { } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index c7e09fdb..74ce1ccd 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,7 +5,7 @@ export const environment = { production: false, authUrl : 'http://qualichain.epu.ntua.gr:5000/auth', - usersUrl : 'http://qualichain.epu.ntua.gr:5000/users', + usersUrl : 'http://localhost:8000/profiles',//'http://qualichain.epu.ntua.gr:5000/users', jobsUrl : 'http://localhost:8000/jobs', smartBadgesManagementUrl : 'https://localhost:4000/smartBadgesManagement', verificationAndEquivalenceUrl : 'https://localhost:4000/verificationAndEquivalence', From ad5b9838ce91fd12c04027ea92a1a325cebcc27d Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Wed, 20 May 2020 14:54:54 +0100 Subject: [PATCH 06/13] Profile View and CV connection to the backend --- .../profiles-view/profiles-view.component.ts | 97 ++++++++++--------- src/app/_services/cv.service.ts | 4 +- src/app/_services/users.service.ts | 3 +- src/environments/environment.ts | 2 +- 4 files changed, 57 insertions(+), 49 deletions(-) diff --git a/src/app/_components/profiles-view/profiles-view.component.ts b/src/app/_components/profiles-view/profiles-view.component.ts index a86ab41c..3b98f2cc 100644 --- a/src/app/_components/profiles-view/profiles-view.component.ts +++ b/src/app/_components/profiles-view/profiles-view.component.ts @@ -193,64 +193,46 @@ export class ProfilesViewComponent implements OnInit { course_badges: [] }; - const id = +params.id; - if (id && id > 0) { + const id = params.id; + + if (id ) { this.userId=String(id); - + this.us - .getUser(id).subscribe( + .getUser(this.userId).subscribe( data => { console.log("user in db"); + this.userdata = data; if ((this.userdata.avatar_path=='') || (!this.userdata.avatar_path)){ this.userdata.avatar_path = 'assets/img/no_avatar.jpg'; - } - }, - error => { - console.log("user not found in db"); - listOfUsers.forEach(element => { - //console.log(element.id+"--"+params['id']); - if (element.id==params['id']) { - this.userdata = element; - } - }); - //this.userdata = listOfUsers[params['id']-1]; - if (this.userdata.avatar_path=='') { - this.userdata.avatar_path = 'assets/img/no_avatar.jpg'; } - } - ); -/* - this.us - .getUser(id) - .subscribe((data: User[]) => { - console.log(data); - this.userdata = data; - - }); -*/ - + if (!this.userdata.role){ + this.userdata.role = 'student'; + } + + // loading user's CV this.cvs - .getCV(id) + .getCV(this.userdata.cvuri) .subscribe((data: any) => { - - if (data.length>0) { - let posCV = data.length-1; - this.label = data[posCV].label; - this.description = data[posCV].description; - this.targetSector = data[posCV].target_sector; - this.expectedSalary = data[posCV].expected_salary; - this.JobDescription = data[posCV].description; - data[posCV].skills.forEach(element => { + console.log(data); + //if (data.length>0) { + //let posCV = data.length-1; + this.label = data.label; + this.description = data.description; + this.targetSector = data.target_sector; + this.expectedSalary = data.expected_salary; + this.JobDescription = data.description; + data.skills.forEach(element => { this.t.push(this.formBuilder.group({ - SkillLabel: [element.SkillLabel, [Validators.required]], + SkillLabel: [element.label, [Validators.required]], proficiencyLevel: [element.proficiencyLevel, Validators.required], - SkillComment: [element.SkillComment, [Validators.required]], + SkillComment: [element.comment, [Validators.required]], })); }); - data[posCV].work_history + data.workHistory .forEach(element => { this.w.push(this.formBuilder.group({ position: [element.position, Validators.required], @@ -259,7 +241,7 @@ export class ProfilesViewComponent implements OnInit { employer: [element.employer, [Validators.required]], })); }); - data[posCV].education + data.education .forEach(element => { this.e.push(this.formBuilder.group({ title: [element.title, Validators.required], @@ -269,8 +251,35 @@ export class ProfilesViewComponent implements OnInit { description: [element.description, [Validators.required]], })); }); - } + //} }); + //////////////////// + }, + error => { + console.log("user not found in db"); + listOfUsers.forEach(element => { + //console.log(element.id+"--"+params['id']); + if (element.id==params['id']) { + this.userdata = element; + } + }); + //this.userdata = listOfUsers[params['id']-1]; + if (this.userdata.avatar_path=='') { + this.userdata.avatar_path = 'assets/img/no_avatar.jpg'; + } + + } + ); +/* + this.us + .getUser(id) + .subscribe((data: User[]) => { + console.log(data); + this.userdata = data; + + }); +*/ + } }); diff --git a/src/app/_services/cv.service.ts b/src/app/_services/cv.service.ts index c9eb5ded..7ee1a8ed 100644 --- a/src/app/_services/cv.service.ts +++ b/src/app/_services/cv.service.ts @@ -14,14 +14,12 @@ import { environment } from './../../environments/environment'; export class CVService { uri = environment.cvUrl; - //uri = 'http://localhost:4000/cvs'; - constructor(private httpClient: HttpClient) { } - getCV(userId: Number) { + getCV(userId: String) { return this .httpClient .get(`${this.uri}/${userId}`); diff --git a/src/app/_services/users.service.ts b/src/app/_services/users.service.ts index d9f595e4..aac804df 100644 --- a/src/app/_services/users.service.ts +++ b/src/app/_services/users.service.ts @@ -19,7 +19,8 @@ export class UsersService { .get(`${this.uriUsers}`); } - getUser(userId: Number) { + getUser(userId: String) { + console.log("load data"); return this .http .get(`${this.uriUsers}/${userId}`); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 74ce1ccd..1842bba5 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -12,7 +12,7 @@ export const environment = { profileUrl : 'https://localhost:4000/profile', educationManagementUrl : 'https://localhost:4000/educationManagement', competencyManagementUrl : 'https://localhost:4000/competencyManagement', - cvUrl : 'http://qualichain.epu.ntua.gr:5000/CV', + cvUrl : 'http://localhost:8000/cv',//'http://qualichain.epu.ntua.gr:5000/CV', jobmatchingUrl : 'http://localhost:8000/jobs', jobpostGet : 'https://localhost:8000/jobget', jobpostUrl : 'https://localhost:8000/jobpost' From 7d0bb965e9d1bbc9df81b60fd3c08c1fc9948aed Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Wed, 20 May 2020 16:52:02 +0100 Subject: [PATCH 07/13] Delete Job to Backend --- src/app/_components/jobs/jobs.component.ts | 4 +++- src/app/_services/jobs.service.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/_components/jobs/jobs.component.ts b/src/app/_components/jobs/jobs.component.ts index a6c67128..895c1c73 100644 --- a/src/app/_components/jobs/jobs.component.ts +++ b/src/app/_components/jobs/jobs.component.ts @@ -109,7 +109,9 @@ export class JobsComponent implements OnInit { //this.result = dialogResult; if (dialogResult) { - console.log("Under construction"); + this.js.deleteJob(id).subscribe(data => { + window.location.reload(); + }); } }); } diff --git a/src/app/_services/jobs.service.ts b/src/app/_services/jobs.service.ts index 6d7a142b..bbdeea6b 100644 --- a/src/app/_services/jobs.service.ts +++ b/src/app/_services/jobs.service.ts @@ -99,6 +99,9 @@ export class JobsService { ) } + deleteJob(jobId){ + return this.http.delete(`${this.jobsURL}/${jobId}`); + } } From dc09572a60f884f1302607d6b0a3b27cc98ead8b Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Thu, 21 May 2020 12:51:33 +0100 Subject: [PATCH 08/13] making smart badge component compatible with user service --- .../award-smart-badge/award-smart-badge.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/_components/award-smart-badge/award-smart-badge.component.ts b/src/app/_components/award-smart-badge/award-smart-badge.component.ts index 89e43bc1..a3577986 100644 --- a/src/app/_components/award-smart-badge/award-smart-badge.component.ts +++ b/src/app/_components/award-smart-badge/award-smart-badge.component.ts @@ -168,7 +168,7 @@ export class awardDialog_modal implements OnInit { }); this.us - .getUser(this.data.userId).subscribe( + .getUser(String(this.data.userId)).subscribe( data => { console.log("user in db"); }, From bcabd3f41c5403784f9654ec2417a6d7e1580503 Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Fri, 22 May 2020 15:22:02 +0100 Subject: [PATCH 09/13] Typo fixing --- .../jobs-add/jobs-add.component.html | 2 +- .../jobs-add/jobs-add.component.ts | 20 +++++++++---------- src/app/_components/jobs/jobs.component.ts | 2 +- .../recruitment/recruitment.component.ts | 1 + src/app/_models/Job.ts | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/app/_components/jobs-add/jobs-add.component.html b/src/app/_components/jobs-add/jobs-add.component.html index 1475a9b0..2d2cee0f 100644 --- a/src/app/_components/jobs-add/jobs-add.component.html +++ b/src/app/_components/jobs-add/jobs-add.component.html @@ -81,7 +81,7 @@

{{ 'JOBS.TITLE' | translate }} - Create<
-
+

{{ 'JOB.SKILL.TITLE' | translate }} {{i + 1}}

diff --git a/src/app/_components/jobs-add/jobs-add.component.ts b/src/app/_components/jobs-add/jobs-add.component.ts index d525815c..f51a708e 100644 --- a/src/app/_components/jobs-add/jobs-add.component.ts +++ b/src/app/_components/jobs-add/jobs-add.component.ts @@ -56,7 +56,7 @@ export class JobsAddComponent implements OnInit { employmentType: ['', Validators.required ], level: ['', Validators.required ], JobDescription: ['', Validators.required ], - SkillReq: this.fb.array([ this.initSkill() ]) + skillReq: this.fb.array([ this.initSkill() ]) }); */ @@ -72,17 +72,17 @@ export class JobsAddComponent implements OnInit { addSkill() { // add skill to the skills list - //this.control = this.angForm.controls['SkillReq']; + //this.control = this.angForm.controls['skillReq']; //this.control.push(this.initSkill()); let newJobSkill = {} as JobSkill; newJobSkill.SkillLabel = ""; //newJobSkill.assign = ""; //newJobSkill.priority = ""; newJobSkill.proficiencyLevel = ""; - if (!this.dataIn.SkillReq) { - this.dataIn.SkillReq = [newJobSkill]; + if (!this.dataIn.skillReq) { + this.dataIn.skillReq = [newJobSkill]; } else { - this.dataIn.SkillReq.push(newJobSkill); + this.dataIn.skillReq.push(newJobSkill); } @@ -90,9 +90,9 @@ export class JobsAddComponent implements OnInit { removeSkill(i: number) { // remove address from the list - //this.control = this.angForm.controls['SkillReq']; + //this.control = this.angForm.controls['skillReq']; //this.control.removeAt(i); - this.dataIn.SkillReq.splice(i, 1); + this.dataIn.skillReq.splice(i, 1); } addJob() { @@ -135,7 +135,7 @@ export class JobsAddComponent implements OnInit { console.log("loadDataJob"); if (!dataObject) { - this.dataIn = {id: null, Label: "DEMO FE developer", JobLocation: "department1", employmentType:"", level:"",JobDescription:"",startDate: "",endDate: "",SkillReq:[]}; + this.dataIn = {id: null, Label: "DEMO FE developer", JobLocation: "department1", employmentType:"", level:"",JobDescription:"",startDate: "",endDate: "",skillReq:[]}; } else { @@ -146,7 +146,7 @@ export class JobsAddComponent implements OnInit { /* for (let i=1; ithis.angForm.controls['SkillReq']; + this.control = this.angForm.controls['skillReq']; this.control.push(this.initSkill()); } */ @@ -157,7 +157,7 @@ export class JobsAddComponent implements OnInit { ngOnInit() { - this.dataIn = {id: null, Label: null, employmentType:"", level:"",JobDescription:"",JobLocation:"",startDate: "",endDate: "",SkillReq:[]}; + this.dataIn = {id: null, Label: null, employmentType:"", level:"",JobDescription:"",JobLocation:"",startDate: "",endDate: "",skillReq:[]}; this.route.params.subscribe(params => { const id = +params.id; this.mode = ""; diff --git a/src/app/_components/jobs/jobs.component.ts b/src/app/_components/jobs/jobs.component.ts index 895c1c73..eed82ee0 100644 --- a/src/app/_components/jobs/jobs.component.ts +++ b/src/app/_components/jobs/jobs.component.ts @@ -19,7 +19,7 @@ export interface AvailableJobs { employmentType: string; level: string; JobDescription: string; - SkillReq: any + skillReq: any } /* const ELEMENT_DATA: AvailableJobs[] = [ diff --git a/src/app/_components/recruitment/recruitment.component.ts b/src/app/_components/recruitment/recruitment.component.ts index c63ac2ec..03624fd7 100644 --- a/src/app/_components/recruitment/recruitment.component.ts +++ b/src/app/_components/recruitment/recruitment.component.ts @@ -163,6 +163,7 @@ export class RecruitmentComponent implements OnInit { getAvailableJobs() { this.jobService.getJobs() .subscribe((data: Job[]) => { + console.log("sssssssssssssssssssssssssss"); this.jobs = data; console.log(data); }, diff --git a/src/app/_models/Job.ts b/src/app/_models/Job.ts index 8df6aff5..ff1cccac 100644 --- a/src/app/_models/Job.ts +++ b/src/app/_models/Job.ts @@ -26,7 +26,7 @@ export class JobSkill { JobDescription: String; JobLocation: String; // SkillReq?: string []; - SkillReq: JobSkill []; + skillReq: JobSkill []; startDate: string; endDate: string; /* id: number; From 4b0f78e91873261948742a123c7bffcf508acc80 Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Fri, 22 May 2020 16:11:18 +0100 Subject: [PATCH 10/13] Adopting Job view with the BE --- .../_components/jobs-add/jobs-add.component.html | 14 +++++++------- src/app/_components/jobs-add/jobs-add.component.ts | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/_components/jobs-add/jobs-add.component.html b/src/app/_components/jobs-add/jobs-add.component.html index 2d2cee0f..378352b1 100644 --- a/src/app/_components/jobs-add/jobs-add.component.html +++ b/src/app/_components/jobs-add/jobs-add.component.html @@ -9,19 +9,19 @@

{{ 'JOBS.TITLE' | translate }} - Create< {{ 'JOB.TITLE.LABEL' | translate }} - +
Description - +
Location - +
@@ -45,7 +45,7 @@

{{ 'JOBS.TITLE' | translate }} - Create< {{ 'JOB.EMPLOYMENT_TYPE.LABEL' | translate }} - + {{ 'JOB.EMPLOYMENT_TYPE.OPTIONS.FULL_TIME' | translate }} {{ 'JOB.EMPLOYMENT_TYPE.OPTIONS.PART_TIME' | translate }} {{ 'JOB.EMPLOYMENT_TYPE.OPTIONS.CONTRACT' | translate }} @@ -58,7 +58,7 @@

{{ 'JOBS.TITLE' | translate }} - Create< {{ 'JOB.EMPLOYMENT_LEVEL.LABEL' | translate }} - + {{ 'JOB.EMPLOYMENT_LEVEL.OPTIONS.INTERNERSHIP' | translate }} {{ 'JOB.EMPLOYMENT_LEVEL.OPTIONS.ENTITY_LEVEL' | translate }} {{ 'JOB.EMPLOYMENT_LEVEL.OPTIONS.ASSOCIATE' | translate }} @@ -89,7 +89,7 @@

{{ 'JOB.SKILL.TITLE' | translate }} {{i + 1}}

{{ 'JOB.SKILL.NAME.LABEL' | translate }} - +
@@ -112,7 +112,7 @@

{{ 'JOB.SKILL.TITLE' | translate }} {{i + 1}}

{{ 'JOB.SKILL.PRIORITY.LABEL' | translate }} - + {{ 'JOB.SKILL.PRIORITY.OPTIONS.LOW' | translate }} {{ 'JOB.SKILL.PRIORITY.OPTIONS.MEDIUM' | translate }} {{ 'JOB.SKILL.PRIORITY.OPTIONS.HIGH' | translate }} diff --git a/src/app/_components/jobs-add/jobs-add.component.ts b/src/app/_components/jobs-add/jobs-add.component.ts index f51a708e..22f4b08c 100644 --- a/src/app/_components/jobs-add/jobs-add.component.ts +++ b/src/app/_components/jobs-add/jobs-add.component.ts @@ -139,6 +139,7 @@ export class JobsAddComponent implements OnInit { } else { + console.log(dataObject); this.dataIn = dataObject; } @@ -159,9 +160,9 @@ export class JobsAddComponent implements OnInit { this.dataIn = {id: null, Label: null, employmentType:"", level:"",JobDescription:"",JobLocation:"",startDate: "",endDate: "",skillReq:[]}; this.route.params.subscribe(params => { - const id = +params.id; + const id = params.id; this.mode = ""; - if (id && id > 0) { + if (id ) { this.mode = "Edit"; this.jobId=String(id); //console.log(this.jobId); From 5ca5f766f7e78a70af89663b28456ec7b3ae7f8e Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Fri, 22 May 2020 18:40:50 +0100 Subject: [PATCH 11/13] change all the properties to lowercase change all the properties to lowercase --- src/app/_components/jobs-add/jobs-add.component.html | 2 +- src/app/_components/jobs-add/jobs-add.component.ts | 6 +++--- src/app/_components/jobs/jobs.component.html | 4 ++-- src/app/_models/Job.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/_components/jobs-add/jobs-add.component.html b/src/app/_components/jobs-add/jobs-add.component.html index 378352b1..fafc879d 100644 --- a/src/app/_components/jobs-add/jobs-add.component.html +++ b/src/app/_components/jobs-add/jobs-add.component.html @@ -112,7 +112,7 @@

{{ 'JOB.SKILL.TITLE' | translate }} {{i + 1}}

{{ 'JOB.SKILL.PRIORITY.LABEL' | translate }} - + {{ 'JOB.SKILL.PRIORITY.OPTIONS.LOW' | translate }} {{ 'JOB.SKILL.PRIORITY.OPTIONS.MEDIUM' | translate }} {{ 'JOB.SKILL.PRIORITY.OPTIONS.HIGH' | translate }} diff --git a/src/app/_components/jobs-add/jobs-add.component.ts b/src/app/_components/jobs-add/jobs-add.component.ts index 22f4b08c..febf9506 100644 --- a/src/app/_components/jobs-add/jobs-add.component.ts +++ b/src/app/_components/jobs-add/jobs-add.component.ts @@ -103,7 +103,7 @@ export class JobsAddComponent implements OnInit { this.js.addJob(dataToSend).subscribe( res => { - //console.log("Job created"); + console.log("Job created"); //console.log(res); //after update the job window.location.href="/jobs"; @@ -135,7 +135,7 @@ export class JobsAddComponent implements OnInit { console.log("loadDataJob"); if (!dataObject) { - this.dataIn = {id: null, Label: "DEMO FE developer", JobLocation: "department1", employmentType:"", level:"",JobDescription:"",startDate: "",endDate: "",skillReq:[]}; + this.dataIn = {id: null, label: "DEMO FE developer", jobLocation: "department1", employmentType:"", level:"",jobDescription:"",startDate: "",endDate: "",skillReq:[]}; } else { @@ -158,7 +158,7 @@ export class JobsAddComponent implements OnInit { ngOnInit() { - this.dataIn = {id: null, Label: null, employmentType:"", level:"",JobDescription:"",JobLocation:"",startDate: "",endDate: "",skillReq:[]}; + this.dataIn = {id: null, label: null, employmentType:"", level:"",jobDescription:"",jobLocation:"",startDate: "",endDate: "",skillReq:[]}; this.route.params.subscribe(params => { const id = params.id; this.mode = ""; diff --git a/src/app/_components/jobs/jobs.component.html b/src/app/_components/jobs/jobs.component.html index dcbe61ee..d9777fe3 100644 --- a/src/app/_components/jobs/jobs.component.html +++ b/src/app/_components/jobs/jobs.component.html @@ -40,13 +40,13 @@

{{ 'JOBS.TITLE' | translate }}

-   - diff --git a/src/app/_models/Job.ts b/src/app/_models/Job.ts index ff1cccac..7dd93c7b 100644 --- a/src/app/_models/Job.ts +++ b/src/app/_models/Job.ts @@ -20,11 +20,11 @@ export class JobSkill { export class Job { id: string; - Label: string; // Position + label: string; // Position employmentType: string; level: string; // Seniority Level - JobDescription: String; - JobLocation: String; + jobDescription: String; + jobLocation: String; // SkillReq?: string []; skillReq: JobSkill []; startDate: string; From 1f3126776906a13a064cd115d6e38e9862801ec5 Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Mon, 25 May 2020 11:41:33 +0100 Subject: [PATCH 12/13] Update User service Cors problem --- src/app/_services/users.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/_services/users.service.ts b/src/app/_services/users.service.ts index aac804df..fe6c526f 100644 --- a/src/app/_services/users.service.ts +++ b/src/app/_services/users.service.ts @@ -28,7 +28,7 @@ export class UsersService { addUser(obj: Object) { - return this.http.post(`${this.uriUsers}`, obj). + return this.http.post(`${this.uriUsers}`, JSON.stringify(obj)). pipe( map((data: any) => { return data; From 7ca036d153680bef31f94c08a1d6a2e4ae2e65de Mon Sep 17 00:00:00 2001 From: "Ahmad@KBZ" <58338491+mehrbodKBZ@users.noreply.github.com> Date: Mon, 25 May 2020 12:06:18 +0100 Subject: [PATCH 13/13] remove log --- src/app/_components/recruitment/recruitment.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/_components/recruitment/recruitment.component.ts b/src/app/_components/recruitment/recruitment.component.ts index 03624fd7..c63ac2ec 100644 --- a/src/app/_components/recruitment/recruitment.component.ts +++ b/src/app/_components/recruitment/recruitment.component.ts @@ -163,7 +163,6 @@ export class RecruitmentComponent implements OnInit { getAvailableJobs() { this.jobService.getJobs() .subscribe((data: Job[]) => { - console.log("sssssssssssssssssssssssssss"); this.jobs = data; console.log(data); },