Commit c4b83938 by Muhammad Usman

report view, template done butotn

parent 9af740e7
......@@ -50,7 +50,7 @@
</app-references>
</p-tabPanel>
<p-tabPanel header="6{{isMobileView ? '' : '. Templates'}}" [selected]="activeTab === 'templates'" rightIcon="fa fa-check" [headerStyleClass]="careerProfile?.ProfileBulderTabCompletion?.TEMPLATES ? 'completed' : ''">
<app-templates (careerProfileLoaded)="careerProfileUpdated($event)" *ngIf="activeTab === 'templates'">
<app-templates (careerProfileLoaded)="careerProfileUpdated($event)" *ngIf="activeTab === 'templates'" (templateSaved)="tabChanged({index: 6})">
</app-templates>
</p-tabPanel>
<p-tabPanel header="7{{isMobileView ? '' : '. Publish'}}" [selected]="activeTab === 'publish'" rightIcon="fa fa-check" [headerStyleClass]="careerProfile?.ProfileBulderTabCompletion?.PUBLISH ? 'completed' : ''">
......
......@@ -12,6 +12,10 @@
<button pButton [label]="careerProfile?.Template ? 'Choose another template' : 'Please choose a profile template'" class="ui-button-info rounded-btn"
(click)="showTemplates()"></button>
</div>
<div class="text-center mt-2">
<button pButton label="Done" class="ui-button-info rounded-btn" (click)="templateSaved.emit()"></button>
</div>
</div>
......
......@@ -23,6 +23,7 @@ export class TemplatesComponent extends BaseComponent implements OnInit {
templatesShown = false;
apiBase = environment.baseUrl;
@Output() careerProfileLoaded = new EventEmitter<CareerProfileModel>();
@Output() templateSaved = new EventEmitter();
constructor(
private personalDetailsService: PersonalDetailsService,
......
......@@ -120,8 +120,8 @@
<div class="home-mobile-body-features">
<div class="feature">
<div class="feature-heading">Development Reports</div>
<div class="feature-content">Information about feature that gives user context as to why to upgrade.</div>
<div class="feature-action">Get this feature</div>
<div class="feature-content">Information about feature that gives user context as to what value it provides.</div>
<div class="feature-action" routerLink="/my-career-web/dashboard/summary-report">View my summary report</div>
<div class="extra-feature-image" style="position: relative;">
<img src="assets/my-career-web/svgs/summary-report.svg" style="margin-top: 10px;">
......
......@@ -7,12 +7,12 @@
</div>
<div class="mc-page-body container">
<div class="mc-card">
<form #form="ngForm" class="mc-card position-relative">
<app-overlay [isActive]="isLoading"></app-overlay>
<div class="mc-page-body-heading">{{isEditMode ? 'Update' : 'Enter'}} Job Details </div>
<div class="row">
<div class="row mt-3">
<div class="col-md-6 form-group">
<label>Job Title</label>
<app-form-control>
......@@ -42,13 +42,16 @@
<app-form-control>
<p-dropdown placeholder="Select job post location" [options]="jobPostLocations"
[dropdownIcon]="isLoadingJobLocations ? 'pi pi-spin pi-spinner' : 'pi pi-chevron-down'"
optionLabel="Description" name="JobPostedLocation" dataKey="Value"
optionLabel="Description" name="JobPostedLocation" dataKey="Value" required
[(ngModel)]="applicantJob.JobPostedLocation">
</p-dropdown>
</app-form-control>
</div>
</div>
<div class="col-md-12 d-flex justify-content-end">
<button (click)="saveApplicantJob()" pButton label="Next" class="mc-btn-primary" [disabled]="isLoading"></button>
</div>
</div>
</form>
</div>
</div>
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { BaseComponent } from '../../base/base.component';
import { ApplicantJobModel } from '../../models/applicant-job.model';
import { JobService } from '../../services/job.service';
import { takeUntil } from 'rxjs/operators';
import { UtilsService } from '../../../oneit/services/utils.service';
import { ActivatedRoute, Router } from '@angular/router';
import { NgForm } from '@angular/forms';
import { HelperService } from '../../services/helper.service';
import { ToasterService } from '../../services/toaster.service';
@Component({
selector: 'app-job',
......@@ -13,21 +17,54 @@ import { UtilsService } from '../../../oneit/services/utils.service';
export class JobComponent extends BaseComponent implements OnInit {
applicantJob: ApplicantJobModel = new ApplicantJobModel();
applicantJobId;
isLoadingJobLocations = false;
jobPostLocations = [];
@ViewChild('form') form: NgForm;
constructor(
private activatedRoute: ActivatedRoute,
private jobService: JobService,
private utilsService: UtilsService
private utilsService: UtilsService,
private toastService: ToasterService,
private helperService: HelperService,
private router: Router
) {
super();
}
ngOnInit() {
this.activatedRoute.params
.pipe(takeUntil(this.componentInView))
.subscribe(params => {
if (params.id && params.id !== 'new') {
this.isEditMode = true;
this.applicantJobId = params.id;
this.getApplicantJob()
} else {
this.applicantJob = new ApplicantJobModel();
this.utilsService.createObject(this.applicantJob, this.createdObjs)
}
});
this.getJobPostLocations();
}
getApplicantJob(): void {
this.isLoading = true;
this.jobService.getApplicantJob(this.applicantJob)
.pipe(takeUntil(this.componentInView))
.subscribe(response => {
this.isLoading = false;
console.log(response);
}, err => {
this.utilsService.handleError(err);
this.isLoading = false;
})
}
getJobPostLocations(): void {
this.isLoadingJobLocations = true;
this.jobService.getJobPostedLocation()
......@@ -41,4 +78,22 @@ export class JobComponent extends BaseComponent implements OnInit {
})
}
saveApplicantJob(): void {
if (this.form.invalid) {
return this.helperService.validateAllFormFields(this.form);
}
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;
});
}
}
......@@ -5,6 +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';
@Injectable()
......@@ -28,10 +29,23 @@ export class JobService {
)
}
getApplicantJob(id, assocs = []): Observable<JobApplicationModel> {
return this.searchService.getObjects(SERVICES.APPLICANT_TALENT_JOBS, 'ByID', {id: id}, assocs, null, null, null, null)
.map(
data => {
return this.utilsService.convertResponseToObjects(data, assocs)[0];
}
)
}
getJobPostedLocation(): Observable<any> {
return this.enumService.getEnums('JobPostedLocations', true);
}
saveApplicantJob(createdObjs, updatedObjs, deleteObjs): Observable<any> {
return this.saveService.saveObjectsWithDefaultSvc(createdObjs, updatedObjs, deleteObjs);
}
}
......@@ -27,3 +27,9 @@ p-dropdown {
}
}
}
.is-invalid {
.ui-dropdown-label {
border: 1px solid #e62a10;
}
}
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