From d2536c1749a10e0ff389cdf530972618ea338ff2 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Sun, 20 Jul 2025 22:08:41 -0700 Subject: [PATCH] Get New Job Listing Functional --- .../app/pages/main/jobs/jobs.component.css | 6 ++++++ .../app/pages/main/jobs/jobs.component.html | 2 +- .../pages/main/jobs/new/jobnew.component.html | 16 ++++++++++++++ .../pages/main/jobs/new/jobnew.component.ts | 21 +++++++++++++++++-- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/Client/src/app/pages/main/jobs/jobs.component.css b/src/Client/src/app/pages/main/jobs/jobs.component.css index 9d97a2c..58f3098 100644 --- a/src/Client/src/app/pages/main/jobs/jobs.component.css +++ b/src/Client/src/app/pages/main/jobs/jobs.component.css @@ -1,3 +1,9 @@ +.full-width { + display: block; + width: 100%; + column-count: 2; +} + .tile-frame { column-count: 4; column-gap: 20px; diff --git a/src/Client/src/app/pages/main/jobs/jobs.component.html b/src/Client/src/app/pages/main/jobs/jobs.component.html index 5c422ac..f3c49a0 100644 --- a/src/Client/src/app/pages/main/jobs/jobs.component.html +++ b/src/Client/src/app/pages/main/jobs/jobs.component.html @@ -19,7 +19,7 @@
- +
diff --git a/src/Client/src/app/pages/main/jobs/new/jobnew.component.html b/src/Client/src/app/pages/main/jobs/new/jobnew.component.html index 949fd56..d6e9e90 100644 --- a/src/Client/src/app/pages/main/jobs/new/jobnew.component.html +++ b/src/Client/src/app/pages/main/jobs/new/jobnew.component.html @@ -2,12 +2,28 @@

POST A NEW JOB

+ + +
+
+
+ + + +
+
+
+
+
diff --git a/src/Client/src/app/pages/main/jobs/new/jobnew.component.ts b/src/Client/src/app/pages/main/jobs/new/jobnew.component.ts index 0d8a586..793424d 100644 --- a/src/Client/src/app/pages/main/jobs/new/jobnew.component.ts +++ b/src/Client/src/app/pages/main/jobs/new/jobnew.component.ts @@ -6,6 +6,7 @@ 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-new', @@ -18,11 +19,26 @@ export class JobNewComponent { @ViewChildren('step') formSteps!: QueryList>; currentStep: number = 0; + public employeeOfList: Employee[] = []; + public selectedCompany: Company = new Company; + public newListing: JobListing = new JobListing(); public ErrorMsg: string = ""; constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) { this.title.setTitle("Jobs - new | BoredCareers"); + + this.http.get("api/employee").subscribe({ + next: empOf => { + if (empOf.length === 0){ + router.navigate(["company/connect"]); + } + this.employeeOfList = empOf; + }, + error: err => { + this.ErrorMsg = err.error; + } + }); }; ngAfterViewInit(){ @@ -64,12 +80,13 @@ export class JobNewComponent { } PostJobListing(jobListing: JobListing){ + jobListing.companyID = this.selectedCompany.id; this.http.post("api/joblisting", jobListing).subscribe({ next: data => { - + this.router.navigate([""]); }, error: err => { - alert("Failed to create the job listing. Try again"); + this.ErrorMsg = err.error; } }); }