diff --git a/src/Client/src/app/pages/jobs/viewer/jobviewer.component.html b/src/Client/src/app/pages/jobs/viewer/jobviewer.component.html index 2e2b560..f5610f9 100644 --- a/src/Client/src/app/pages/jobs/viewer/jobviewer.component.html +++ b/src/Client/src/app/pages/jobs/viewer/jobviewer.component.html @@ -58,6 +58,13 @@

{{ selectedJob.description }}

+
+ @for(resume of myResumes; track resume.trackUUID){ +
+ +
+ } +
} \ No newline at end of file diff --git a/src/Client/src/app/pages/jobs/viewer/jobviewer.component.ts b/src/Client/src/app/pages/jobs/viewer/jobviewer.component.ts index e22ae7f..452db25 100644 --- a/src/Client/src/app/pages/jobs/viewer/jobviewer.component.ts +++ b/src/Client/src/app/pages/jobs/viewer/jobviewer.component.ts @@ -7,6 +7,8 @@ import { CommonModule } from '@angular/common'; import { Authentication } from 'app/services/Authentication'; import { JobListing } from 'app/models/JobListing'; import { Company } from 'app/models/Company'; +import { Resume } from 'app/models/Resume'; +import { Application } from 'app/models/Application'; @Component({ selector: 'main-jobs-viewer', @@ -17,9 +19,12 @@ import { Company } from 'app/models/Company'; export class JobViewerComponent { public selectedJob: JobListing | null = null; + public myResumes: Resume[] = []; public jobsCompany: Company | null = null; public ErrorMsg: string = ""; + JobListingID: number = -1; + constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) { this.title.setTitle("Jobs - Viewer | BoredCareers"); }; @@ -27,7 +32,8 @@ export class JobViewerComponent { ngOnInit(){ this.route.queryParams.subscribe(params => { const JobID = params['JobID']; - if (JobID){ + if (JobID) { + this.JobListingID = JobID; this.http.get( "api/joblisting/" + JobID ).subscribe({ next: data => { this.selectedJob = data; @@ -51,6 +57,41 @@ export class JobViewerComponent { } }); + + this.http.get("api/resume").subscribe({ + next: data => { + this.myResumes = data; + }, + error: err => { + console.log("Error fetching resumes: " + err.error); + } + }); + } + + applyWithResume(resume: Resume) { + var application = new Application; + + if (this.auth.loggedInUser.id != null){ + application.accountID = this.auth.loggedInUser.id; + } + + if (resume.id != null){ + application.resumeID = resume.id; + } + + application.jobListingID = this.JobListingID; + application.hasBeenViewed = false; + application.responseEmail = resume.email; + + this.http.post("api/application", application).subscribe({ + next: data => { + this.router.navigate(["/"]); + }, + error: err => { + this.ErrorMsg = err.error; + } + }); + } } \ No newline at end of file