Add apply to job button
This commit is contained in:
@@ -58,6 +58,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>{{ selectedJob.description }}</h1>
|
<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>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -7,6 +7,8 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { Authentication } from 'app/services/Authentication';
|
import { Authentication } from 'app/services/Authentication';
|
||||||
import { JobListing } from 'app/models/JobListing';
|
import { JobListing } from 'app/models/JobListing';
|
||||||
import { Company } from 'app/models/Company';
|
import { Company } from 'app/models/Company';
|
||||||
|
import { Resume } from 'app/models/Resume';
|
||||||
|
import { Application } from 'app/models/Application';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'main-jobs-viewer',
|
selector: 'main-jobs-viewer',
|
||||||
@@ -17,9 +19,12 @@ import { Company } from 'app/models/Company';
|
|||||||
export class JobViewerComponent {
|
export class JobViewerComponent {
|
||||||
|
|
||||||
public selectedJob: JobListing | null = null;
|
public selectedJob: JobListing | null = null;
|
||||||
|
public myResumes: Resume[] = [];
|
||||||
public jobsCompany: Company | null = null;
|
public jobsCompany: Company | null = null;
|
||||||
public ErrorMsg: string = "";
|
public ErrorMsg: string = "";
|
||||||
|
|
||||||
|
JobListingID: number = -1;
|
||||||
|
|
||||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
|
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
|
||||||
this.title.setTitle("Jobs - Viewer | BoredCareers");
|
this.title.setTitle("Jobs - Viewer | BoredCareers");
|
||||||
};
|
};
|
||||||
@@ -27,7 +32,8 @@ export class JobViewerComponent {
|
|||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe(params => {
|
||||||
const JobID = params['JobID'];
|
const JobID = params['JobID'];
|
||||||
if (JobID){
|
if (JobID) {
|
||||||
|
this.JobListingID = JobID;
|
||||||
this.http.get<JobListing>( "api/joblisting/" + JobID ).subscribe({
|
this.http.get<JobListing>( "api/joblisting/" + JobID ).subscribe({
|
||||||
next: data => {
|
next: data => {
|
||||||
this.selectedJob = 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