TelePD Feedback changes, allocated pd only displayed for pd officers and video chat securities are implemented

This commit is contained in:
venbatechnologies@gmail.com 2020-05-27 13:48:58 +05:30
parent 2710a54251
commit 1c81c2a59e
11 changed files with 128 additions and 42 deletions

View File

@ -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') {

View File

@ -26,5 +26,7 @@
<button mat-raised-button mat-dialog-close><strong> No </strong></button>
</mat-dialog-actions>
<mat-dialog-actions align="end" *ngIf="!CompletenessCheck">
<button mat-raised-button color="primary" (click)="overwritten_pd()"
*ngIf="fk_pd_type == '3'"> <strong>Complete anyway </strong></button>&nbsp;&nbsp;
<button mat-raised-button mat-dialog-close><strong> Ok </strong></button>
</mat-dialog-actions>

View File

@ -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<PdStatusChangeDialogueComponent>,@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;
}
});
}
}

View File

@ -500,7 +500,7 @@
</div><br/>
<div style="width:auto" *ngIf="financialForm.value.kuccha_records_shown == 'yes'">
<mat-label *ngIf="fk_pd_type != '3'">Photograph of Kuchha bills allowed</mat-label><br/>
<mat-label *ngIf="fk_pd_type == '3'">Photographs of kuccha bills uploded</mat-label><br/>
<mat-label *ngIf="fk_pd_type == '3'">Photographs of kuccha bills uploaded</mat-label><br/>
<mat-radio-group formControlName="kuccha_bill_allowed" >
<mat-radio-button value="yes">Yes
</mat-radio-button>&nbsp;&nbsp;

View File

@ -37,14 +37,16 @@
</mat-cell>
</ng-container>
<ng-container matColumnDef="is_person_met">
<mat-header-cell *matHeaderCellDef> Is Person Met </mat-header-cell>
<mat-header-cell *matHeaderCellDef> <span *ngIf="pd_all_details.pdmaster_details.fk_pd_type == '3'">Person Contacted</span>
<span *ngIf="pd_all_details.pdmaster_details.fk_pd_type != '3'">Is Person Met</span> </mat-header-cell>
<mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i">
<mat-checkbox class="table-checkbox" color="primary"
formControlName="is_person_met" (change)="split_customer_abbr == 'SAL' ? salariedcheck() : ''"></mat-checkbox>
</mat-cell>
</ng-container>
<ng-container matColumnDef="is_applicant">
<mat-header-cell *matHeaderCellDef> Is Applicant </mat-header-cell>
<mat-header-cell *matHeaderCellDef> <span *ngIf="pd_all_details.pdmaster_details.fk_pd_type == '3'">Is Loan applicant</span>
<span *ngIf="pd_all_details.pdmaster_details.fk_pd_type != '3'"> Is Applicant </span></mat-header-cell>
<mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i">
<mat-checkbox class="table-checkbox" color="primary"
formControlName="is_applicant" (change)="split_customer_abbr == 'SAL' ? salariedcheck() : ''"></mat-checkbox>

View File

@ -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}
}

View File

@ -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%',

View File

@ -184,7 +184,13 @@ export class PdTrigerService {
// get pd details
getPdDetails(): Observable<any> {
return this._http.get<any>(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<any>(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<any> {
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<any[]>(this.apiUrl + "listLessPDDetails/get", tabStatus)
.pipe(
catchError(this.handleError('operation', []))

View File

@ -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)
// });
// }
}

View File

@ -1,9 +1,14 @@
<div fxLayout="column">
<div align="end" style="float:right;padding: 10px !important;" fxLayoutAlign="flex-end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="reset"
matTooltipPosition="right" (click)="clearRandomString()" *ngIf="!is_video_enable" >
<mat-icon>cached</mat-icon>
</button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
matTooltipPosition="right" (click)="close_all()">
<mat-icon>close</mat-icon>
</button>
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
matTooltipPosition="right" (click)="stopRecording()">
<mat-icon>stop</mat-icon>
@ -29,7 +34,7 @@
</div> -->
<!-- <button type="button" class="btn btn-primary" (click)="connect()" >Connect</button> -->
<!-- <button type="button" (click)="message()">Send Message</button> -->
<div style="text-align: center;float:center" fxLayout="row" fxLayoutAlign="center" fxLayoutGap = "25px" >
<div style="text-align: center;float:center" fxLayout="row" fxLayoutAlign="center" fxLayoutGap = "35px" >
<!-- <button type="button" style="width: 90px" (click)="switch_camera()" class="btn btn-primary btn-lg" disabled #camera_switch>Switch</button> -->
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Switch Camera"
matTooltipPosition="above" (click)="switch_camera()" disabled #camera_switch >
@ -41,14 +46,14 @@
matTooltipPosition="above" *ngIf="peerVideoEnable"><mat-icon>call_end</mat-icon></button><br/> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Video Off / On"
matTooltipPosition="above" (click)="videoHandling()" *ngIf="peerVideoEnable">
<mat-icon *ngIf="video_mute">videocam_off</mat-icon>
<mat-icon *ngIf="!video_mute">videocam</mat-icon>
</button>
<mat-icon *ngIf="!video_mute">videocam_off</mat-icon>
<mat-icon *ngIf="video_mute">videocam</mat-icon>
</button>&nbsp;&nbsp;&nbsp;
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Mic Off / On"
matTooltipPosition="above" (click)="micMuteHandling()" *ngIf="peerVideoEnable">
<mat-icon *ngIf="mic_mute">mic_off</mat-icon>
<mat-icon *ngIf="!mic_mute">mic</mat-icon>
</button>
<mat-icon *ngIf="!mic_mute">mic_off</mat-icon>
<mat-icon *ngIf="mic_mute">mic</mat-icon>
</button>&nbsp;&nbsp;&nbsp;
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Disconnect"
matTooltipPosition="above" (click)="disconnect()" >
<mat-icon>call_end</mat-icon>
@ -57,7 +62,7 @@
</div>
<div fxLayoutAlign="center center" *ngIf="!is_video_enable" >
<div fxLayout="column" fxLayoutAlign="center center" style="position: absolute;bottom: 30%">
<div fxLayout="row">
<div fxLayout="row" *ngIf="start_btn_enable">
<button mat-raised-button type="button" matTooltip="Start Video Chat" matTooltipPosition = "above" (click)="start_Calling('init')">
<mat-icon>videocam</mat-icon>
Start Video Chat
@ -66,7 +71,7 @@
<!-- </div> -->
<!-- <div fxLayout="column"> -->
<div class="note-label">
<p>Note : Make sure the Reciever is waiting for your call before start Calling</p>
<p>{{displayMsg}}</p>
</div>
<!-- </div> -->
</div>

View File

@ -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<VideoChatComponent>,
@ -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();
}
}
}