Add Job Listing Skills to Job Listing
This commit is contained in:
@@ -9,4 +9,5 @@ export class Application {
|
||||
public hasBeenViewed: boolean = false;
|
||||
public rating: number = 0;
|
||||
public notes: string = "";
|
||||
public trackUUID: string = crypto.randomUUID();
|
||||
}
|
||||
@@ -13,4 +13,5 @@ export class Company {
|
||||
public stateOrRegion: string = "";
|
||||
public city: string = "";
|
||||
public description: string = "";
|
||||
public trackUUID: string = crypto.randomUUID();
|
||||
}
|
||||
@@ -6,4 +6,5 @@ export class Employee {
|
||||
public accountName: string = "";
|
||||
public accountEmail: string = "";
|
||||
public company: Company = new Company;
|
||||
public trackUUID: string = crypto.randomUUID();
|
||||
}
|
||||
@@ -15,11 +15,13 @@ export class JobListing {
|
||||
public createdTime: Date = new Date();
|
||||
public modifiedTime: Date = new Date();
|
||||
public isDeleted: boolean = false;
|
||||
public trackUUID: string = crypto.randomUUID();
|
||||
}
|
||||
|
||||
export class JobListingSkills {
|
||||
public id: number | null = null;
|
||||
public jobListingID: number = 0;
|
||||
public name: string = "";
|
||||
public Description: string = "";
|
||||
public description: string = "";
|
||||
public trackUUID: string = crypto.randomUUID();
|
||||
}
|
||||
@@ -91,6 +91,27 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Skills -->
|
||||
<div #step class="sub-frame">
|
||||
<div class="center">
|
||||
<div class="content-frame">
|
||||
<label>Skills</label>
|
||||
<button type="button" (click)="addSkill()">+</button>
|
||||
</div>
|
||||
@for(skill of Listing.skills; track skill.trackUUID){
|
||||
<div class="content-frame">
|
||||
<input [name]="'skillname' + skill.trackUUID" [(ngModel)]="skill.name" type="text" />
|
||||
<textarea [name]="'skilldescription' + skill.trackUUID" [(ngModel)]="skill.description" type="text"></textarea>
|
||||
<button type="button" (click)="remSkill(skill)">-</button>
|
||||
</div>
|
||||
}
|
||||
<div class="content-frame">
|
||||
<button type="button" (click)="prevStep()">Back</button>
|
||||
<button type="button" (click)="nextStep()">Next</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Description -->
|
||||
<div #step class="sub-frame">
|
||||
<div class="center">
|
||||
|
||||
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
|
||||
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { JobListing } from 'app/models/JobListing';
|
||||
import { JobListing, JobListingSkills } from 'app/models/JobListing';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
|
||||
@Component({
|
||||
@@ -51,6 +51,9 @@ export class JobEditorComponent {
|
||||
if (this.mode === "edit") {
|
||||
this.http.get<JobListing>("api/joblisting/" + JobID).subscribe({
|
||||
next: data => {
|
||||
data.skills.forEach(element => {
|
||||
element.trackUUID = crypto.randomUUID();
|
||||
});
|
||||
this.Listing = data;
|
||||
},
|
||||
error: err => {
|
||||
@@ -80,6 +83,20 @@ export class JobEditorComponent {
|
||||
});
|
||||
}
|
||||
|
||||
addSkill(){
|
||||
this.Listing.skills.push(new JobListingSkills);
|
||||
}
|
||||
|
||||
remSkill(self: JobListingSkills){
|
||||
for(let i=0; i<this.Listing.skills.length; i++){
|
||||
let cur = this.Listing.skills[i];
|
||||
if (cur.trackUUID === self.trackUUID){
|
||||
this.Listing.skills.splice( i, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nextStep(){
|
||||
this.currentStep += 1;
|
||||
this.updateUI();
|
||||
|
||||
@@ -47,6 +47,16 @@
|
||||
<h1>{{ selectedJob.country }}</h1>
|
||||
<h1>{{ selectedJob.postalCode }}</h1>
|
||||
|
||||
<div>
|
||||
<h1>Required Skills</h1>
|
||||
@for(skill of selectedJob.skills; track skill.trackUUID){
|
||||
<div>
|
||||
<h1>{{ skill.name }}</h1>
|
||||
<h1>{{ skill.description }}</h1>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<h1>{{ selectedJob.description }}</h1>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -75,11 +75,6 @@ export class ResumesEditorComponent {
|
||||
});
|
||||
}
|
||||
|
||||
// Pagnation //
|
||||
////////////////////////////////
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
SubmitForm(resume: Resume){
|
||||
resume.accountID = this.auth.loggedInUser.id;
|
||||
this.http.post("api/resume", resume).subscribe({
|
||||
|
||||
@@ -228,6 +228,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
Description = @Description,
|
||||
ModifiedTime = @ModifiedTime,
|
||||
IsDeleted = @IsDeleted;
|
||||
|
||||
SELECT LAST_INSERT_ID();
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
@@ -247,9 +249,17 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
cmd.Parameters.AddWithValue("@ModifiedTime", DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("@IsDeleted", jobListing.IsDeleted);
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
object? result = await cmd.ExecuteScalarAsync();
|
||||
int jobListingID = 0;
|
||||
if (jobListing.ID != null && jobListing.ID != 0) {
|
||||
jobListingID = Convert.ToInt32(jobListing.ID);
|
||||
} else {
|
||||
cmd.CommandText = "";
|
||||
jobListingID = Convert.ToInt32(result);
|
||||
}
|
||||
|
||||
foreach (JobListingSkill cur in jobListing.Skills) {
|
||||
cur.JobListingID = jobListingID;
|
||||
await SetJobListingSkills(cur);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
await connection.OpenAsync();
|
||||
string command = @"
|
||||
INSERT INTO JobListing
|
||||
INSERT INTO JobListingSkill
|
||||
(ID,JobListingID,Name,Description)
|
||||
VALUES
|
||||
(@ID,@JobListingID,@Name,@Description)
|
||||
|
||||
Reference in New Issue
Block a user