Commit 66a7c0c0 by GD-A-150752

Internal CR Fix

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