Commit c5fd9b7f by Muhammad Usman

studied suggestions

parent 3c75de96
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
<div class="col-md-6 form-group"> <div class="col-md-6 form-group">
<label>Where Studied</label> <label>Where Studied</label>
<app-form-control> <app-form-control>
<input type="text" class="form-control" placeholder="Where studied" name="WhereStudied{{i}}" [(ngModel)]="education.WhereStudied"> <p-autoComplete [suggestions]="filterStudied" (completeMethod)="suggestedStudiedAt($event)" placeholder="Where studied" name="WhereStudied{{i}}" [(ngModel)]="education.WhereStudied" required>
</p-autoComplete>
</app-form-control> </app-form-control>
</div> </div>
......
...@@ -24,6 +24,8 @@ export class EducationComponent extends BaseComponent implements OnInit { ...@@ -24,6 +24,8 @@ export class EducationComponent extends BaseComponent implements OnInit {
apiUrl = environment.baseUrl; apiUrl = environment.baseUrl;
uploadingFile = false; uploadingFile = false;
certifications = []; certifications = [];
studied: string[] = [];
filterStudied = [];
@ViewChild('form') form: NgForm; @ViewChild('form') form: NgForm;
@Output() educationSaved = new EventEmitter(); @Output() educationSaved = new EventEmitter();
...@@ -41,6 +43,13 @@ export class EducationComponent extends BaseComponent implements OnInit { ...@@ -41,6 +43,13 @@ export class EducationComponent extends BaseComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.getCareerProfile(); this.getCareerProfile();
this.personalDetailsService.getStudied()
.pipe(takeUntil(this.componentInView))
.subscribe(response => {
this.studied = response.filter(s => !!s);
}, err => {
this.utilsService.handleError(err);
});
} }
getCareerProfile(): void { getCareerProfile(): void {
...@@ -65,6 +74,12 @@ export class EducationComponent extends BaseComponent implements OnInit { ...@@ -65,6 +74,12 @@ export class EducationComponent extends BaseComponent implements OnInit {
}) })
} }
suggestedStudiedAt($event): void {
setTimeout(() => {
this.filterStudied = $event.query ? this.studied.filter(s => s.startsWith($event.query)) : this.studied.slice();
});
}
addEducation(initLoad = false): void { addEducation(initLoad = false): void {
const newModel = new EducationModel(); const newModel = new EducationModel();
newModel.CareerProfile = this.careerProfile.ObjectID; newModel.CareerProfile = this.careerProfile.ObjectID;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<div class="col-md-6 form-group"> <div class="col-md-6 form-group">
<label>Employer</label> <label>Employer</label>
<app-form-control> <app-form-control>
<p-autoComplete [suggestions]="employers" (completeMethod)="suggestedEmployer($event)" placeholder="Employeer name" name="Employer{{i}}" [(ngModel)]="experience.Employer" required> <p-autoComplete [suggestions]="filteredEmployers" (completeMethod)="suggestedEmployer($event)" placeholder="Employeer name" name="Employer{{i}}" [(ngModel)]="experience.Employer" required>
</p-autoComplete> </p-autoComplete>
</app-form-control> </app-form-control>
</div> </div>
......
...@@ -23,6 +23,7 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit { ...@@ -23,6 +23,7 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit {
careerProfile = new CareerProfileModel(); careerProfile = new CareerProfileModel();
jobTitles = []; jobTitles = [];
employers = []; employers = [];
filteredEmployers = [];
@ViewChild('form') form: NgForm; @ViewChild('form') form: NgForm;
@Output() workSaved = new EventEmitter(); @Output() workSaved = new EventEmitter();
...@@ -41,6 +42,13 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit { ...@@ -41,6 +42,13 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.getCareerProfile(); this.getCareerProfile();
this.personalDetailsService.getEmployers()
.pipe(takeUntil(this.componentInView))
.subscribe(response => {
this.employers = response.filter(s => !!s);
}, err => {
this.utilsService.handleError(err);
});
} }
getCareerProfile(): void { getCareerProfile(): void {
...@@ -67,13 +75,9 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit { ...@@ -67,13 +75,9 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit {
} }
suggestedEmployer($event): void { suggestedEmployer($event): void {
this.personalDetailsService.getEmployers({Details: $event.query}) setTimeout(() => {
.pipe(takeUntil(this.componentInView)) this.filteredEmployers = $event.query ? this.employers.filter(s => s.startsWith($event.query)) : this.employers.slice();
.subscribe(response => { });
this.employers = response;
}, err => {
this.utilsService.handleError(err);
});
} }
addWorkExperience(initLoad = false): void { addWorkExperience(initLoad = false): void {
......
...@@ -49,6 +49,7 @@ export const SERVICES = { ...@@ -49,6 +49,7 @@ export const SERVICES = {
LOGIN_GOOGLE: 'LoginWithGoogle', LOGIN_GOOGLE: 'LoginWithGoogle',
INTRODUCTION_LETTERS: 'IntroductionLetters', INTRODUCTION_LETTERS: 'IntroductionLetters',
APPLICANT_TALENT_JOBS: 'ApplicantTalentJobs', APPLICANT_TALENT_JOBS: 'ApplicantTalentJobs',
STUDIED: 'Studied'
}; };
export const SEARCH = { export const SEARCH = {
......
...@@ -74,6 +74,15 @@ export class PersonalDetailsService { ...@@ -74,6 +74,15 @@ export class PersonalDetailsService {
) )
} }
getStudied(queryParams = {}, assocs = []): Observable<any> {
return this.searchService.getObjects(SERVICES.STUDIED, 'All', queryParams, assocs, null, null, null, null)
.map(
data => {
return data.Studied;
}
)
}
getCertifications(queryParams = {}, assocs = []): Observable<any> { getCertifications(queryParams = {}, assocs = []): Observable<any> {
return this.searchService.getObjects(SERVICES.CERTIFICATIONS, 'All', queryParams, assocs, 'Autocomplete', null, null, null) return this.searchService.getObjects(SERVICES.CERTIFICATIONS, 'All', queryParams, assocs, 'Autocomplete', null, null, null)
.map( .map(
......
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