Commit 80c3a68d by GD-A-150752

test-commit-2

parent 96df85c5
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
</div> </div>
<p-dialog #messageEngine [(visible)]="showChat" header="" [modal]="true" [responsive]="true" <p-dialog #messageEngine [(visible)]="showChat" header="" [modal]="true" [responsive]="true"
class="message-engine" [style]="{width: '300px', height: '500px'}"> class="message-engine" [style]="{width: '300px', height: '500px'}">
<app-message-engine-applicant-view *ngIf="showChat" [embedded]="true" <app-message-engine-applicant-view *ngIf="showChat" [embedded]="true" [jobId]="jobId" [loggedInId]="loggedIn"
(minimize)="showChat = false"></app-message-engine-applicant-view> (minimize)="showChat = false"></app-message-engine-applicant-view>
</p-dialog> </p-dialog>
<div *ngIf="showBubble" class="chat-icon" (click)="showChat = !showChat"></div> <div *ngIf="showBubble" class="chat-icon" (click)="showChat = !showChat"></div>
......
...@@ -6,6 +6,7 @@ import { BsModalService } from 'ngx-bootstrap/modal'; ...@@ -6,6 +6,7 @@ import { BsModalService } from 'ngx-bootstrap/modal';
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
import { AppService } from '../../../app.service';
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 { MsgsService } from '../../../oneit/services/msgs.service';
import { UserService } from '../../../oneit/services/user.service'; import { UserService } from '../../../oneit/services/user.service';
...@@ -41,6 +42,8 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy { ...@@ -41,6 +42,8 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
}; };
showChat = false; showChat = false;
showBubble = false; showBubble = false;
jobId: string;
loggedIn: string;
constructor( constructor(
private deviceService: DeviceDetectorService, private deviceService: DeviceDetectorService,
...@@ -48,6 +51,7 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy { ...@@ -48,6 +51,7 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
private userService: UserService, private userService: UserService,
private adminPortalLayoutService: AdminPortalLayoutService, private adminPortalLayoutService: AdminPortalLayoutService,
private utilsService: UtilsService, private utilsService: UtilsService,
private appService: AppService,
private titleService: Title, private titleService: Title,
private router: Router, private router: Router,
private modalService: BsModalService, private modalService: BsModalService,
...@@ -57,19 +61,24 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy { ...@@ -57,19 +61,24 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
ngOnInit(): void { ngOnInit(): void {
// Subscribe to msgReceived of iframeMsgHandlingService to get JobId // Subscribe to msgReceived of iframeMsgHandlingService to get JobId
console.log('About to subscribe in Admin');
this.subscriptions.push(this.iframeMsgHandlingService.msgReceived.subscribe( this.subscriptions.push(this.iframeMsgHandlingService.msgReceived.subscribe(
(message: any) => { (message: any) => {
console.log('Admin Subscribed', message);
if (!message || !message.name) { if (!message || !message.name) {
this.clearMessageData();
return; return;
} }
if (message.name !== 'HiringTeamChat' || message.message === null) { if (message.name !== 'HiringTeamChat' || message.message === null) {
this.clearMessageData();
return; return;
} }
const msg = JSON.parse(message.message); const msg = JSON.parse(message.message);
console.log('Admin Parsed', msg); console.log('Admin Parsed', msg);
this.jobId = msg.JobApplicationID;
this.loggedIn = msg.CandidateID;
console.log('Admin Values:', this.jobId, this.loggedIn);
// Show Chat bubble if message service allows // Show Chat bubble if message service allows
this.showBubble = true; this.showBubble = true;
} }
...@@ -197,6 +206,11 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy { ...@@ -197,6 +206,11 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
); );
} }
clearMessageData(): void {
this.jobId = null;
this.loggedIn = null;
}
ngOnDestroy(): void { ngOnDestroy(): void {
this.utilsService.unsubscribeSubscriptions(this.subscriptions); this.utilsService.unsubscribeSubscriptions(this.subscriptions);
} }
......
...@@ -117,7 +117,17 @@ M202.992,332.528v124.517l58.738-67.927L202.992,332.528z"></path> ...@@ -117,7 +117,17 @@ M202.992,332.528v124.517l58.738-67.927L202.992,332.528z"></path>
</form> </form>
<div class="ui-g ui-fluid" *ngIf="!jobId || !loggedInId"> <div class="ui-g ui-fluid" *ngIf="!jobId || !loggedInId">
<div class="ui-g-12 ui-md-12"> <div class="ui-g-12 ui-md-12">
<p>Nothing to show here!</p> <div class="main-tab-template pl-1 {{embedded ? 'h-45' : '' }}">
<div class="chief-officer mb-0">
<a [routerLink]="[previousUrl]" class="arrow-btn-blue ml-0" *ngIf="!embedded">
<img src="assets/images/arrow-left-prev_blue.svg">
</a>
Please select an application and a user...
</div>
<a class="arrow-btn-blue ml-0 ng-star-inserted minimize" *ngIf="embedded" (click)="minimize.emit()">
<img src="assets/images/arrow-left-prev_blue.svg">
</a>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -32,6 +32,8 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -32,6 +32,8 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
subscriptions: Array<Subscription> = []; subscriptions: Array<Subscription> = [];
@ViewChild('form') form: NgForm; @ViewChild('form') form: NgForm;
@ViewChild('message') messageEditor: Editor; @ViewChild('message') messageEditor: Editor;
@Input() jobId = null;
@Input() loggedInId = null;
createdObjs = {}; createdObjs = {};
updatedObjs = {}; updatedObjs = {};
deletedObjs = {}; deletedObjs = {};
...@@ -40,8 +42,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -40,8 +42,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
sentViaEnum: Array<SentViaEnum>; sentViaEnum: Array<SentViaEnum>;
Message = new MessageModel(); Message = new MessageModel();
apiUrl = environment.baseUrl; apiUrl = environment.baseUrl;
jobId: string;
loggedInId: string;
showLoader = false; showLoader = false;
previousUrl: string; previousUrl: string;
...@@ -66,24 +66,9 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -66,24 +66,9 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
ngOnInit(): void { ngOnInit(): void {
this.utilsService.resetCounter(); 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;
}
if (message.name !== 'HiringTeamChat' || message.message === null) {
return;
}
const msg = JSON.parse(message.message);
console.log('Parsed', msg);
this.jobId = msg.JobApplicationID;
this.showLoader = true; this.showLoader = true;
console.log('Job', this.jobId);
this.subscriptions.push( this.subscriptions.push(
this.appService.getTypes('SentVia') this.appService.getTypes('SentVia')
.subscribe((data: Array<SentViaEnum>) => { .subscribe((data: Array<SentViaEnum>) => {
...@@ -92,19 +77,21 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -92,19 +77,21 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
if (this.embedded) { if (this.embedded) {
if (this.adminPortalLayoutService.userData) { if (this.adminPortalLayoutService.userData) {
this.loggedInId = this.adminPortalLayoutService.userData.CompanyUser.User; this.loggedInId = this.adminPortalLayoutService.userData.CompanyUser.User;
console.log('Already Engine -> User', this.loggedInId);
this.initComponent(); this.initComponent();
} else { } else {
this.subscriptions.push(this.adminPortalLayoutService.userDataUpdated this.subscriptions.push(this.adminPortalLayoutService.userDataUpdated
.first() .first()
.subscribe(() => { .subscribe(() => {
this.loggedInId = this.adminPortalLayoutService.userData.CompanyUser.User; this.loggedInId = this.adminPortalLayoutService.userData.CompanyUser.User;
console.log('Engine -> User', this.loggedInId);
this.initComponent(); this.initComponent();
})); }));
} }
} else { } else {
// For applicant // For applicant
this.embedded = false; this.embedded = false;
// this.loggedInId = msg.CandidateID; console.log('Applicant Engine -> User', this.loggedInId);
this.initComponent(); this.initComponent();
// Use candidate ID fetched from iFrameService // Use candidate ID fetched from iFrameService
} }
...@@ -112,9 +99,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement ...@@ -112,9 +99,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
); );
} }
));
}
initComponent(): void { initComponent(): void {
if (this.jobId) { if (this.jobId) {
......
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