Commit 8163f7e3 by Muhammad Usman

education tab fixes on no education

parent 9c1d2588
......@@ -40,7 +40,7 @@
<div class="col-md-6 form-group">
<label>Where Studied</label>
<app-form-control>
<p-autoComplete [suggestions]="filterStudied" (completeMethod)="suggestedStudiedAt($event)" placeholder="Where studied" name="WhereStudied{{i}}" [(ngModel)]="education.WhereStudied" required>
<p-autoComplete [suggestions]="filterStudied" (completeMethod)="suggestedStudiedAt($event)" placeholder="Where studied" name="WhereStudied{{i}}" [(ngModel)]="education.WhereStudied">
</p-autoComplete>
</app-form-control>
</div>
......
......@@ -66,7 +66,7 @@ export class EducationComponent extends BaseComponent implements OnInit {
})
}
this.utilsService.addObjsToJSONByObjectID(this.updatedObjs, this.careerProfile.EducationCertificates);
if (this.careerProfile.EducationCertificates.length === 0 && !this.careerProfile.NoEducationQualification) {
if ((!this.careerProfile.EducationCertificates || this.careerProfile.EducationCertificates.length === 0) && !this.careerProfile.NoEducationQualification) {
for (let i = 0; i < this.careerProfile.NoOfQualifications || 0; i++) {
this.addEducation(true);
}
......
......@@ -42,6 +42,7 @@ export const SERVICES = {
SAVE_WORKFLOW: 'SaveWorkFlowTemplate',
SAVE: 'Save',
CAREER_PROFILES: 'CareerProfiles',
CLONE_CAREER_PROFILES: 'CloneCareerProfile',
JOB_TITLES: 'JobTitles',
SKILLS: 'Skills',
EMPLOYERS: 'Employers',
......
......@@ -94,6 +94,7 @@ export class IntroLetterComponent extends BaseComponent implements OnInit {
}
initialProcessing(): void {
if (this.careerProfile.WorkExperiences) {
this.careerProfile.WorkExperiences.forEach((w, i) => {
const ilWorkExperience = new ILWorkExperienceModel();
ilWorkExperience.IntroductionLetter = this.introductionLetter.ObjectID;
......@@ -102,6 +103,8 @@ export class IntroLetterComponent extends BaseComponent implements OnInit {
ilWorkExperience.IsSelected = true;
this.utilsService.addMultiRefObject(ilWorkExperience, this.introductionLetter, 'WorkExperiences', this.createdObjs);
});
}
if (this.careerProfile.Skills) {
this.careerProfile.Skills.forEach((s, i) => {
const ilSkillModel = new ILSkillModel();
ilSkillModel.IntroductionLetter = this.introductionLetter.ObjectID;
......@@ -111,6 +114,7 @@ export class IntroLetterComponent extends BaseComponent implements OnInit {
this.utilsService.addMultiRefObject(ilSkillModel, this.introductionLetter, 'Skills', this.createdObjs);
});
}
}
saveIntroLetter(): void {
if (this.form.invalid) {
......
......@@ -4,6 +4,10 @@
<div class="mc-page-header-logo">
<img src="assets/my-career-web/images/MATCHD_LOGO.jpg" alt="">
</div>
<div class="mc-page-header-action">
<button pButton label="Exit" routerLink="/my-career-web/jobs" class="ui-button-info"></button>
</div>
</div>
<div class="mc-page-body container">
......@@ -65,7 +69,7 @@
<div class="row">
<div class="col-md-6 profile-option-wrapper">
<div class="profile-option selected">
<div class="profile-option" [ngClass]="{'selected' : selectedProfileType === 'same'}" (click)="selectedProfileType = 'same'">
<div class="mb-4">Use My Profile</div>
<button class="mc-btn-secondary" pButton label="Preview Profile"></button>
......@@ -73,15 +77,15 @@
</div>
<div class="col-md-6 profile-option-wrapper">
<div class="profile-option">
<div class="profile-option" [ngClass]="{'selected' : selectedProfileType === 'customize'}" (click)="selectedProfileType = 'customize'">
Customize My Profile
</div>
</div>
<div class="col-md-12 mt-4 profile-actions">
<button class="mc-btn-primary" pButton label="Save and Exit"></button>
<button class="mc-btn-primary" pButton label="Save and Exit" (click)="saveApplicantJob(true)"></button>
<button class="mc-btn-primary" pButton label="Next"></button>
<button class="mc-btn-primary" pButton label="Next" (click)="saveApplicantJob()"></button>
</div>
</div>
......
......@@ -19,13 +19,14 @@ import { CareerProfileModel } from '../../../models/career-profile.model';
export class JobDetailsComponent extends BaseComponent implements OnInit {
applicantJob: ApplicantJobModel = new ApplicantJobModel();
careerProfile: CareerProfileModel = new CareerProfileModel();
clonedCareerProfile: CareerProfileModel = new CareerProfileModel();
applicantJobId;
isLoadingJobLocations = false;
jobPostLocations = [];
detailStep = 1;
selectedProfileType: 'same' | 'customize' = 'same';
@ViewChild('form') form: NgForm;
......@@ -50,22 +51,33 @@ export class JobDetailsComponent extends BaseComponent implements OnInit {
this.applicantJobId = params.id;
}
});
this.getCareerProfile();
this.getCloneCareerProfileID();
this.getJobPostLocations();
}
getCareerProfile(): void {
getCloneCareerProfileID(): void {
this.isLoading = true;
this.personalDetailsService.getCareerProfile()
this.personalDetailsService.getCloneCareerProfile()
.pipe(takeUntil(this.componentInView))
.subscribe(cloneProfileID => {
this.getCareerProfile(cloneProfileID);
}, err => {
this.isLoading = false;
this.utilsService.handleError(err);
});
}
getCareerProfile(id): void {
this.personalDetailsService.getCareerProfileById(id, [])
.pipe(takeUntil(this.componentInView))
.subscribe(response => {
this.isLoading = false;
this.careerProfile = response;
this.clonedCareerProfile = response;
this.initiateApplicantJob();
}, err => {
this.isLoading = false;
this.utilsService.handleError(err);
})
});
}
initiateApplicantJob(): void {
......@@ -73,7 +85,7 @@ export class JobDetailsComponent extends BaseComponent implements OnInit {
this.getApplicantJob()
} else {
this.applicantJob = new ApplicantJobModel();
this.applicantJob.Candidate = this.careerProfile.Candidate;
this.applicantJob.Candidate = this.clonedCareerProfile.Candidate;
this.utilsService.createObject(this.applicantJob, this.createdObjs)
}
}
......@@ -84,7 +96,8 @@ export class JobDetailsComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this.componentInView))
.subscribe(response => {
this.isLoading = false;
console.log(response);
this.applicantJob = response;
this.updatedObjs[this.applicantJob.ObjectID] = this.applicantJob;
}, err => {
this.utilsService.handleError(err);
this.isLoading = false;
......@@ -108,22 +121,33 @@ export class JobDetailsComponent extends BaseComponent implements OnInit {
if (this.form.invalid) {
return this.helperService.validateAllFormFields(this.form);
}
if (!this.isEditMode) {
this.detailStep = 2;
} else {
this.saveApplicantJob();
}
}
saveApplicantJob(): void {
// this.isLoading = true;
// this.jobService.saveApplicantJob(this.createdObjs, this.updatedObjs, this.deletedObjs)
// .pipe(takeUntil(this.componentInView))
// .subscribe(response => {
// this.isLoading = false;
// this.toastService.success('Job saved');
// console.log(response);
// // this.router.navigate([`my-career-web/intro-letters`])
// }, err => {
// this.utilsService.handleError(err);
// this.isLoading = false;
// });
saveApplicantJob(exit = false): void {
this.isLoading = true;
this.jobService.saveApplicantJob(this.createdObjs, this.updatedObjs, this.deletedObjs)
.pipe(takeUntil(this.componentInView))
.subscribe(() => {
this.isLoading = false;
this.toastService.success(this.isEditMode ? 'Job updated.' : 'Job saved.');
if (exit) {
this.router.navigate([`my-career-web/jobs`]);
} else {
if (this.selectedProfileType === 'customize' || this.isEditMode) {
console.log('REDIRECT PERSONAL');
} else if (this.selectedProfileType === 'same') {
console.log('REDIRECT TO LETTER');
}
}
}, err => {
this.utilsService.handleError(err);
this.isLoading = false;
});
}
}
......@@ -9,5 +9,6 @@ export class ApplicantJobModel extends BaseModel {
ApplicantJobStatus: string;
JobPostedLocation: any;
Candidate: any;
CareerProfile: any;
JobStatus: any;
}
......@@ -5,7 +5,7 @@ import { SaveService } from '../../oneit/services/save.service';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
import { SERVICES } from '../config/constants';
import { JobApplicationModel } from '../../models/job-application.model';
import { ApplicantJobModel } from '../models/applicant-job.model';
@Injectable()
......@@ -29,7 +29,7 @@ export class JobService {
)
}
getApplicantJob(id, assocs = []): Observable<JobApplicationModel> {
getApplicantJob(id, assocs = []): Observable<ApplicantJobModel> {
return this.searchService.getObjects(SERVICES.APPLICANT_TALENT_JOBS, 'ByID', {id: id}, assocs, null, null, null, null)
.map(
data => {
......
......@@ -105,6 +105,24 @@ export class PersonalDetailsService {
)
}
getCareerProfileById(id, assocs = []): Observable<CareerProfileModel> {
return this.searchService.getObjects(SERVICES.CAREER_PROFILES, 'ByID', {id: id}, assocs, null, null, null, null)
.map(
data => {
return this.utilsService.convertResponseToObjects(data, assocs)[0];
}
)
}
getCloneCareerProfile(): Observable<number> {
return this.searchService.getObjects(SERVICES.CLONE_CAREER_PROFILES, 'All', {}, [], null, null, null, null)
.map(
data => {
return data.ClonedCareerFrofileID
}
)
}
saveProfile(createdObjs, updatedObjs, deletedObjs): Observable<any> {
return this.saveService.saveObjects('svc/SavePersonalDetails',createdObjs, updatedObjs, deletedObjs);
}
......
......@@ -98,6 +98,10 @@ label.with-help-text {
height: 32px;
}
}
&-action {
margin-right: 5%;
}
}
&-body {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment