Remove Veteran, Allow Millitary to be NULL
This commit is contained in:
@@ -14,7 +14,7 @@ export class Resume {
|
||||
public city: string = "";
|
||||
public isActive: boolean = false;
|
||||
public experience: ResumeExperience[] = [];
|
||||
public military: ResumeMilitary = new ResumeMilitary;
|
||||
public military: ResumeMilitary | null = new ResumeMilitary;
|
||||
public education: ResumeEducation[] = [];
|
||||
public skills: ResumeSkill[] = [];
|
||||
public languages: ResumeLanguage[] = [];
|
||||
@@ -53,7 +53,6 @@ export class ResumeMilitary {
|
||||
public id: number | null = null;
|
||||
public resumeID: number | null = null;
|
||||
|
||||
public veteran: boolean = false;
|
||||
public country: string = "";
|
||||
public rank: string = "";
|
||||
public dateStarted: Date = new Date();
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
|
||||
<!-- Military -->
|
||||
<div class="resume-section">
|
||||
<h1>Is Veteran: </h1><input name="veteran" [(ngModel)]="resume.military.veteran" type="checkbox" />
|
||||
@if(resume.military.veteran){
|
||||
<h1>Is Veteran: </h1><input name="veteran" type="checkbox" (change)="onVeteranChange($event)" />
|
||||
@if(resume.military !== null){
|
||||
<input name="militarycountry" [(ngModel)]="resume.military.country" type="text" placeholder="US" />
|
||||
<input name="militaryrank" [(ngModel)]="resume.military.rank" type="text" placeholder="PVT" />
|
||||
<input name="militarydateStarted" [(ngModel)]="resume.military.dateStarted" type="date" />
|
||||
|
||||
@@ -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 { Resume, ResumeCertification, ResumeEducation, ResumeExperience, ResumeExperienceBullet, ResumeLanguage, ResumeMilitaryBullet, ResumeProject, ResumeSkill } from 'app/models/Resume';
|
||||
import { Resume, ResumeCertification, ResumeEducation, ResumeExperience, ResumeExperienceBullet, ResumeLanguage, ResumeMilitary, ResumeMilitaryBullet, ResumeProject, ResumeSkill } from 'app/models/Resume';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
import { HomeComponent } from "app/pages/home/home.component";
|
||||
|
||||
@@ -33,6 +33,7 @@ export class ResumesEditorComponent {
|
||||
this.http.get<Resume>("api/resume?ResumeID=" + ResumeID).subscribe({
|
||||
next: data => {
|
||||
this.resume = data;
|
||||
this.milCache = data.military;
|
||||
this.isNewResume = false;
|
||||
},
|
||||
error: err => {
|
||||
@@ -81,15 +82,27 @@ export class ResumesEditorComponent {
|
||||
}
|
||||
}
|
||||
|
||||
milCache: ResumeMilitary | null = new ResumeMilitary;
|
||||
onVeteranChange(event: Event){
|
||||
const checkbox = event.target as HTMLInputElement;
|
||||
const isChecked = checkbox.checked;
|
||||
if (isChecked){
|
||||
this.resume.military = this.milCache;
|
||||
} else {
|
||||
this.resume.military = null;
|
||||
}
|
||||
}
|
||||
addMillitaryBullet(){
|
||||
this.resume.military.millitaryBullets.push( new ResumeMilitaryBullet );
|
||||
this.resume.military?.millitaryBullets.push( new ResumeMilitaryBullet );
|
||||
}
|
||||
delMillitaryBullet(self: ResumeMilitaryBullet){
|
||||
for(let i=0; i<this.resume.military.millitaryBullets.length; i++){
|
||||
let cur = this.resume.military.millitaryBullets[i];
|
||||
if (cur.trackUUID === self.trackUUID){
|
||||
this.resume.military.millitaryBullets.splice( i, 1 );
|
||||
break;
|
||||
if (this.resume.military !== null){
|
||||
for(let i=0; i<this.resume.military.millitaryBullets.length; i++){
|
||||
let cur = this.resume.military.millitaryBullets[i];
|
||||
if (cur.trackUUID === self.trackUUID){
|
||||
this.resume.military.millitaryBullets.splice( i, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user