Code Cleanup
This commit is contained in:
@@ -5,8 +5,9 @@ import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
import { Company, Employee } from 'app/models/Company';
|
||||
import { Company } from 'app/models/Company';
|
||||
import { JobListing } from 'app/models/JobListing';
|
||||
import { Employee } from 'app/models/Employee';
|
||||
|
||||
@Component({
|
||||
selector: 'main-company',
|
||||
@@ -20,6 +21,7 @@ export class CompanyComponent {
|
||||
public Employers: Employee[] = [];
|
||||
|
||||
public Comp: Company | null = null;
|
||||
public CompEmployees: Employee[] = [];
|
||||
public Desc: string[] = [];
|
||||
|
||||
public List: JobListing[] = [];
|
||||
@@ -39,7 +41,6 @@ export class CompanyComponent {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
changeSelectedCompany(companyID: number){
|
||||
@@ -61,6 +62,15 @@ export class CompanyComponent {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
|
||||
this.http.get<Employee[]>("api/employee/" + companyID).subscribe({
|
||||
next: data => {
|
||||
this.CompEmployees = data;
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RemoveJobListing( JobListingID: number ){
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { JobListing } from 'app/models/JobListing';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
import { Company, Employee } from 'app/models/Company';
|
||||
|
||||
@Component({
|
||||
selector: 'main-jobs-editor',
|
||||
@@ -85,35 +84,20 @@ export class JobEditorComponent {
|
||||
this.updateUI();
|
||||
}
|
||||
|
||||
PostNewJob(jobListing: JobListing){
|
||||
jobListing.companyID = this.modeID;
|
||||
this.http.post("api/joblisting", jobListing).subscribe({
|
||||
next: data => {
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PostEditJob(jobListing: JobListing){
|
||||
this.http.post("api/joblisting", jobListing).subscribe({
|
||||
next: data => {
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SubmitForm(job: JobListing){
|
||||
SubmitForm(jobListing: JobListing){
|
||||
if (this.mode === "new"){
|
||||
this.PostNewJob(job);
|
||||
}else if (this.mode === "edit"){
|
||||
this.PostEditJob(job);
|
||||
jobListing.companyID = this.modeID;
|
||||
} else if (this.mode === "edit"){
|
||||
jobListing.id = this.modeID;
|
||||
}
|
||||
this.http.post("api/joblisting", jobListing).subscribe({
|
||||
next: data => {
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,15 +39,4 @@ export class JobsComponent {
|
||||
|
||||
};
|
||||
|
||||
RemoveJobListing( JobListingID: number ){
|
||||
this.http.delete("api/joblisting?JobListingID=" + JobListingID).subscribe({
|
||||
next: data => {
|
||||
window.location.reload();
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user