working #36
@@ -58,6 +58,13 @@
|
||||
</div>
|
||||
|
||||
<h1>{{ selectedJob.description }}</h1>
|
||||
<div>
|
||||
@for(resume of myResumes; track resume.trackUUID){
|
||||
<div>
|
||||
<button type="button" (click)="applyWithResume(resume)">APPLY USING RESUME: {{ resume.name }}</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -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");
|
||||
};
|
||||
@@ -28,6 +33,7 @@ export class JobViewerComponent {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
const JobID = params['JobID'];
|
||||
if (JobID) {
|
||||
this.JobListingID = JobID;
|
||||
this.http.get<JobListing>( "api/joblisting/" + JobID ).subscribe({
|
||||
next: data => {
|
||||
this.selectedJob = data;
|
||||
@@ -51,6 +57,41 @@ export class JobViewerComponent {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
this.http.get<Resume[]>("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;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user