Commit d4c1d9fb by Bharti Ladumor

S54103527 # Matchd / Talentology - No Plan [Enhancement] #Add Applicant feature…

S54103527 # Matchd / Talentology - No Plan [Enhancement] #Add Applicant feature : angular - created compoment and worked on search applicant
parent d116ab85
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-edit-applicant',
templateUrl: './edit-applicant.component.html',
styleUrls: ['./edit-applicant.component.css']
})
export class EditApplicantComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
<form #form="ngForm">
<div class="ui-g ui-fluid">
<div class="ui-g-12 nopad">
<p-toolbar>
<div class="ui-toolbar-group-left">
Search Applicants
</div>
</p-toolbar>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-2">
<label>Details</label>
</div>
<div class="ui-g-12 ui-md-4 ui-fluid">
<input [(ngModel)]="details" name="Details" fieldLabel="Details" type="text" pInputText class="ui-inputtext" placeholder="Search by applicant name or email">
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-2">
</div>
<div class="ui-g-12 ui-md-4 ui-fluid">
<p-button label="Search" (click)="getApplicants()"></p-button>
</div>
</div>
<span *ngIf="showResult">
<h4>Search Results ({{applicants.length}})</h4><br/>
<p-table #table [columns]="cols" [value]="applicants" [paginator]="false" selectionMode="single" (onRowSelect)="onRowSelect($event.data)">
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col *ngFor="let col of columns" [style.width]="col.width">
</colgroup>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field" [pSortableColumnDisabled]="col.noSort">
{{col.header}}
<p-sortIcon [field]="col.field" *ngIf="!col.noSort"></p-sortIcon>
</th>
</tr>
<tr>
<th *ngFor="let col of columns">
<input *ngIf="!col.noFilter" pInputText type="text" (input)="table.filter($event.target.value, col.field, 'contains')">
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<ng-container *ngFor="let col of columns">
<td *ngIf="col.field != ''">
{{utilsService.getActualFieldValue(rowData, col.field)}}
</td>
</ng-container>
<td>
<button pButton type="button" icon="ui-icon-edit" title="Edit" (click)="onRowSelect(rowData)"></button>
</td>
</tr>
</ng-template>
<ng-template pTemplate="emptymessage" let-columns >
<tr>
<td [attr.colspan]="columns.length">
No applicatans found - please try again.
</td>
</tr>
</ng-template>
</p-table>
</span>
<p-progressSpinner *ngIf="showLoader"></p-progressSpinner>
</form>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { Subscription } from 'rxjs';
import { UtilsService } from '../../oneit/services/utils.service';
import { SearchApplicantService } from './search-applicants.service';
@Component({
selector: 'app-search-applicants',
templateUrl: './search-applicants.component.html',
styleUrls: ['./search-applicants.component.css']
})
export class SearchApplicantsComponent implements OnInit {
subscriptions: Array<Subscription> = [];
applicants : any[] = [];
showLoader : boolean = false;
showResult : boolean = false;
details : string
constructor(
private utilsService: UtilsService,
private searchApplicantService : SearchApplicantService){
}
cols = [
{ field: 'User.Name', header: 'Name', width: '30%', noSort: false, noFilter: false},
{ field: 'User.Email', header: 'Email', width: '30%', noSort: false, noFilter: false},
{ field: 'NoOfJobs', header: 'No of Jobs', width: '30%', noSort: false, noFilter: false},
{ field: '', header: '', width: '10%', noSort: true, noFilter: true}
];
ngOnInit() {
}
getApplicants() {
var ob = {
Details : this.details
}
this.showLoader = true;
this.subscriptions.push(this.searchApplicantService.getApplicants(ob, ['User']).subscribe(data => {
this.applicants = data;
this.showLoader = false;
this.showResult = true;
},
error => {
this.utilsService.handleError(error);
this.showLoader = false;
}))
}
ngOnDestroy(){
this.utilsService.unsubscribeSubscriptions(this.subscriptions);
}
}
import { Injectable } from '@angular/core';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
@Injectable()
export class SearchApplicantService {
constructor(private searchService : SearchService,
private utilsService : UtilsService) {
}
getApplicants(ob, assocs) {
return this.searchService.getObjects('Candidates', 'All', ob, assocs, null, null, null, null)
.map(
data =>
this.utilsService.convertResponseToObjects(data, assocs)
);
}
}
\ 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