Commit fc03b4b0 by Muhammad Usman

work history changes

parent 4c6f788d
......@@ -9,7 +9,7 @@
<div class="header-actions">
<span class="auto-saved">Auto saved 1 min ago</span>
<button pButton label="Save & exit" (click)="exit()" class="ui-button-info"></button>
<button [disabled]="isExiting" pButton label="Save & exit" (click)="exit()" class="ui-button-info"></button>
</div>
</div>
<p-progressBar [value]="20"></p-progressBar>
......@@ -31,21 +31,21 @@
<app-templates></app-templates>
</p-tabPanel>
<p-tabPanel header="2{{isMobileView ? '' : '. Personal Data'}}" [selected]="activeTab === 'personal-data'">
<app-personal-details [asChildComponent]="true" (detailsSaved)="tabChanged({index: 2})">
<app-personal-details #personalDetailsComponent [asChildComponent]="true" (detailsSaved)="tabChanged({index: 2})">
</app-personal-details>
</p-tabPanel>
<p-tabPanel header="3{{isMobileView ? '' : '. Work History'}}" [selected]="activeTab === 'work-history'">
<app-work-history (workSaved)="tabChanged({index: 3})">
<app-work-history #workHistoryComponent (workSaved)="tabChanged({index: 3})">
</app-work-history>
</p-tabPanel>
<p-tabPanel header="4{{isMobileView ? '' : '. Education'}}" [selected]="activeTab === 'education'">
<app-education (educationSaved)="tabChanged({index: 4})"></app-education>
<app-education #educationComponent (educationSaved)="tabChanged({index: 4})"></app-education>
</p-tabPanel>
<p-tabPanel header="5{{isMobileView ? '' : '. Skills'}}" [selected]="activeTab === 'skills'">
<app-skills (skillsSaved)="tabChanged({index: 5})"></app-skills>
<app-skills #skillsComponent (skillsSaved)="tabChanged({index: 5})"></app-skills>
</p-tabPanel>
<p-tabPanel header="6{{isMobileView ? '' : '. References'}}" [selected]="activeTab === 'references'">
<app-references (refereeSaved)="tabChanged({index: 6})"></app-references>
<app-references #referencesComponent (refereeSaved)="tabChanged({index: 6})"></app-references>
</p-tabPanel>
<p-tabPanel header="7{{isMobileView ? '' : '. Publish'}}" [selected]="activeTab === 'publish'">
<app-publish></app-publish>
......
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { BaseComponent } from '../../base/base.component';
import { ActivatedRoute, Router } from '@angular/router';
import { takeUntil } from 'rxjs/operators';
import { PersonalDetailsComponent } from '../../mc-shared/personal-details/personal-details.component';
import { WorkHistoryComponent } from './work-history/work-history.component';
import { EducationComponent } from './education/education.component';
import { SkillsComponent } from './skills/skills.component';
import { ReferencesComponent } from './references/references.component';
@Component({
selector: 'app-career-history',
......@@ -12,6 +17,13 @@ export class CareerHistoryComponent extends BaseComponent implements OnInit {
tabs = ['templates', 'personal-data', 'work-history', 'education', 'skills', 'references', 'publish'];
activeTab = '';
isExiting = false;
@ViewChild('personalDetailsComponent') personalDetailsComponent: PersonalDetailsComponent;
@ViewChild('workHistoryComponent') workHistoryComponent: WorkHistoryComponent;
@ViewChild('educationComponent') educationComponent: EducationComponent;
@ViewChild('skillsComponent') skillsComponent: SkillsComponent;
@ViewChild('referencesComponent') referencesComponent: ReferencesComponent;
constructor(
private router: Router,
......@@ -31,7 +43,24 @@ export class CareerHistoryComponent extends BaseComponent implements OnInit {
}
exit(): void {
this.router.navigate(['/my-career-web/dashboard/home']);
this.isExiting = true;
switch (this.activeTab) {
case 'personal-data':
this.personalDetailsComponent.updateProfile('/my-career-web/dashboard/home');
break;
case 'work-history':
this.workHistoryComponent.saveWorkHistory('/my-career-web/dashboard/home');
break;
case 'education':
this.educationComponent.saveEducation('/my-career-web/dashboard/home');
break;
case 'skills':
this.skillsComponent.saveSkill('/my-career-web/dashboard/home');
break;
case 'references':
this.referencesComponent.saveReferees('/my-career-web/dashboard/home');
break;
}
}
tabChanged($event): void {
......
......@@ -28,47 +28,47 @@
<label>Course or Certification</label>
<app-form-control>
<p-autoComplete [suggestions]="certifications" name="Certification{{i}}" [(ngModel)]="education.Certification" placeholder="Enter Certificate" required
(completeMethod)="getCertificates($event)" [forceSelection]="true" dataKey="ObjectID" field="CertificateName">
(completeMethod)="getCertificates($event)" dataKey="ObjectID" field="CertificateName">
</p-autoComplete>
</app-form-control>
</div>
</div>
<div class="row">
<div class="row" *ngIf="education.Certification">
<div class="col-md-6 form-group">
<label>Where Studied</label>
<app-form-control>
<input type="text" class="form-control" placeholder="Where studied" name="WhereStudied" [(ngModel)]="education.WhereStudied">
<input type="text" class="form-control" placeholder="Where studied" name="WhereStudied{{i}}" [(ngModel)]="education.WhereStudied">
</app-form-control>
</div>
<div class="col-md-6 form-group">
<label>Where Issued</label>
<app-form-control>
<input type="text" class="form-control" placeholder="Where issued" name="WhereIssued" [(ngModel)]="education.WhereIssued">
<input type="text" class="form-control" placeholder="Where issued" name="WhereIssued{{i}}" [(ngModel)]="education.WhereIssued">
</app-form-control>
</div>
</div>
<div class="row">
<div class="row" *ngIf="education.Certification">
<div class="col-md-3 form-group">
<label>GPA or Outcome</label>
<app-form-control>
<input type="text" class="form-control" placeholder="Outcome" name="Outcome" [(ngModel)]="education.Outcome">
<input type="text" class="form-control" placeholder="Outcome" name="Outcome{{i}}" [(ngModel)]="education.Outcome" pKeyFilter="pnum" maxlength="5">
</app-form-control>
</div>
<div class="col-md-6 col-md-offset-3 form-group">
<label>When Completed</label>
<app-form-control>
<p-calendar [(ngModel)]="education.WhenCompletedField" name="WhenCompletedField">
<p-calendar [(ngModel)]="education.WhenCompletedField" name="WhenCompletedField{{i}}">
</p-calendar>
</app-form-control>
</div>
</div>
<div class="row">
<div class="row" *ngIf="education.Certification">
<div class="col-md-4 form-group">
<label>Upload Certificate</label>
......
......@@ -6,8 +6,9 @@ import { ConfirmationService } from 'primeng/api';
import { NgForm } from '@angular/forms';
import { BaseComponent } from '../../../base/base.component';
import { takeUntil } from 'rxjs/operators';
import { EducationModel } from '../../../models/education.model';
import { CertificationModel, EducationModel } from '../../../models/education.model';
import { environment } from '../../../../../environments/environment';
import { Router } from '@angular/router';
@Component({
selector: 'app-education',
......@@ -16,7 +17,7 @@ import { environment } from '../../../../../environments/environment';
})
export class EducationComponent extends BaseComponent implements OnInit {
assocs = ['EducationCertificates'];
assocs = ['EducationCertificates.Certification'];
careerProfile = new CareerProfileModel();
apiUrl = environment.baseUrl;
uploadingFile = false;
......@@ -27,8 +28,9 @@ export class EducationComponent extends BaseComponent implements OnInit {
constructor(
private personalDetailsService: PersonalDetailsService,
private confirmationService: ConfirmationService,
private utilsService: UtilsService,
private confirmationService: ConfirmationService
private router: Router
) {
super();
}
......@@ -77,11 +79,17 @@ export class EducationComponent extends BaseComponent implements OnInit {
})
}
saveEducation(): void {
saveEducation(customRoute = null): void {
if (this.form.invalid) {
this.utilsService.showAllErrorMessages();
}
this.careerProfile.EducationCertificates.forEach(exp => {
if (typeof exp.Certification === 'string') {
const certificate = new CertificationModel();
certificate.CertificateName = exp.Certification;
this.utilsService.createObject(certificate, this.createdObjs);
exp.Certification = certificate;
}
exp.WhenCompleted = UtilsService.convertDateToString(exp.WhenCompletedField);
});
this.isSaving = true;
......@@ -89,8 +97,11 @@ export class EducationComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this.componentInView))
.subscribe(res => {
this.isSaving = false;
this.utilsService.handleError(res);
this.educationSaved.emit();
if (customRoute) {
this.router.navigate([customRoute])
} else {
this.educationSaved.emit();
}
}, err => {
this.utilsService.handleError(err);
this.isSaving = false;
......
......@@ -8,6 +8,7 @@ import { BaseComponent } from '../../../base/base.component';
import { takeUntil } from 'rxjs/operators';
import { RefereeModel } from '../../../models/referee.model';
import { environment } from '../../../../../environments/environment';
import { Router } from '@angular/router';
@Component({
selector: 'app-references',
......@@ -26,8 +27,9 @@ export class ReferencesComponent extends BaseComponent implements OnInit {
constructor(
private personalDetailsService: PersonalDetailsService,
private confirmationService: ConfirmationService,
private utilsService: UtilsService,
private confirmationService: ConfirmationService
private router: Router
) {
super();
}
......@@ -77,7 +79,7 @@ export class ReferencesComponent extends BaseComponent implements OnInit {
})
}
saveReferees(): void {
saveReferees(customRoute = null): void {
if (this.form.invalid) {
return this.utilsService.clearErrorMessages();
}
......@@ -86,7 +88,11 @@ export class ReferencesComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this.componentInView))
.subscribe(res => {
this.isSaving = false;
this.refereeSaved.emit();
if (customRoute) {
this.router.navigate([customRoute])
} else {
this.refereeSaved.emit();
}
}, err => {
this.isLoading = false;
this.utilsService.handleError(err);
......
......@@ -7,6 +7,7 @@ import { UtilsService } from '../../../../oneit/services/utils.service';
import { ConfirmationService } from 'primeng/api';
import { takeUntil } from 'rxjs/operators';
import { CareerSkillModel, SkillModel } from '../../../models/career-skill.model';
import { Router } from '@angular/router';
@Component({
selector: 'app-skills',
......@@ -25,8 +26,9 @@ export class SkillsComponent extends BaseComponent implements OnInit {
constructor(
private personalDetailsService: PersonalDetailsService,
private confirmationService: ConfirmationService,
private utilsService: UtilsService,
private confirmationService: ConfirmationService
private router: Router
) {
super();
}
......@@ -91,7 +93,7 @@ export class SkillsComponent extends BaseComponent implements OnInit {
})
}
saveSkill(): void {
saveSkill(customRoute = null): void {
if (this.form.invalid) {
return this.utilsService.showAllErrorMessages();
}
......@@ -100,7 +102,11 @@ export class SkillsComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this.componentInView))
.subscribe(res => {
this.isSaving = false;
this.skillsSaved.emit();
if (customRoute) {
this.router.navigate([customRoute])
} else {
this.skillsSaved.emit();
}
}, err => {
this.isSaving = false;
this.utilsService.handleError(err);
......
......@@ -26,7 +26,7 @@
<input type="text" class="form-control" placeholder="Employeer name" name="Employer{{i}}" [(ngModel)]="experience.Employer" required>
</app-form-control>
</div>
<div class="col-md-4">
<div class="col-md-4" *ngIf="experience.Employer">
<div class="row">
<div class="col-md-6 form-group">
<label>Start</label>
......@@ -45,14 +45,14 @@
</div>
</div>
</div>
<div class="col-md-2 currently-work-checkbox">
<div class="col-md-2 currently-work-checkbox" *ngIf="experience.Employer">
<p-checkbox label="I currently work here" [binary]="true" [(ngModel)]="experience.StillInRole" name="StillInRole{{i}}">
</p-checkbox>
</div>
</div>
</div>
<div class="col-md-9">
<div class="col-md-9" *ngIf="experience.Employer">
<div class="row">
<div class="col-md-6 form-group">
<label>Actual job title</label>
......@@ -61,7 +61,7 @@
</app-form-control>
</div>
<div class="col-md-6 form-group">
<label>ILO job title</label>
<label class="with-help-text">ILO job title <span class="help-text"><i class="fa fa-question" pTooltip="This is the set of International Labour Organisation (ILO) job titles. It helps Matchd to determine the type of occupation for this job." tooltipStyleClass="t-w300"></i></span></label>
<app-form-control>
<p-autoComplete [suggestions]="jobTitles" name="ILOJobTitle{{i}}" [(ngModel)]="experience.ILOJobTitle" placeholder="ILO Job Title"
(completeMethod)="getJobTitles($event)" [forceSelection]="true" dataKey="ObjectID" field="JobTitle">
......@@ -71,14 +71,14 @@
</div>
</div>
<div class="col-md-6 form-group">
<div class="col-md-6 form-group" *ngIf="experience.Employer">
<label>Reason for Leaving (OPTIONAL)</label>
<app-form-control>
<textarea class="form-control" [(ngModel)]="experience.ReasonForLeaving" name="ReasonForLeaving{{i}}"></textarea>
</app-form-control>
</div>
<div class="col-md-6 form-group">
<div class="col-md-6 form-group" *ngIf="experience.Employer">
<label>Duties and Responsibilities</label>
<app-form-control>
<textarea class="form-control" [(ngModel)]="experience.JobRoleSummary" name="JobRoleSummary{{i}}"></textarea>
......
......@@ -7,6 +7,7 @@ import { UtilsService } from '../../../../oneit/services/utils.service';
import { WorkExperienceModel } from '../../../models/work-experience.model';
import { NgForm } from '@angular/forms';
import { ConfirmationService } from 'primeng/api';
import { Router } from '@angular/router';
@Component({
selector: 'app-work-history',
......@@ -24,8 +25,9 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit {
constructor(
private personalDetailsService: PersonalDetailsService,
private confirmationService: ConfirmationService,
private utilsService: UtilsService,
private confirmationService: ConfirmationService
private router: Router
) {
super();
}
......@@ -84,7 +86,7 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit {
})
}
saveWorkHistory(): void {
saveWorkHistory(customRoute = null): void {
if (this.form.invalid) {
return this.utilsService.showAllErrorMessages();
}
......@@ -97,7 +99,11 @@ export class WorkHistoryComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this.componentInView))
.subscribe(res => {
this.isSaving = false;
this.workSaved.emit();
if (customRoute) {
this.router.navigate([customRoute])
} else {
this.workSaved.emit();
}
}, err => {
this.utilsService.handleError(err);
this.isSaving = false;
......
......@@ -101,7 +101,7 @@ export class PersonalDetailsComponent extends BaseComponent implements OnInit {
})
}
updateProfile(): void {
updateProfile(customRoute = null): void {
if (this.form.invalid) {
return this.utilsService.showAllErrorMessages();
}
......@@ -116,7 +116,11 @@ export class PersonalDetailsComponent extends BaseComponent implements OnInit {
if (!this.asChildComponent) {
this.router.navigate(['/my-career-web/dashboard/home']);
} else {
this.detailsSaved.emit();
if (customRoute) {
this.router.navigate([customRoute]);
} else {
this.detailsSaved.emit();
}
}
}, err => {
this.isSaving = false;
......
......@@ -11,11 +11,11 @@ export class EducationModel extends BaseModel {
WhenCompletedField: Date;
Certificate: any;
CareerProfile: string;
Certification: Certification;
Certification: CertificationModel;
}
class Certification extends BaseModel {
export class CertificationModel extends BaseModel {
ObjectClass = CLASSES.CERTIFICATION;
CertificateName: string;
}
......@@ -36,7 +36,7 @@ export class IntroLetterService {
}
saveIntroLetters(createdObjs, updatedObjs, deleteObjs): Observable<any> {
return this.saveService.saveObjectsWithDefaultSvc(createdObjs, updatedObjs, deleteObjs, true);
return this.saveService.saveObjectsWithDefaultSvc(createdObjs, updatedObjs, deleteObjs);
}
}
......@@ -78,7 +78,7 @@ export class PersonalDetailsService {
}
saveProfile(createdObjs, updatedObjs, deletedObjs): Observable<any> {
return this.saveService.saveObjects('svc/SavePersonalDetails',createdObjs, updatedObjs, deletedObjs, true);
return this.saveService.saveObjects('svc/SavePersonalDetails',createdObjs, updatedObjs, deletedObjs);
}
}
......@@ -103,4 +103,4 @@ export class ValidationErrorMessageDirective implements OnInit, OnDestroy {
// const formGroup = c.parent.controls;
// return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
// }
}
\ No newline at end of file
}
......@@ -15,11 +15,11 @@ export class SaveService {
}
saveObjectsWithDefaultSvc(createdObjs: any, updatedObjs: any, deletedObjs: any, rawResponse = false): Observable<any> {
return this.saveObjects('svc/Save', createdObjs, updatedObjs, deletedObjs, rawResponse);
saveObjectsWithDefaultSvc(createdObjs: any, updatedObjs: any, deletedObjs: any): Observable<any> {
return this.saveObjects('svc/Save', createdObjs, updatedObjs, deletedObjs);
}
saveObjects(serviceName: string, createdObjs: any, updatedObjs: any, deletedObjs: any, rawResponse = false): Observable<any> {
saveObjects(serviceName: string, createdObjs: any, updatedObjs: any, deletedObjs: any): Observable<any> {
let params: any = {
environment: environment.envName
}
......@@ -49,11 +49,7 @@ export class SaveService {
return this.apiService.post(serviceName, params)
.map(
data => {
if (!rawResponse) {
if (this.utilsService.isSuccessfulResponse(data)) {
return data;
}
} else {
if (this.utilsService.isSuccessfulResponse(data)) {
return data;
}
}
......
......@@ -6,7 +6,31 @@ import { DialogModule } from 'primeng/dialog';
import { DropdownModule } from 'primeng/dropdown';
import { FieldsetModule } from 'primeng/fieldset';
import { InputTextareaModule } from 'primeng/inputtextarea';
import { ButtonModule, CalendarModule, EditorModule, FileUploadModule, GrowlModule, InputMaskModule, InputSwitchModule, InputTextModule, MegaMenuModule, MenubarModule, MessagesModule, OverlayPanelModule, PanelModule, ProgressBarModule, ProgressSpinnerModule, RadioButtonModule, ScrollPanelModule, SplitButtonModule, TabViewModule, TieredMenuModule, ToolbarModule, TooltipModule } from 'primeng/primeng';
import {
ButtonModule,
CalendarModule,
EditorModule,
FileUploadModule,
GrowlModule,
InputMaskModule,
InputSwitchModule,
InputTextModule,
KeyFilterModule,
MegaMenuModule,
MenubarModule,
MessagesModule,
OverlayPanelModule,
PanelModule,
ProgressBarModule,
ProgressSpinnerModule,
RadioButtonModule,
ScrollPanelModule,
SplitButtonModule,
TabViewModule,
TieredMenuModule,
ToolbarModule,
TooltipModule
} from 'primeng/primeng';
import { SelectButtonModule } from 'primeng/selectbutton';
import { TableModule } from 'primeng/table';
import { ToastModule } from 'primeng/toast';
......@@ -44,5 +68,6 @@ export const PrimeNGModules = [
InputMaskModule,
ProgressBarModule,
FileUploadModule,
TooltipModule
];
\ No newline at end of file
TooltipModule,
KeyFilterModule
];
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