Commit 9dd300cd by GD-A-150752

test-commit

parent dc523d8b
import { DatePipe } from "@angular/common";
import { NgModule } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { Select2Module } from 'ng2-select2';
......@@ -69,7 +70,8 @@ import { OneITModule } from './oneit/oneit.module';
ApplicantPortalLayoutService,
AppService,
EditWorkflowTemplateService,
MessageEngineApplicantViewService
MessageEngineApplicantViewService,
DatePipe
],
bootstrap: [AppComponent]
})
......
......@@ -6,7 +6,7 @@ import { BsModalService } from 'ngx-bootstrap/modal';
import { DeviceDetectorService } from 'ngx-device-detector';
import { Subscription } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { IframeMsgHandlingService } from "../../../oneit/services/iframe-msg-handling.service";
import { IframeMsgHandlingService } from '../../../oneit/services/iframe-msg-handling.service';
import { MsgsService } from '../../../oneit/services/msgs.service';
import { UserService } from '../../../oneit/services/user.service';
import { UtilsService } from '../../../oneit/services/utils.service';
......@@ -57,8 +57,10 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
ngOnInit(): void {
// Subscribe to msgReceived of iframeMsgHandlingService to get JobId
console.log('About to subscribe in Admin');
this.subscriptions.push(this.iframeMsgHandlingService.msgReceived.subscribe(
(message: any) => {
console.log('Admin Subscribed', message);
if (!message || !message.name) {
return;
}
......@@ -66,10 +68,13 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
if (message.name !== 'HiringTeamChat' || message.message === null) {
return;
}
const msg = JSON.parse(message.message);
console.log('Admin Parsed', msg);
// Show Chat bubble if message service allows
this.showBubble = true;
}
));
if (this.deviceService.isMobile()) {
window.location.href = `${environment.baseUrl}extensions/adminportal/responsive_alert.jsp`;
}
......
<div class="{{embedded ? 'openedFromWorkflow' : 'dashboard-content-area second-part' }}">
<app-error-message></app-error-message>
<form #form="ngForm">
<form #form="ngForm" *ngIf="jobId && loggedInId">
<div class="ui-g ui-fluid">
<div class="ui-g-12 ui-md-12">
<div class="main-tab-template pl-1 {{embedded ? 'h-45' : '' }}">
......@@ -31,7 +31,7 @@
</div>
<div class="message-footer">
<div>via {{message.SentVia.Description}}</div>
<div>{{message.ObjectCreatedStr}}</div>
<div>{{message.ObjectCreatedStr | oneitdate : 'dd/MM/yyyy HH:mm' : 'MM-dd-yyyy HH:mm'}}</div>
</div>
</div>
</div>
......@@ -46,7 +46,7 @@
</div>
<div class="message-footer">
<div>via {{message.SentVia.Description}}</div>
<div>{{message.ObjectCreatedStr}}</div>
<div>{{message.ObjectCreatedStr | oneitdate : 'dd/MM/yyyy HH:mm' : 'MM-dd-yyyy HH:mm'}}</div>
</div>
</div>
<div class="ui-g-12 ui-md-1 name owner {{embedded ? 'pad-5' : '' }}">
......@@ -94,7 +94,6 @@ M202.992,332.528v124.517l58.738-67.927L202.992,332.528z"></path>
icon="ui-icon-check"
(click)="markAsRead()"></button>
</div>
<span class="mt-3">&nbsp;</span>
<p-fileUpload *ngIf="Message.Attachments"
name="File" [withCredentials]="true"
id="File" url="{{apiUrl}}uploadFile" auto="true"
......@@ -116,4 +115,9 @@ M202.992,332.528v124.517l58.738-67.927L202.992,332.528z"></path>
<div id="showPlainText"></div>
<p-progressSpinner *ngIf="showLoader"></p-progressSpinner>
</form>
<div class="ui-g ui-fluid" *ngIf="!jobId || !loggedInId">
<div class="ui-g-12 ui-md-12">
<p>Nothing to show here!</p>
</div>
</div>
</div>
......@@ -5,6 +5,7 @@ a {
::ng-deep {
.ui-fileupload-buttonbar {
padding: 0 !important;
margin-top: 10px;
.ui-button {
width: 100% !important;
......
......@@ -67,8 +67,10 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
ngOnInit(): void {
this.utilsService.resetCounter();
// Subscribe to msgReceived of iframeMsgHandlingService to get JobId
console.log('About to subscribe');
this.subscriptions.push(this.iframeMsgHandlingService.msgReceived.subscribe(
(message: any) => {
console.log('Received Message', message);
if (!message || !message.name) {
return;
}
......@@ -78,6 +80,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
}
const msg = JSON.parse(message.message);
console.log('Parsed', msg);
this.jobId = msg.JobApplicationID;
this.showLoader = true;
......@@ -85,6 +88,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
this.appService.getTypes('SentVia')
.subscribe((data: Array<SentViaEnum>) => {
this.sentViaEnum = data;
// For Hiring Team
if (this.embedded) {
if (this.adminPortalLayoutService.userData) {
this.loggedInId = this.adminPortalLayoutService.userData.CompanyUser.User;
......@@ -100,14 +104,16 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
} else {
// For applicant
this.embedded = false;
this.loggedInId = msg.CandidateID;
// this.loggedInId = msg.CandidateID;
this.initComponent();
// Use candidate ID fetched from iFrameService
}
})
);
}
));
}
initComponent(): void {
......@@ -124,21 +130,23 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
}
getEngineApplicantViewByID(jobId: string): void {
this.showLoader = true;
this.createdObjs = {};
this.utilsService.resetCounter();
this.utilsService.clearErrorMessages();
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('.')];
this.subscriptions.push(this.messageEngineApplicantViewService.getEngineApplicantViewByID(jobId, assocs)
.subscribe(
data => {
this.jobApplication = data;
this.jobApplication.Messages = this.jobApplication.Messages || [];
// Assign current Job Application to new message
this.Message.JobApplication = this.jobApplication;
this.Message.Attachments = [];
this.utilsService.sort(this.jobApplication.Messages, ['ObjectCreated'], [1]);
......@@ -158,6 +166,9 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
);
}
/**
* This function sets isRead property of all messages of this job application to true
*/
markAsRead(): void {
this.showLoader = true;
const params = {
......@@ -201,6 +212,11 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
}
}
/**
* Creates a new object of ChatAttachment and assigns the FileToken and Name to it.
* Moreover, pushes it to the current Message's Attachments Array
* @param event Browser Event
*/
onUpload(event: any): void {
const chatAttachment = new ChatAttachmentModel();
this.utilsService.createObject(chatAttachment, this.createdObjs);
......@@ -212,6 +228,9 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
this.Message.Attachments.push(chatAttachment);
}
/**
* It simply creates a new object and assigns the default values to it.
*/
createMessage(): void {
this.Message.SentBy = this.loggedInId;
this.Message.SentVia = this.sentViaEnum[2] ? this.sentViaEnum[2] : this.sentViaEnum[0];
......@@ -264,6 +283,9 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
return title;
}
/**
* If message content is empty, generate an error message for it.
*/
IsMessageEmpty(): boolean {
if (this.showPlainText(this.Message.MessageContent) === '') {
this.msgService.addErrorMessages(
......
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SaveService } from "../../oneit/services/save.service";
import { SearchService } from '../../oneit/services/search.service';
import { UtilsService } from '../../oneit/services/utils.service';
......@@ -9,8 +8,7 @@ import { UtilsService } from '../../oneit/services/utils.service';
export class MessageEngineApplicantViewService {
constructor(
private searchService: SearchService,
private utilsService: UtilsService,
private saveService: SaveService
private utilsService: UtilsService
) {
}
......
......@@ -308,12 +308,10 @@
&.ui-dialog-draggable {
left: auto !important;
right: 10px !important;
height: 85% !important;
height: 600px !important;
bottom: 0 !important;
overflow-y: scroll;
top: auto !important;
min-width: 600px;
width: 55%;
width: 690px !important;
}
}
......@@ -464,6 +462,7 @@ body .ui-dropdown-panel .ui-dropdown-filter-container {
position: fixed;
bottom: 10px;
right: 20px;
background-image: url('../images/chat-icon.jpg');
background-repeat: round;
cursor: pointer;
}
......
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