Commit 90419759 by GD-A-150752

test-commit-2

parent 9dd300cd
......@@ -105,7 +105,7 @@
</div>
<p-dialog #messageEngine [(visible)]="showChat" header="" [modal]="true" [responsive]="true"
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>
</p-dialog>
<div *ngIf="showBubble" class="chat-icon" (click)="showChat = !showChat"></div>
......
......@@ -6,6 +6,7 @@ import { BsModalService } from 'ngx-bootstrap/modal';
import { DeviceDetectorService } from 'ngx-device-detector';
import { Subscription } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { AppService } from '../../../app.service';
import { IframeMsgHandlingService } from '../../../oneit/services/iframe-msg-handling.service';
import { MsgsService } from '../../../oneit/services/msgs.service';
import { UserService } from '../../../oneit/services/user.service';
......@@ -41,6 +42,8 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
};
showChat = false;
showBubble = false;
jobId: string;
loggedIn: string;
constructor(
private deviceService: DeviceDetectorService,
......@@ -48,6 +51,7 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
private userService: UserService,
private adminPortalLayoutService: AdminPortalLayoutService,
private utilsService: UtilsService,
private appService: AppService,
private titleService: Title,
private router: Router,
private modalService: BsModalService,
......@@ -57,19 +61,24 @@ 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) {
this.clearMessageData();
return;
}
if (message.name !== 'HiringTeamChat' || message.message === null) {
this.clearMessageData();
return;
}
const msg = JSON.parse(message.message);
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
this.showBubble = true;
}
......@@ -197,6 +206,11 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
);
}
clearMessageData(): void {
this.jobId = null;
this.loggedIn = null;
}
ngOnDestroy(): void {
this.utilsService.unsubscribeSubscriptions(this.subscriptions);
}
......
......@@ -117,7 +117,17 @@ M202.992,332.528v124.517l58.738-67.927L202.992,332.528z"></path>
</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 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>
......@@ -32,6 +32,8 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
subscriptions: Array<Subscription> = [];
@ViewChild('form') form: NgForm;
@ViewChild('message') messageEditor: Editor;
@Input() jobId = null;
@Input() loggedInId = null;
createdObjs = {};
updatedObjs = {};
deletedObjs = {};
......@@ -40,8 +42,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
sentViaEnum: Array<SentViaEnum>;
Message = new MessageModel();
apiUrl = environment.baseUrl;
jobId: string;
loggedInId: string;
showLoader = false;
previousUrl: string;
......@@ -66,53 +66,37 @@ 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;
}
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.subscriptions.push(
this.appService.getTypes('SentVia')
.subscribe((data: Array<SentViaEnum>) => {
this.sentViaEnum = data;
// For Hiring Team
if (this.embedded) {
if (this.adminPortalLayoutService.userData) {
this.showLoader = true;
console.log('Job', this.jobId);
this.subscriptions.push(
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;
console.log('Already Engine -> User', this.loggedInId);
this.initComponent();
} else {
this.subscriptions.push(this.adminPortalLayoutService.userDataUpdated
.first()
.subscribe(() => {
this.loggedInId = this.adminPortalLayoutService.userData.CompanyUser.User;
console.log('Engine -> User', this.loggedInId);
this.initComponent();
} else {
this.subscriptions.push(this.adminPortalLayoutService.userDataUpdated
.first()
.subscribe(() => {
this.loggedInId = this.adminPortalLayoutService.userData.CompanyUser.User;
this.initComponent();
}));
}
} else {
// For applicant
this.embedded = false;
// this.loggedInId = msg.CandidateID;
this.initComponent();
// Use candidate ID fetched from iFrameService
}
})
);
}
));
}));
}
} else {
// For applicant
this.embedded = false;
console.log('Applicant Engine -> User', this.loggedInId);
this.initComponent();
// Use candidate ID fetched from iFrameService
}
})
);
}
......
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