Commit 22519df5 by chamath

S54103527 - Add Applicant feature.

Added new columns to download, delete and replace the CV and Cover letter.
parent 6cb6d98f
.ui-g.form-group > div {
padding : 0px !important;
padding-right: 10px !important;
}
a.pdf-link {
color: cornflowerblue;
}
a.pdf-link:hover {
color: blue;
text-decoration: underline;
}
\ No newline at end of file
......@@ -71,13 +71,28 @@
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<ng-container *ngFor="let col of columns">
<ng-container *ngFor="let col of columns | slice:0:3">
<td *ngIf="col.field != ''">
{{utilsService.getActualFieldValue(rowData, col.field)}}
</td>
</ng-container>
<ng-container *ngFor="let col of columns | slice:4:5">
<td>
<a href="{{baseUrl}}{{rowData?.CV?.URI}}" class="data-link pdf-link" target="_blank"> {{ rowData?.CV?.Name ? rowData?.CV?.Name : rowData?.CVName?.name }} </a>
<p-fileUpload name="CV" auto="true" mode="basic" capture="environment" maxFileSize="1000000" url="{{baseUrl}}uploadFile" [style]="{'float': 'right'}"
(onProgress)="showLoader = true" (onUpload)="onUpload($event, rowData, 'CV')" withCredentials="true" [multiple]="false"
chooseLabel="Choose New"></p-fileUpload>
<p-button *ngIf="rowData.CV" label="X" (onClick)="deleteCV(rowData)" style="float: right; margin-right: 20px;"></p-button>
</td>
<td>
<a href="{{baseUrl}}{{rowData?.CoverLetter?.URI}}" class="data-link pdf-link" target="_blank"> {{ rowData?.CoverLetter?.Name ? rowData?.CoverLetter?.Name : rowData?.CoverLetterName?.name }} </a>
<p-fileUpload name="CoverLetter" auto="true" mode="basic" capture="environment" maxFileSize="1000000" url="{{baseUrl}}uploadFile" [style]="{'float': 'right'}"
(onProgress)="showLoader = true" (onUpload)="onUpload($event, rowData, 'CoverLetter')" withCredentials="true" [multiple]="false"
chooseLabel="Choose New"></p-fileUpload>
<p-button *ngIf="rowData.CoverLetter" label="X" (onClick)="deleteCoverLetter(rowData)" style="float: right; margin-right: 20px;"></p-button>
</td>
</ng-container>
</tr>
</ng-template>
<ng-template pTemplate="emptymessage" let-columns >
......@@ -88,8 +103,9 @@
</tr>
</ng-template>
</p-table>
</span>
</span>
<p-confirmDialog header="Delete Confirmation" icon="fa fa-trash" width="600"></p-confirmDialog>
<p-progressSpinner *ngIf="showLoader"></p-progressSpinner>
</form>
</p-card>
import { Component, OnInit, ViewChild } from '@angular/core';
import { Subscription } from 'rxjs';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { NgForm } from '@angular/forms';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { ConfirmationService } from 'primeng/api';
import { Subscription } from 'rxjs';
import { environment } from '../../../environments/environment';
import { FIELDS } from '../../constants';
import { SearchApplicantService } from '../search-applicants/search-applicants.service';
import { SaveService } from '../../oneit/services/save.service';
import { UtilsService } from '../../oneit/services/utils.service';
import { Candidate } from '../search-applicants/search-applicants.model';
import { SaveService } from '../../oneit/services/save.service';
import { SearchApplicantService } from '../search-applicants/search-applicants.service';
@Component({
selector: 'app-edit-applicant',
templateUrl: './edit-applicant.component.html',
styleUrls: ['./edit-applicant.component.css']
selector: 'app-edit-applicant',
templateUrl: './edit-applicant.component.html',
styleUrls: ['./edit-applicant.component.css']
})
export class EditApplicantComponent implements OnInit {
......@@ -19,25 +21,32 @@ export class EditApplicantComponent implements OnInit {
@ViewChild('form') form: NgForm;
saveDropdown = [{
label : 'Save & Back', icon: 'ui-icon-refresh', command: () => { this.saveApplicants(false);}
label: 'Save & Back', icon: 'ui-icon-refresh', command: () => { this.saveApplicants(false); }
}]
readonly FIELDS = FIELDS;
applicant : Candidate = new Candidate();
readonly FIELDS = FIELDS;
showLoader : boolean = false;
applicant: Candidate = new Candidate();
baseUrl = environment.baseUrl;
showLoader: boolean = false;
cols = [
{ field: 'Job.HiringTeam.Company.CompanyName', header: 'Customer', width: '33%', noSort: false, noFilter: false},
{ field: 'Job.HiringTeam.HiringTeamName', header: 'Hiring Team', width: '33%', noSort: false, noFilter: false},
{ field: 'Job.JobTitle', header: 'Job', width: '33%', noSort: false, noFilter: false},
{ field: 'Job.HiringTeam.Company.CompanyName', header: 'Customer', width: '18%', noSort: false, noFilter: false },
{ field: 'Job.HiringTeam.HiringTeamName', header: 'Hiring Team', width: '18%', noSort: false, noFilter: false },
{ field: 'Job.JobTitle', header: 'Job', width: '18%', noSort: false, noFilter: false },
{ field: 'CV', header: 'CV', width: '23%', noSort: true, noFilter: true },
{ field: 'CoverLetter', header: 'Cover Letter', width: '23%', noSort: true, noFilter: true },
];
constructor(private activatedRoute : ActivatedRoute,
private SearchApplicantService : SearchApplicantService,
private utilsService : UtilsService,
private saveService : SaveService,
private router : Router) { }
constructor(
private activatedRoute: ActivatedRoute,
private SearchApplicantService: SearchApplicantService,
private utilsService: UtilsService,
private saveService: SaveService,
private router: Router,
private confirmationService: ConfirmationService
) {
}
ngOnInit() {
this.subscriptions.push(this.activatedRoute.params
......@@ -49,11 +58,37 @@ export class EditApplicantComponent implements OnInit {
this.getApplicate(params.id);
}
}
));
));
}
deleteCV(application: any) {
const isMandatory = application.Job.WorkFlowTemplate.IsCVMandatory;
this.deleteConfirmation(application, isMandatory, 'CV');
}
deleteCoverLetter(application: any) {
const isMandatory = application.Job.WorkFlowTemplate.IsCLMandatory;
this.deleteConfirmation(application, isMandatory, 'CoverLetter');
}
deleteConfirmation(application: any, isMandatory: boolean, type: string) {
this.confirmationService.confirm({
message: isMandatory ? type + ' is mandatory in the Job Application. Do you want to proceed with the delete?' : 'Are you sure you want to delete this ' + type + '?',
accept: () => {
application.IsArchived = true;
eval('application.' + type + ' = null');
}
});
}
onUpload(event: any, application: any, type: string) {
eval('application.' + type + ' = { "FileToken": JSON.parse(event.xhr.response).files[0].token }');
eval('application.' + type + 'Name = event.files[0]');
this.showLoader = false;
}
getApplicate(id) {
this.SearchApplicantService.getApplicantByID(id, ['User', 'JobApplications', 'JobApplications.Job.HiringTeam.Company']).subscribe(data => {
this.SearchApplicantService.getApplicantByID(id, ['User', 'JobApplications', 'JobApplications.Job.HiringTeam.Company', 'JobApplications.Job.WorkFlowTemplate']).subscribe(data => {
this.applicant = data;
this.showLoader = false;
}, error => {
......@@ -68,8 +103,19 @@ export class EditApplicantComponent implements OnInit {
this.utilsService.showAllErrorMessages();
} else {
this.showLoader = true;
let updatedObjs = {};
this.utilsService.addObjsToJSONByObjectID(updatedObjs, [this.applicant, this.applicant.User])
let updatedObjs = {};
this.utilsService.addObjsToJSONByObjectID(updatedObjs, [this.applicant, this.applicant.User]);
this.utilsService.addObjsToJSONByObjectID(updatedObjs, this.applicant.JobApplications);
if (this.applicant.JobApplications) {
for (let application of this.applicant.JobApplications) {
application.FactorScoreDetails = null;
application.CultureFit = null;
application.RoleFit = null;
application.RequirementFit = null;
}
}
this.subscriptions.push(this.saveService.saveObjectsWithDefaultSvc({}, updatedObjs, {})
.subscribe(
data => {
......
......@@ -20,4 +20,8 @@ export class User {
export class JobApplications {
ObjectID : string;
ObjectClass = CLASSES.JOB_APPLICATION;
FactorScoreDetails: any;
CultureFit: any;
RequirementFit: any;
RoleFit: any;
}
\ No newline at end of file
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