From 1c81c2a59e1088092c23c08a7ade2e0ab726d550 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Wed, 27 May 2020 13:48:58 +0530 Subject: [PATCH] TelePD Feedback changes, allocated pd only displayed for pd officers and video chat securities are implemented --- .../layouts/admin/admin-layout.component.ts | 11 +++- .../pd-status-change-dialogue.component.html | 2 + .../pd-status-change-dialogue.component.ts | 21 +++++++- .../financial-info.component.html | 2 +- .../general-info/general-info.component.html | 6 ++- .../start-pd/forms/stock/stock.component.ts | 6 +-- .../list-pd/start-pd/start-pd.component.ts | 2 +- .../pd-service/pd-triger.service.ts | 19 ++++++- .../qc-list/qc-view/qc-view.component.ts | 28 +++++------ .../app/video-chat/video-chat.component.html | 23 +++++---- .../app/video-chat/video-chat.component.ts | 50 ++++++++++++++++--- 11 files changed, 128 insertions(+), 42 deletions(-) diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts index c13e0b077..f585a48a4 100755 --- a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts +++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts @@ -119,6 +119,7 @@ export class AdminLayoutComponent implements OnInit, OnDestroy { }); // this.alertForTAT(); this._notificationService.requestPermission(); + console.log("constructor called") } ngOnInit(): void { @@ -145,8 +146,14 @@ export class AdminLayoutComponent implements OnInit, OnDestroy { // Ps.update(elemContent); } }); + setTimeout(()=>{ this.listenForCalls() + },5000) // this.openIncomingDialog(); + console.log("Ng On Init") + } + ngAfterViewInit() { + console.log("Ng After view init") } @HostListener('click', ['$event']) @@ -325,11 +332,11 @@ export class AdminLayoutComponent implements OnInit, OnDestroy { // this.socket.on('BackOffer', this.connectPeer) let userrole = localStorage.getItem('user_role') if(userrole == '5') { + this.socket.fromEvent('BackOffer').subscribe((res:any)=>{ let pd_short_info:any = localStorage.getItem('pd_short_info') pd_short_info = JSON.parse(pd_short_info); - this.socket.fromEvent('BackOffer').subscribe((res:any)=>{ console.log(res) - if(res && res.hasOwnProperty('random_string') && res.random_string){ + if(res && res.hasOwnProperty('random_string') && res.random_string && res.hasOwnProperty('user_type') && res.user_type != 'officer'){ if(pd_short_info.filter(val=>val.random_string == res.random_string).length > 0){ let curr_pd_info= pd_short_info.filter(val=>val.random_string == res.random_string)[0] if(curr_pd_info && curr_pd_info.pd_type == '3') { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html index b458693ba..47a54f55b 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html @@ -26,5 +26,7 @@ +    \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts index fd872a492..f4f9bdb63 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts @@ -21,6 +21,8 @@ export class PdStatusChangeDialogueComponent implements OnInit { addonStatus: string ="ADD_ON_PENDING"; public Loading: boolean; public masterRandomString : string; + fk_pd_type: any; + pd_completeness_override: String = '0'; constructor(notifier: NotifierService , private pd: PdTrigerService,private dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data: any) { @@ -31,6 +33,8 @@ export class PdStatusChangeDialogueComponent implements OnInit { this.CompletenessCheck = this.data.pd_status=='INPROGRESS' ? true : this.data.pd_status=='COMPLETED' ? false : true; this.Loading = this.data.pd_status=='INPROGRESS' ? false : this.data.pd_status=='COMPLETED' ? true : false; this.masterRandomString = this.data.random_string; + this.fk_pd_type = this.data.pd_type + console.log("sdf@@@@@@@@@@2",this.fk_pd_type) } ngOnInit() { @@ -60,9 +64,10 @@ export class PdStatusChangeDialogueComponent implements OnInit { } changePDStatus(status: string): void { - let update_status = { + let update_status:any = { "pd_id":this.data.pdid, }; + update_status.pd_completeness_override = this.pd_completeness_override this.pd.editPdMasterDetails(update_status, status,this.masterRandomString).subscribe(result => { if (result.status == 200) { this.dialogRef.close({update_status:true}); @@ -77,5 +82,17 @@ export class PdStatusChangeDialogueComponent implements OnInit { this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); }); } - + overwritten_pd() { + // this.changePDStatus(this.data.pd_status,'1'); + let params: any={}; + params.pd_id = this.data.pdid; + this.CompletenessCheck = true; + this.pd_completeness_override = '1' + // this.Loading = false; + this.pd.getPDCompleteDetails(params).subscribe(result => { + if (result.dataStatus === true) { + this.enableAddonPD = result.records.address_count>0 ? true: false; + } + }); + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html index b1f6d4669..6b2f3cfd6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html @@ -500,7 +500,7 @@
Photograph of Kuchha bills allowed
- Photographs of kuccha bills uploded
+ Photographs of kuccha bills uploaded
Yes    diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html index 0d5fb42a5..e738c9cb1 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html @@ -37,14 +37,16 @@ - Is Person Met + Person Contacted + Is Person Met - Is Applicant + Is Loan applicant + Is Applicant diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts index 8f6f7907d..de4ae1354 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts @@ -89,9 +89,9 @@ export class StockComponent implements OnInit { this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; this.fk_pd_type = this.pd_all_details.pdmaster_details.fk_pd_type; if(this.fk_pd_type == '3'){ - this.SPsufficientList.push({value:"not able to access",isdisplayvalue:"Not able to access",isdisabled:false}) - this.TGsufficientList.push({value:"not able to access",isdisplayvalue:"Not able to access",isdisabled:false}) - this.RMsufficientList.push({value:"not able to access",isdisplayvalue:"Not able to access",isdisabled:false}) + this.SPsufficientList.push({value:"not able to assess",isdisplayvalue:"Not able to assess",isdisabled:false}) + this.TGsufficientList.push({value:"not able to assess",isdisplayvalue:"Not able to assess",isdisabled:false}) + this.RMsufficientList.push({value:"not able to assess",isdisplayvalue:"Not able to assess",isdisabled:false}) } this.image_doc_params={pdid:this.pdid,form_id:this.form_id,company_id:this.company_id} } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts index 1b2771c14..4cde14ecb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts @@ -140,7 +140,7 @@ export class StartPdComponent implements OnInit, OnDestroy { // load pd status change dialogue pdStatusDialogue(status: string, checkType: number): void { const dialogRef = this.dialog.open(PdStatusChangeDialogueComponent, { - data: { pdid: this.startPD, pd_status: status ,random_string:this.randomString }, + data: { pdid: this.startPD, pd_status: status ,random_string:this.randomString,pd_type:this.pdMasterList.fk_pd_type }, disableClose: true, minWidth:'30%', maxWidth:'40%', diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 0b8d95458..57294939a 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -184,7 +184,13 @@ export class PdTrigerService { // get pd details getPdDetails(): Observable { - return this._http.get(this.apiUrl + "listLessPDDetails/get") + let userrole = localStorage.getItem('user_role') + let params + if(userrole == '5') { + let userid = this._aws.getlocale() + params = new HttpParams().set("pdofficerid",userid); //Create new HttpParams + } + return this._http.get(this.apiUrl + "listLessPDDetails/get", {params: params}) .map(res=>{ if(res['dataStatus']) { let pd_det = res['records'].map(val=>{ return {applicant_name:val.applicant_name,pd_id:val.pd_id,random_string:val.random_string,pd_sno:val.pd_sno,pd_type:val.fk_pd_type}}) @@ -199,8 +205,17 @@ export class PdTrigerService { // get status based pd list getTabStatusPdDetails(status: string): Observable { - const tabStatus = status ? + let userrole = localStorage.getItem('user_role') + let tabStatus + if(userrole == '5') { + let userid = this._aws.getlocale() + tabStatus = new HttpParams().set("pdofficerid",userid).set('status', status); //Create new HttpParams + tabStatus = { params: new HttpParams().set("pdofficerid",userid).set('status', status) }; + } + else { + tabStatus = status ? { params: new HttpParams().set('status', status) } : {}; + } return this._http.get(this.apiUrl + "listLessPDDetails/get", tabStatus) .pipe( catchError(this.handleError('operation', [])) diff --git a/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.ts b/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.ts index 0fd9ffcee..b54572021 100755 --- a/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.ts +++ b/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.ts @@ -193,7 +193,7 @@ export class QcViewComponent implements OnInit, OnDestroy { // pd allocation to pdAllocationTo(pdData:any,childData: any) { pdData.pd_id = childData.assigned_pd; - if(pdData.fk_pd_type == 1){ + if (pdData.fk_pd_type == 1 || pdData.fk_pd_type == 3) { const dialogRef = this.dialog.open(PdAllocationComponent, { data: pdData, position: { right: '0'}, @@ -220,20 +220,20 @@ export class QcViewComponent implements OnInit, OnDestroy { this.viewPdDetails(this.viewID,this.masterRandomString) }); } - else if(pdData.fk_pd_type == 3){ - const dialogRef = this.dialog.open(TelePdAllocationComponent, { - data: pdData, - position: { right: '0'}, - width: '80%', - disableClose: true, - }); - dialogRef.afterClosed() - .subscribe(dataresult => { - // this.notifier.notify('success', 'Successfully allocated.!'); + // else if(pdData.fk_pd_type == 3){ + // const dialogRef = this.dialog.open(TelePdAllocationComponent, { + // data: pdData, + // position: { right: '0'}, + // width: '80%', + // disableClose: true, + // }); + // dialogRef.afterClosed() + // .subscribe(dataresult => { + // // this.notifier.notify('success', 'Successfully allocated.!'); - this.viewPdDetails(this.viewID,this.masterRandomString) - }); - } + // this.viewPdDetails(this.viewID,this.masterRandomString) + // }); + // } } diff --git a/ng6-seed/src/app/video-chat/video-chat.component.html b/ng6-seed/src/app/video-chat/video-chat.component.html index 4f3837a84..9539d6f88 100644 --- a/ng6-seed/src/app/video-chat/video-chat.component.html +++ b/ng6-seed/src/app/video-chat/video-chat.component.html @@ -1,9 +1,14 @@
+ + -
+
+ videocam_off + videocam +     + mic_off + mic +    
-
+
diff --git a/ng6-seed/src/app/video-chat/video-chat.component.ts b/ng6-seed/src/app/video-chat/video-chat.component.ts index 287159909..e5f8b1062 100644 --- a/ng6-seed/src/app/video-chat/video-chat.component.ts +++ b/ng6-seed/src/app/video-chat/video-chat.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ChangeDetectorRef, ViewChild, Inject } from '@angular/core'; +import { Component, OnInit, ChangeDetectorRef, ViewChild, Inject, HostListener } from '@angular/core'; import { Observable } from 'rxjs'; import { PushNotifyService } from 'app/shared/push-notify.service'; import { Socket } from 'ngx-socket-io'; @@ -30,6 +30,8 @@ export class VideoChatComponent implements OnInit { video_mute: boolean = true; user_msg: string; recorder: any; + start_btn_enable:boolean = true + displayMsg:string = "Note : Make sure the Reciever is waiting for your call before start Calling" constructor(private _notificationService:PushNotifyService, private cdRef: ChangeDetectorRef,private socket: Socket, private dialogRef: MatDialogRef, @@ -147,12 +149,12 @@ export class VideoChatComponent implements OnInit { if(data.hasOwnProperty('type') && data.type == 'offer'){ console.log("entered!!!!!!!!!!!!!!!!1"); this.user_msg = "Calling..." - let event_data = {JSON_to_connect:data,type:'offer',random_string:this.chat_info.random_string} + let event_data = {JSON_to_connect:data,type:'offer',random_string:this.chat_info.random_string,user_type:"officer"} this.socket.emit('Offer', event_data) } else if(data.type == 'answer' ){ this.user_msg = "Waiting For Connection..." - let event_data = {JSON_to_connect:data,type:'answer',random_string:this.chat_info.random_string} + let event_data = {JSON_to_connect:data,type:'answer',random_string:this.chat_info.random_string,user_type:"officer"} this.socket.emit('Answer', event_data) } // copyMessage(JSON.stringify(data)) @@ -227,9 +229,9 @@ export class VideoChatComponent implements OnInit { peerx.signal(answer.JSON_to_connect); },1000) } - function getPeer(){ - return JSON.stringify(copyMessageText) - } + // function getPeer(){ + // return JSON.stringify(copyMessageText) + // } // if(JSON.parse(copyMessageText).hasOwnProperty('type') && JSON.parse(copyMessageText).type == 'offer') // { // setTimeout(()=>{ @@ -246,6 +248,12 @@ export class VideoChatComponent implements OnInit { console.log('Failed to get stream', err); alert('Failed to get stream '+err); }); + this.socket.on('callStatusMessage',this.updateTheMsg) + this.socket.fromEvent('callStatusMessage').subscribe(res=>{ + if(res) { + this.updateTheMsg(res) + } + }) // function update(){ // console.log(copyMessageText) // setTimeout(()=>{ @@ -267,6 +275,17 @@ export class VideoChatComponent implements OnInit { // socket.on('CreatePeer', MakePeer) // socket.on('Disconnect', RemovePeer) } + updateTheMsg(msg_obj) { + console.log("CallstatusMsg",msg_obj) + if(msg_obj && msg_obj.status_code == 2){ + console.log("entered"); + this.start_btn_enable = false + this.displayMsg = msg_obj.msg + // this.cdRef.detectChanges(); + this.disconnect(); + + } + } fetchVideoAndPlay(stream,videotype,enablePeerVideo?) { console.log("12@@@@@@@@@2",enablePeerVideo) @@ -283,6 +302,7 @@ export class VideoChatComponent implements OnInit { this.peervideo.nativeElement.style.marginTop = '0px' } this.peerVideoEnable = enablePeerVideo + this.socket.emit('callStatus',{random_string:this.chat_info.random_string,status:'connected',status_code:1}) // this.camereSwitchBtn.nativeElement.disabled = true; console.log("peervideo check",this.peerVideoEnable,this.peervideo.nativeElement.videoWidth,this.peervideo.nativeElement.videoHeight); this.cdRef.detectChanges(); @@ -379,15 +399,18 @@ export class VideoChatComponent implements OnInit { } disconnect() { console.log(this.peer) + if(this.peer) { this.peer.destroy(); this.peerVideoEnable = false this.targetpeer = '' this.peer = '' // this.cdRef.detectChanges(); + this.socket.emit('callStatus',{random_string:this.chat_info.random_string,status:'disconnected',status_code:0}) this.peervideo.nativeElement.pause(); this.stopRecording().then(res=>{ }) + } console.log(this.MediaStream.getTracks()) // this.MediaStream.stop() // var track = this.MediaStream.getTracks()[0]; // if only one media track @@ -451,5 +474,20 @@ export class VideoChatComponent implements OnInit { this.cdRef.detectChanges(); this.MediaStream.getVideoTracks()[0].enabled = this.video_mute; } + clearRandomString() { + if(this.peer) { + this.disconnect() } + else{ + this.socket.emit('callStatus',{random_string:this.chat_info.random_string,status:'disconnected',status_code:0}) + } + } + + @HostListener('window:beforeunload', ['$event']) + unloadHandler(event) { + console.log("unload caled",event); + if(this.peerVideoEnable) { + this.disconnect(); + } + } }