Commit 66a7c0c0 by GD-A-150752

Internal CR Fix

parent 74d5e962
...@@ -83,7 +83,8 @@ ...@@ -83,7 +83,8 @@
<div class="ui-g-3"> <div class="ui-g-3">
<p-splitButton [class.non-embed]="!embedded" label="Send" icon="ui-icon-send" <p-splitButton [class.non-embed]="!embedded" label="Send" icon="ui-icon-send"
(onClick)="saveEngineApplicantView()" (onClick)="saveEngineApplicantView()"
[model]="items"> [disabled]="sendCriteria()"
[model]="sentViaMenuItems">
</p-splitButton> </p-splitButton>
<div class="buttons-wrapper"> <div class="buttons-wrapper">
<button *ngIf="embedded" type="button" pButton label="Mark as read" <button *ngIf="embedded" type="button" pButton label="Mark as read"
......
...@@ -206,5 +206,17 @@ a { ...@@ -206,5 +206,17 @@ a {
.ql-editor { .ql-editor {
min-height: 85px; min-height: 85px;
height: 50px;
border-radius: 2px;
-webkit-box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, .08);
box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, .08);
border: 1px solid #dbdbdf;
&:focus {
background-color: #fff;
-webkit-box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, .08);
box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, .08);
border: 1px solid rgba(3, 160, 231, .5);
}
} }
} }
...@@ -34,7 +34,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -34,7 +34,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
@ViewChild('message') messageEditor: Editor; @ViewChild('message') messageEditor: Editor;
@ViewChild('form') form: NgForm; @ViewChild('form') form: NgForm;
@ViewChild('uploader') uploader: FileUpload; @ViewChild('uploader') uploader: FileUpload;
items: Array<MenuItem>; sentViaMenuItems: Array<MenuItem>;
createdObjs = {}; createdObjs = {};
updatedObjs = {}; updatedObjs = {};
deletedObjs = {}; deletedObjs = {};
...@@ -69,24 +69,25 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -69,24 +69,25 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
ngOnInit(): void { ngOnInit(): void {
this.getSetVias(); this.getSetViaOptions();
// For Hiring Team or Applicant // For Hiring Team or Applicant
const service = this.embedded ? this.adminPortalLayoutService : this.applicantPortalLayoutService; const service = this.embedded ? this.adminPortalLayoutService : this.applicantPortalLayoutService;
if (service.userData) { if (service.userData) {
this.initComponent(service); this.initComponent(service);
} else { } else {
this.subscriptions.push(service.userDataUpdated.first().subscribe(() => { this.subscriptions.push(service.userDataUpdated.first()
.subscribe(() => {
this.initComponent(service); this.initComponent(service);
})); }));
} }
} }
getSetVias() { getSetViaOptions(): void {
this.subscriptions.push( this.subscriptions.push(
this.appService.getTypes('SentVia') this.appService.getTypes('SentVia')
.subscribe((data: Array<SentViaEnum>) => { .subscribe((data: Array<SentViaEnum>) => {
this.sentViaEnum = data; this.sentViaEnum = data;
this.items = this.sentViaEnum.map(elem => this.sentViaMenuItems = this.sentViaEnum.map(elem =>
({ ({
label: elem.Description, command: () => this.Message.SentVia = elem label: elem.Description, command: () => this.Message.SentVia = elem
})); }));
...@@ -95,10 +96,10 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -95,10 +96,10 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
); );
} }
initComponent(service): void { initComponent(service: AdminPortalLayoutService | ApplicantPortalLayoutService): void {
if (service instanceof AdminPortalLayoutService) { if (service instanceof AdminPortalLayoutService) {
this.loggedInId = service.userData.CompanyUser.User; this.loggedInId = service.userData.CompanyUser.User;
// jobId should come from @Input; // jobId should come from @Input (Admin Portal)
} else { } else {
this.jobId = service.jobId; this.jobId = service.jobId;
this.loggedInId = service.userData.UserID; this.loggedInId = service.userData.UserID;
...@@ -108,7 +109,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -108,7 +109,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
this.getEngineApplicantViewByID(); this.getEngineApplicantViewByID();
} else { } else {
// Should never come to this block // Should never come to this block
console.error("jobId not found."); console.error('JobId not found.');
} }
} }
...@@ -116,8 +117,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -116,8 +117,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
this.showLoader = true; this.showLoader = true;
this.createdObjs = {}; this.createdObjs = {};
this.createMessage();
const assocs = const assocs =
[ASSOCS.JOB, [ASSOCS.JOB, ASSOCS.HIRING_TEAM].join('.'), ASSOCS.MESSAGES, [ASSOCS.MESSAGES, ASSOCS.SENT_BY].join('.'), [ASSOCS.JOB, [ASSOCS.JOB, ASSOCS.HIRING_TEAM].join('.'), ASSOCS.MESSAGES, [ASSOCS.MESSAGES, ASSOCS.SENT_BY].join('.'),
[ASSOCS.MESSAGES, ASSOCS.ATTACHMENTS].join('.'), [ASSOCS.CANDIDATE, ASSOCS.USER].join('.')]; [ASSOCS.MESSAGES, ASSOCS.ATTACHMENTS].join('.'), [ASSOCS.CANDIDATE, ASSOCS.USER].join('.')];
...@@ -127,13 +126,13 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -127,13 +126,13 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
data => { data => {
this.jobApplication = data; this.jobApplication = data;
this.jobApplication.Messages = this.jobApplication.Messages || []; this.jobApplication.Messages = this.jobApplication.Messages || [];
this.utilsService.sort(this.jobApplication.Messages, ['ObjectCreated'], [1]);
this.jobApplication.Messages.forEach(msg => { this.jobApplication.Messages.forEach(msg => {
msg.ObjectCreated = new Date(msg.ObjectCreated); msg.ObjectCreated = new Date(msg.ObjectCreated);
}); });
// Assign current Job Application to new message
this.Message.JobApplication = this.jobApplication; this.createMessage();
this.Message.Attachments = [];
this.utilsService.sort(this.jobApplication.Messages, ['ObjectCreated'], [1]);
this.showLoader = false; this.showLoader = false;
setTimeout(() => { setTimeout(() => {
...@@ -174,10 +173,14 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -174,10 +173,14 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
return; return;
} }
if (!this.Message.SentVia) {
this.Message.SentVia = this.sentViaEnum[2] ? this.sentViaEnum[2] : this.sentViaEnum[0];
}
this.showLoader = true; this.showLoader = true;
this.subscriptions.push(this.saveService.saveObjectsWithDefaultSvc(this.createdObjs, this.updatedObjs, this.deletedObjs) this.subscriptions.push(this.saveService.saveObjectsWithDefaultSvc(this.createdObjs, this.updatedObjs, this.deletedObjs)
.subscribe( .subscribe(
data => { () => {
this.utilsService.handleSuccess(); this.utilsService.handleSuccess();
this.showLoader = false; this.showLoader = false;
this.getEngineApplicantViewByID(); this.getEngineApplicantViewByID();
...@@ -212,7 +215,8 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -212,7 +215,8 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
createMessage(): void { createMessage(): void {
this.Message = new MessageModel(); this.Message = new MessageModel();
this.Message.SentBy = this.loggedInId; this.Message.SentBy = this.loggedInId;
this.Message.SentVia = this.sentViaEnum[2] ? this.sentViaEnum[2] : this.sentViaEnum[0]; this.Message.Attachments = [];
this.Message.JobApplication = this.jobApplication;
this.utilsService.createObject(this.Message, this.createdObjs); this.utilsService.createObject(this.Message, this.createdObjs);
} }
...@@ -226,28 +230,11 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -226,28 +230,11 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
.click(); .click();
} }
setEditorClass(): void { sendCriteria(): boolean {
setTimeout(() => { if (this.showLoader || !this.Message.Attachments) {
if (!this.messageEditor) { return true;
return;
}
const editElement = this.messageEditor.getQuill().container;
if (!editElement) {
return;
}
const editor = editElement.getElementsByClassName('ql-editor');
if (!editor[0]) {
return;
} }
editor[0].classList.add('form-control'); return (this.Message.MessageContent === '' || !this.Message.MessageContent) && !this.Message.Attachments.length;
// editor[0].classList.add('editor');
editor[0].innerHTML = '';
}, 0);
} }
} }
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