Commit c02d0fdd by GD-A-150752

edit-workflow-template initial

parent ff8bb8bd
......@@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
......
import {Component, OnDestroy, Renderer, OnInit, NgZone} from '@angular/core';
import { Component } from '@angular/core';
@Component({
// tslint:disable-next-line:component-selector
selector: 'body',
template: '<router-outlet></router-outlet>'
})
......
import { NgModule } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { ConfirmationService, EditorModule, OverlayPanelModule } from 'primeng/primeng';
import { ConfirmationService, EditorModule, InputSwitchModule, OverlayPanelModule, PanelModule } from 'primeng/primeng';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app.routing';
import { AppService } from './app.service';
import { EditMessageTemplateComponent } from './components/edit-message-template/edit-message-template.component';
import { EditMessageTemplateService } from './components/edit-message-template/edit-message-template.service';
import { EditWorkflowTemplateComponent } from './components/edit-workflow-template/edit-workflow-template.component';
import { EditWorkflowTemplateService } from './components/edit-workflow-template/edit-workflow-template.service';
import { ListMessageTemplateComponent } from './components/list-message-template/list-message-template.component';
import { ListMessageTemplateService } from './components/list-message-template/list-message-template.service';
import { ListWorkFlowsComponent } from './components/list-work-flows/list-work-flows.component';
import { ListWorkFlowsService } from './components/list-work-flows/list-work-flows.service';
import { FullLayoutComponent } from './oneit/components/full-layout/full-layout.component';
import { OneITModule } from './oneit/oneit.module';
......@@ -21,12 +21,15 @@ import { OneITModule } from './oneit/oneit.module';
AppRoutingModule,
OneITModule,
EditorModule,
OverlayPanelModule
OverlayPanelModule,
PanelModule,
InputSwitchModule
],
declarations: [
AppComponent,
FullLayoutComponent,
EditMessageTemplateComponent,
EditWorkflowTemplateComponent,
ListMessageTemplateComponent,
ListWorkFlowsComponent
],
......@@ -35,13 +38,13 @@ import { OneITModule } from './oneit/oneit.module';
ConfirmationService,
AppService,
EditMessageTemplateService,
ListMessageTemplateService,
ListWorkFlowsService
EditWorkflowTemplateService
],
bootstrap: [AppComponent]
})
export class AppModule {
// tslint:disable-next-line:no-empty
constructor() {
}
}
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { EditMessageTemplateComponent } from './components/edit-message-template/edit-message-template.component';
import { EditWorkflowTemplateComponent } from "./components/edit-workflow-template/edit-workflow-template.component";
import { ListMessageTemplateComponent } from './components/list-message-template/list-message-template.component';
import { ListWorkFlowsComponent } from './components/list-work-flows/list-work-flows.component';
......@@ -61,6 +62,16 @@ export const routes: Routes = [
path: 'list-work-flows',
component: ListWorkFlowsComponent,
canActivate: [AuthGuard]
},
{
path: 'edit-workflow-template',
component: EditWorkflowTemplateComponent,
canActivate: [AuthGuard]
},
{
path: 'edit-workflow-template/:id',
component: EditWorkflowTemplateComponent,
canActivate: [AuthGuard]
}
]
}
......
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PlaceholderOptionsModel } from './models/placeholderOptions.model';
import { TemplateTypeModel } from './models/templateTypeModel';
import { PlaceholderOptionsEnum } from './models/placeholderOptions.enum';
import { TemplateTypeEnum } from './models/templateType.enum';
import { EnumService } from './oneit/services/enum.service';
import { SearchService } from './oneit/services/search.service';
import { UtilsService } from './oneit/services/utils.service';
@Injectable()
......@@ -11,39 +13,31 @@ export class AppService {
HiringTeam = 'ID:37952977';
constructor(
private enumService: EnumService
private enumService: EnumService,
private searchService: SearchService,
private utilsService: UtilsService
) {
}
getMessageTemplateTypeEnum(): Observable<Array<TemplateTypeModel>> {
getMessageTemplateTypeEnum(): Observable<Array<TemplateTypeEnum>> {
return this.enumService.getEnums('TemplateTypes', true);
}
getPlaceholderOptionsEnum(): Observable<Array<PlaceholderOptionsModel>> {
getPlaceholderOptionsEnum(): Observable<Array<PlaceholderOptionsEnum>> {
return this.enumService.getEnums('PlaceholderOptions', true);
}
// Helper functions
moveCreatedToUpdated(data, createdObjs, updatedObjs, deletedObjs = null): void {
Object.keys(createdObjs)
.forEach(nData => {
if (data.created[nData]) {
updatedObjs[data.created[nData]] = createdObjs[nData];
updatedObjs[data.created[nData]].ObjectID = data.created[nData];
// tslint:disable-next-line:no-dynamic-delete
delete createdObjs[nData];
}
});
if (deletedObjs) {
Object.keys(deletedObjs)
.forEach(nData => {
if (data.deleted.indexOf(nData) > -1) {
// tslint:disable-next-line:no-dynamic-delete
delete deletedObjs[nData];
}
});
getTypes(serviceName: string): Observable<Array<any>> {
return this.enumService.getEnums(serviceName, true);
}
getSearchListing(serviceName: string, queryType: string, queryParams, assocs, searchName): Observable<Array<any>> {
return this.searchService.searchAndSaveSearchRequest(serviceName, queryType,
queryParams, assocs, null, null, null, null, searchName, false)
.map(
data =>
this.utilsService.convertResponseToObjects(data, assocs)
);
}
}
......@@ -11,7 +11,7 @@
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-3">
<img data-elementID="image_sidePanel" title="sidePanel"
src="/assets/images/SelectPanel_MessageFlow.png"/>
src="assets/images/SelectPanel_MessageFlow.png"/>
</div>
<div class="ui-g-12 ui-md-9">
<div class="ui-g form-group">
......@@ -30,7 +30,8 @@
</div>
<div class="ui-g-12 ui-md-4 ui-fluid">
<p-dropdown [(ngModel)]="messageTemplate.TemplateType"
name="MessageTemplateType{{messageTemplate.ObjectID}}" fieldLabel="Message Template Type"
name="MessageTemplateType{{messageTemplate.ObjectID}}"
fieldLabel="Message Template Type"
[options]="messageTemplateTypes" optionLabel="Description" [disabled]="showLoader"
(onChange)="storeMessageContent()">
</p-dropdown>
......@@ -41,14 +42,16 @@
<label>Subject</label>
</div>
<div class="ui-g-12 ui-md-4 ui-fluid">
<input id="subjectInputId" [(ngModel)]="messageTemplate.Subject" name="Subject{{messageTemplate.ObjectID}}"
fieldLabel="Subject" placeholder="Subject" type="text" pInputText class="form-control ui-inputtext"
<input id="subjectInputId" [(ngModel)]="messageTemplate.Subject"
name="Subject{{messageTemplate.ObjectID}}"
fieldLabel="Subject" placeholder="Subject" type="text" pInputText
class="form-control ui-inputtext"
[disabled]="showLoader">
</div>
<div class="ui-g-12 ui-md-4">
<p-dropdown [(ngModel)]="subjectPlaceholder" name="SubjectOption{{messageTemplate.ObjectID}}"
[options]="subjectPlaceholderOptions" optionLabel="Description"
(onChange)="addPlaceholderInSubject()" [disabled]="showLoader">
(onHide)="addPlaceholderInSubject()" [disabled]="showLoader">
</p-dropdown>
</div>
</div>
......@@ -59,14 +62,16 @@
<div class="ui-g-12 ui-md-4" *ngIf="emailTemplateType()">
</div>
<div class="ui-g-12 ui-md-4">
<p-dropdown [(ngModel)]="contentPlaceholder" name="ContentOption{{messageTemplate.ObjectID}}"
<p-dropdown [(ngModel)]="contentPlaceholder"
name="ContentOption{{messageTemplate.ObjectID}}"
[options]="contentPlaceholderOptions" optionLabel="Description"
(onChange)="addPlaceholderInMessageContent($event)" [disabled]="showLoader">
</p-dropdown>
<p-overlayPanel #contentLinkModal>
<label class="ui-g-12" style="padding-left: 0;">Please enter anchor text</label>
<input pInputText name="contentLinkModal" type="text" class="ui-g-12"
style="font-size:15px !important;height:25px !important;" [(ngModel)]="this.linkText" id="overlay">
style="font-size:15px !important;height:25px !important;" [(ngModel)]="this.linkText"
id="overlay">
<p-button class="ui-button-success"
(click)="addAnchorText(true); contentLinkModal.hide()">Add
</p-button>
......@@ -104,7 +109,8 @@
<div class="ui-g-12 ui-md-12">
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-3 ui-fluid">
<p-button label="Cancel" [disabled]="showLoader" routerLink="/edit-message-template"></p-button>
<p-button label="Cancel" [disabled]="showLoader"
routerLink="/edit-message-template"></p-button>
</div>
<div class="ui-g-12 ui-md-3 ui-fluid">
<p-button *ngIf="showSaveBtn()" label="Save" [disabled]="showLoader"
......@@ -113,8 +119,7 @@
</div>
<div class="ui-g-12 ui-md-3 ui-fluid">
<p-button *ngIf="showSaveCopyBtn()" label="Save As a Copy" [disabled]="showLoader"
(onClick)="saveMessageTemplate(true)"
>
(onClick)="saveMessageTemplate(true)">
</p-button>
</div>
</div>
......
......@@ -6,9 +6,9 @@ import { OverlayPanel } from 'primeng/overlaypanel';
import { Subscription } from 'rxjs/Subscription';
import { AppService } from '../../app.service';
import { SERVICES } from '../../constants';
import { MessageTemplateModel } from '../../models/messageTemplateModel';
import { PlaceholderOptionsModel } from '../../models/placeholderOptions.model';
import { TemplateTypeModel } from '../../models/templateTypeModel';
import { MessageTemplateModel } from '../../models/messageTemplate.model';
import { PlaceholderOptionsEnum } from '../../models/placeholderOptions.enum';
import { TemplateTypeEnum } from '../../models/templateType.enum';
import { SaveService } from '../../oneit/services/save.service';
import { UtilsService } from '../../oneit/services/utils.service';
import { BaseComponent } from '../base/base.component';
......@@ -29,11 +29,12 @@ export class EditMessageTemplateComponent extends BaseComponent implements OnIni
deletedObjs;
messageTemplate = new MessageTemplateModel();
messageTemplateTypes: Array<TemplateTypeModel>;
subjectPlaceholderOptions: Array<PlaceholderOptionsModel>;
contentPlaceholderOptions: Array<PlaceholderOptionsModel>;
subjectPlaceholder: PlaceholderOptionsModel;
contentPlaceholder: PlaceholderOptionsModel;
messageTemplateTypes: Array<TemplateTypeEnum>;
subjectPlaceholderOptions: Array<PlaceholderOptionsEnum>;
contentPlaceholderOptions: Array<PlaceholderOptionsEnum>;
ContentPlaceholderOptionsEnum: Array<PlaceholderOptionsEnum>;
subjectPlaceholder: PlaceholderOptionsEnum;
contentPlaceholder: PlaceholderOptionsEnum;
contentCursorPoint;
temporaryMessageContent = '';
linkText = '';
......@@ -118,8 +119,8 @@ export class EditMessageTemplateComponent extends BaseComponent implements OnIni
} else {
if (editElement) {
editElement = document.getElementById('messageContentTxtAreaId');
if (editElement) {
['keyup', 'click'].forEach(event => {
editElement.addEventListener(event, () => {
this.contentCursorPoint = this.getCursorPos(editElement);
......@@ -190,6 +191,17 @@ export class EditMessageTemplateComponent extends BaseComponent implements OnIni
}
if (this.ContentPlaceholderOptionsEnum) {
if (this.emailTemplateType()) {
this.contentPlaceholderOptions = this.ContentPlaceholderOptionsEnum.filter(option => option.ShowForContent);
} else {
this.contentPlaceholderOptions = this.ContentPlaceholderOptionsEnum
.filter(option => option.ShowForContent && option.Value !== 'JOB_LINK');
}
}
this.setInputListener();
}
addPlaceholderInSubject(): void {
......@@ -258,8 +270,9 @@ export class EditMessageTemplateComponent extends BaseComponent implements OnIni
getPlaceholderOptions(): void {
this.subscriptions.push(this.appService.getPlaceholderOptionsEnum()
.subscribe(options => {
this.contentPlaceholderOptions = options.filter(option => option.ShowForContent);
this.subjectPlaceholderOptions = options.filter(option => option.ShowForSubject);
this.ContentPlaceholderOptionsEnum = options;
this.contentPlaceholderOptions = this.ContentPlaceholderOptionsEnum.filter(option => option.ShowForContent);
this.subjectPlaceholderOptions = this.ContentPlaceholderOptionsEnum.filter(option => option.ShowForSubject);
})
);
}
......
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { MessageTemplateModel } from '../../models/messageTemplateModel';
import { TemplateTypeModel } from '../../models/templateTypeModel';
import { MessageTemplateModel } from '../../models/messageTemplate.model';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
......@@ -15,7 +13,7 @@ export class EditMessageTemplateService {
) {
}
getMessageTemplateByID(id, assocs): Observable<any> {
getMessageTemplateByID(id, assocs): Observable<MessageTemplateModel> {
return this.searchService.getObjectById('MessageTemplates', id, assocs)
.map(
data => {
......
import { Component, OnInit, ViewChild } from '@angular/core';
import { NgForm } from '@angular/forms';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { AppService } from '../../app.service';
import { ResponseActionEnum } from '../../models/responseAction.enum';
import { StageTypeEnum } from '../../models/stageType.enum';
import { StepTypeEnum } from '../../models/stepType.enum';
import { WorkflowTemplateModel } from '../../models/workflowTemplate.model';
import { SaveService } from '../../oneit/services/save.service';
import { UtilsService } from '../../oneit/services/utils.service';
import { BaseComponent } from '../base/base.component';
import { EditWorkflowTemplateService } from './edit-workflow-template.service';
import { WorkflowTemplate } from './edit-workflow-template.model';
@Component({
selector: 'app-edit-workflow-template',
templateUrl: './edit-workflow-template.component.html'
})
export class EditWorkflowTemplateComponent extends BaseComponent implements OnInit {
subscriptions: Array<Subscription> = [];
@ViewChild('form') form: NgForm;
createdObjs = {};
updatedObjs = {};
deletedObjs = {};
workflow = new WorkflowTemplateModel();
stageTypes: Array<StageTypeEnum>;
stepTypes: Array<StepTypeEnum>;
responseActions: Array<ResponseActionEnum>;
editField: any = {};
showLoader = false;
editMode = false;
workflowTemplate = new WorkflowTemplate();
s: Array<any> = [];
messagetemplates: Array<any> = [];
messagetemplate_withdraws: Array<any> = [];
Capture_CVs = [];
Mandatory_CVs = [];
Capture_Cover_Letters = [];
Mandatory_cover_letters = [];
Automatically_progress_to_next_stages = [];
Use_messagings = [];
constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
private utilsService: UtilsService,
private saveService: SaveService,
private appService: AppService,
private editWorkflowTemplateService: EditWorkflowTemplateService
) {
super(utilsService);
}
ngOnInit(): void {
this.createdObjs = {};
this.updatedObjs = {};
this.deletedObjs = {};
this.utilsService.resetCounter();
this.showLoader = true;
this.subscriptions.push(this.activatedRoute.params
.subscribe(
(params: Params) => {
this.showLoader = true;
this.getStageTypes();
this.getStepTypes();
this.getResponseActions();
if (params.id && params.id !== '0') {
this.editMode = true;
this.getWorkflowTemplateByID(params.id);
} else {
this.utilsService.createObject(this.workflow, this.createdObjs);
this.setDefaults();
this.showLoader = false;
}
}
));
this.gets();
}
setDefaults(): void {
this.workflow.TemplateName = 'Workflow Template';
this.workflow.LandingButtonText = 'Apply Now';
this.workflow.VerificationHeaderText = 'Please verify your identity before applying to:';
this.workflow.ThankYouHeaderText = 'Thank You for your application to:';
this.workflow.ThankYouSecondaryText = 'We will get in touch with you soon';
this.workflow.ApplicationButtonText = 'Submit';
this.workflow.CaptureCV = true;
}
getStageTypes(): void {
this.subscriptions.push(
this.appService.getTypes('StageTypes')
.subscribe((types: Array<StageTypeEnum>) => {
this.stageTypes = types;
})
);
}
getStepTypes(): void {
this.subscriptions.push(
this.appService.getTypes('StepTypes')
.subscribe((types: Array<StepTypeEnum>) => {
this.stepTypes = types;
})
);
}
getResponseActions(): void {
this.subscriptions.push(
this.appService.getTypes('ResponseActions')
.subscribe((types: Array<ResponseActionEnum>) => {
this.responseActions = types;
})
);
}
showLabel(id: string): boolean {
return (this.editField[id] === undefined || this.editField[id] === false);
}
showInput(id: string): boolean {
return this.editField && !!this.editField[id];
}
toggleInput(event, fieldName, save = true): void {
this.utilsService.clearErrorMessages();
if (event.type === 'blur') {
if (!this.form.controls[fieldName].invalid) {
this.editField[fieldName] = false;
if (save) {
// save call to be sent
}
} else {
this.utilsService.showAllErrorMessages();
}
} else {
this.editField[fieldName] = true;
setTimeout(() => {
try {
document.getElementById(`${fieldName}Id`)
.focus();
document.getElementById(`${fieldName}Id`)
.getElementsByTagName('input')[0]
.focus();
} catch (e) {
// ignore this.
}
}, 0);
}
}
gets(): void {
this.subscriptions.push(this.editWorkflowTemplateService.getDummy456s([])
.subscribe(
data => {
this.s = data;
},
error => {
this.utilsService.handleError(error);
}
)
);
}
autoCompleteMessagetemplate(event): void {
this.subscriptions.push(this.editWorkflowTemplateService.getmessagetemplatesForAutocomplete(event.query, [])
.subscribe(
data => {
for (const obj of data) {
// If you need to display anything complex in autocomplete label, put that code here
// e.g. obj.Name = obj.FirstName + ' ' + obj.LastName. So that you can use "Name" attribute in HTML
}
this.messagetemplates = data;
},
error => {
this.utilsService.handleError(error);
}
)
);
}
autoCompleteMessagetemplate_withdraw(event): void {
this.subscriptions.push(this.editWorkflowTemplateService.getmessagetemplate_withdrawsForAutocomplete(event.query, [])
.subscribe(
data => {
for (const obj of data) {
// sd
}
this.messagetemplate_withdraws = data;
},
error => {
this.utilsService.handleError(error);
}
)
);
}
getWorkflowTemplateByID(id): void {
this.showLoader = true;
this.createdObjs = {};
this.updatedObjs = {};
this.deletedObjs = {};
this.utilsService.resetCounter();
this.utilsService.clearErrorMessages();
this.subscriptions.push(this.editWorkflowTemplateService.getWorkflowTemplateByID(id, [])
.subscribe(
data => {
this.workflowTemplate = data;
this.updatedObjs[this.workflowTemplate.ObjectID] = this.workflowTemplate;
this.showLoader = false;
},
error => {
this.showLoader = false;
this.utilsService.handleError(error);
}
)
);
}
saveWorkflowTemplate(reload: boolean): void {
this.utilsService.clearErrorMessages();
if (this.form.invalid) {
this.utilsService.showAllErrorMessages();
} else {
this.showLoader = true;
this.subscriptions.push(this.saveService.saveObjectsWithDefaultSvc(this.createdObjs, this.updatedObjs, this.deletedObjs)
.subscribe(
data => {
this.utilsService.handleSuccess();
if (reload) {
let idToNavigate = this.workflowTemplate.ObjectID;
if (data.created[idToNavigate]) {
idToNavigate = data.created[idToNavigate];
this.router.navigate(['/edit-workflow-template', idToNavigate]);
return;
}
this.getWorkflowTemplateByID(idToNavigate);
} else {
this.router.navigate(['']);
}
},
error => {
this.showLoader = false;
this.utilsService.handleError(error);
}
)
);
}
}
}
export class WorkflowTemplate {
ObjectID: string;
ButtonText: string;
HeaderText: string;
CaptureCV: boolean;
MandatoryCV: boolean;
CaptureCoverLetter: boolean;
Mandatorycoverletter: boolean;
HeaderTextforThankYoupage: string;
SecondaryText: string;
Automaticallyprogresstonextstage: boolean;
Hrs1: string;
BusinessHrsOnly: boolean;
Messagetemplate: any;
Hrswithdraw: string;
Variationwithdraw: string;
Messagetemplate_withdraw: any;
Usemessaging: boolean;
Dummy457: string;
messagetemplate_withdraw: string;
messagetemplate: string;
Dummy461: string;
}
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
@Injectable()
export class EditWorkflowTemplateService {
constructor(
private searchService: SearchService,
private utilsService: UtilsService
) {
}
getDummy456s(assocs): Observable<any> {
return this.searchService.getObjects('MessageTemplates', 'All', {}, assocs, null, null, null, null)
.map(
data =>
this.utilsService.convertResponseToObjects(data, assocs)
);
}
getmessagetemplate_withdrawsForAutocomplete(searchTerm, assocs): Observable<any> {
return this.searchService.getObjects('', 'All', {}, assocs, null, null, null, null)
.map(
data =>
this.utilsService.convertResponseToObjects(data, assocs)
);
}
getmessagetemplatesForAutocomplete(searchTerm, assocs): Observable<any> {
return this.searchService.getObjects('', 'All', {}, assocs, null, null, null, null)
.map(
data => {
return this.utilsService.convertResponseToObjects(data, assocs);
}
);
}
getWorkflowTemplateByID(id, assocs): Observable<any> {
return this.searchService.getObjectById('', id, assocs)
.map(
data => {
const objs = this.utilsService.convertResponseToObjects(data, assocs);
if (objs && objs.length > 0) {
return objs[0];
}
}
);
}
}
......@@ -20,7 +20,10 @@
<div class="ui-g-12 ui-md-9">
<div class="ui-g-offset-3 pull-right">
<label>Sort By</label>
<p-dropdown [options]="sortOptions" name="sort" [(ngModel)]="sortSelected" (onChange)="sortMessageTemplates()"
<p-dropdown [options]="sortOptions" name="sort" [(ngModel)]="sortSelected"
(onClick)="sortMessageTemplates()"
(onShow)="setDefaultSorter()"
(onHide)="allowSort = false"
optionLabel="description">
</p-dropdown>
</div>
......
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { MessageTemplateModel } from '../../models/messageTemplateModel';
import { SorterModel } from '../../models/sorterModel';
import { BaseComponent } from '../base/base.component';
import { AppService } from '../../app.service';
import { SEARCH, SERVICES } from '../../constants';
import { MessageTemplateModel } from '../../models/messageTemplate.model';
import { SorterModel } from '../../models/sorterModel';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
import { ListMessageTemplateService } from './list-message-template.service';
import { BaseComponent } from '../base/base.component';
@Component({
selector: 'app-list-message-template',
......@@ -22,6 +21,7 @@ export class ListMessageTemplateComponent extends BaseComponent implements OnIni
sharedTemplates: Array<MessageTemplateModel> = [];
sortOptions: Array<SorterModel>;
sortSelected: SorterModel;
allowSort: boolean;
showLoader = false;
constructor(
......@@ -29,8 +29,7 @@ export class ListMessageTemplateComponent extends BaseComponent implements OnIni
private activatedRoute: ActivatedRoute,
private utilsService: UtilsService,
private searchService: SearchService,
private appService: AppService,
private listMessageTemplateService: ListMessageTemplateService
private appService: AppService
) {
super(utilsService);
}
......@@ -40,6 +39,7 @@ export class ListMessageTemplateComponent extends BaseComponent implements OnIni
new SorterModel('Alphabetical (A-Z)', true),
new SorterModel('Alphabetical (Z-A)', false)
];
// this.sortSelected = new SorterModel('Alphabetical (A-Z)', true);
this.showLoader = true;
const sharedMsgParams = {
OnlyGlobalTemplate: true
......@@ -48,8 +48,7 @@ export class ListMessageTemplateComponent extends BaseComponent implements OnIni
OnlyGlobalTemplate: false
};
this.subscriptions.push(
this.listMessageTemplateService
.getMessageTemplates(myMsgParams, [])
this.appService.getSearchListing(SERVICES.MESSAGE_TEMPLATES, 'All', myMsgParams, [], SEARCH.MESSAGE_TEMPLATE)
.subscribe(
messages => {
this.myTemplates = messages;
......@@ -59,10 +58,11 @@ export class ListMessageTemplateComponent extends BaseComponent implements OnIni
this.utilsService.handleError(error);
}
)
);
)
;
this.subscriptions.push(
this.listMessageTemplateService
.getMessageTemplates(sharedMsgParams, [])
this.appService
.getSearchListing(SERVICES.MESSAGE_TEMPLATES, 'All', sharedMsgParams, [], SEARCH.MESSAGE_TEMPLATE)
.subscribe(
messages => {
this.sharedTemplates = messages;
......@@ -77,14 +77,28 @@ export class ListMessageTemplateComponent extends BaseComponent implements OnIni
}
sortMessageTemplates(): void {
if (this.allowSort) {
this.showLoader = true;
this.myTemplates = this.utilsService.sort(this.myTemplates,
['TemplateName'], [this.sortSelected.ascending ? 1 : -1], false);
this.sharedTemplates = this.utilsService.sort(this.sharedTemplates,
['TemplateName'], [this.sortSelected.ascending ? 1 : -1], false);
this.allowSort = false;
this.showLoader = false;
}
}
setDefaultSorter(): void {
if (!this.sortSelected) {
this.sortSelected = new SorterModel('Alphabetical (A-Z)', true);
}
this.allowSort = true;
}
onRowSelect(data: MessageTemplateModel): void {
this.showLoader = true;
this.router.navigate(['/edit-message-template', data.ObjectID]);
......
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
@Injectable()
export class ListMessageTemplateService {
constructor(
private searchService: SearchService,
private utilsService: UtilsService
) {
}
getMessageTemplates(queryParams, assocs): Observable<any> {
return this.searchService.searchAndSaveSearchRequest('MessageTemplates', 'All',
queryParams, assocs, null, null, null, null, 'ListMessageTemplate', false)
.map(
data =>
this.utilsService.convertResponseToObjects(data, assocs)
);
}
}
......@@ -6,7 +6,7 @@
Workflows
</div>
<div class="ui-toolbar-group-right actionBtn">
<button pButton type="button" routerLink="/edit-work-flow" label="Add Workflow Template"
<button pButton type="button" routerLink="/edit-workflow-template" label="Add Workflow Template"
icon="ui-icon-"></button>
</div>
</p-toolbar>
......
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { AppService } from '../../app.service';
import { SEARCH, SERVICES } from '../../constants';
import { SorterModel } from '../../models/sorterModel';
import { WorkflowTemplateModel } from '../../models/workflowTemplateModel';
import { WorkflowTemplateModel } from '../../models/workflowTemplate.model';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
import { BaseComponent } from '../base/base.component';
import { ListWorkFlowsService } from './list-work-flows.service';
@Component({
selector: 'app-list-work-flows',
......@@ -28,8 +27,7 @@ export class ListWorkFlowsComponent extends BaseComponent implements OnInit {
private activatedRoute: ActivatedRoute,
private utilsService: UtilsService,
private searchService: SearchService,
private appService: AppService,
private listWorkFlowsService: ListWorkFlowsService
private appService: AppService
) {
super(utilsService);
}
......@@ -46,8 +44,7 @@ export class ListWorkFlowsComponent extends BaseComponent implements OnInit {
OnlyGlobalTemplates: false
};
this.subscriptions.push(
this.listWorkFlowsService
.getWorkFlows(myParams, [])
this.appService.getSearchListing(SERVICES.WORKFLOW_TEMPLATES, 'All', myParams, [], SEARCH.WORKFLOW_TEMPLATE)
.subscribe(
messages => {
this.myTemplates = messages;
......@@ -59,8 +56,7 @@ export class ListWorkFlowsComponent extends BaseComponent implements OnInit {
)
);
this.subscriptions.push(
this.listWorkFlowsService
.getWorkFlows(sharedParams, [])
this.appService.getSearchListing(SERVICES.WORKFLOW_TEMPLATES, 'All', sharedParams, [], SEARCH.WORKFLOW_TEMPLATE)
.subscribe(
messages => {
this.sharedTemplates = messages;
......@@ -85,6 +81,6 @@ export class ListWorkFlowsComponent extends BaseComponent implements OnInit {
onRowSelect(data: WorkflowTemplateModel): void {
this.showLoader = true;
this.router.navigate(['/edit-work-flow', data.ObjectID]);
this.router.navigate(['/edit-workflow-template', data.ObjectID]);
}
}
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
@Injectable()
export class ListWorkFlowsService {
constructor(
private searchService: SearchService,
private utilsService: UtilsService
) {
}
getWorkFlows(queryParams, assocs): Observable<any> {
return this.searchService.searchAndSaveSearchRequest('WorkFlowTemplates', 'All', queryParams,
assocs, null, null, null, null, 'ListWorkFlow', false)
.map(
data =>
this.utilsService.convertResponseToObjects(data, assocs)
);
}
}
......@@ -8,6 +8,13 @@ export const CLASSES = {
};
export const SERVICES = {
MESSAGE_TEMPLATES: 'MessageTemplates',
WORKFLOW_TEMPLATES: 'WorkFlowTemplates',
SAVE_MESSAGE_AS_COPY: 'SaveMessageAsCopy',
SAVE: 'Save'
};
export const SEARCH = {
MESSAGE_TEMPLATE: 'ListMessageTemplate',
WORKFLOW_TEMPLATE: 'ListWorkFlow'
};
export class ApplicationStatusModel {
export class ApplicationStatusEnum {
Name: string;
Value: string;
Description: string;
......
import { CLASSES } from '../constants';
import { ApplicationStatusModel } from './applicationStatus';
import { HiringTeamModel } from './hiringTeamModel';
import { TemplateTypeModel } from './templateTypeModel';
import { ApplicationStatusEnum } from './applicationStatus.enum';
import { HiringTeamModel } from './hiringTeam.model';
import { TemplateTypeEnum } from './templateType.enum';
export class MessageTemplateModel {
ObjectID: string;
......@@ -10,13 +10,13 @@ export class MessageTemplateModel {
MessageID: number;
TemplateName: string;
Subject: string;
ApplicationStatus: ApplicationStatusModel;
ApplicationStatus: ApplicationStatusEnum;
DelayHrs: number;
DelayMin: number;
Variance: number;
BusinessHoursOnly: boolean;
MessageContent: string;
TemplateType: TemplateTypeModel;
TemplateType: TemplateTypeEnum;
RelatedToJob: boolean;
IsSystemGenerated: boolean;
HiringTeam: HiringTeamModel | string;
......
export class PlaceholderOptionsModel {
export class PlaceholderOptionsEnum {
Name: string;
Value: string;
Description: string;
......
export class TemplateTypeModel {
export class ResponseActionEnum {
Name: string;
Value: string;
Description: string;
......
export class StageTypeEnum {
Name: string;
Value: string;
Description: string;
Disabled: boolean;
IsPreStage: boolean;
IsPostStage: boolean;
}
export class StepTypeEnum {
Name: string;
Value: string;
Description: string;
Disabled: boolean;
}
export class TemplateTypeEnum {
Name: string;
Value: string;
Description: string;
Disabled: boolean;
}
import { CLASSES } from '../constants';
import { HiringTeamModel } from './hiringTeam.model';
import { ResponseActionEnum } from './responseAction.enum';
export class WorkflowTemplateModel {
ObjectID: string;
......@@ -11,5 +13,14 @@ export class WorkflowTemplateModel {
CaptureCL: boolean;
IsCLMandatory: boolean;
ApplicationButtonText: string;
ApplicationResponseAction: string;
ApplicationResponseAction: ResponseActionEnum;
ThankYouHeaderText: string;
ThankYouSecondaryText: string;
JobOutlineButtonText: string;
RelatedToJob: boolean;
IsSystemGenerated: boolean;
WithdrawalMessage: string;
HiringTeam: HiringTeamModel | string;
WorkFlowStages: Array<string>;
Jobs: Array<string>;
}
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