Skip to content

Commit

Permalink
Merge pull request PSMRI#16 from KpParth/develop
Browse files Browse the repository at this point in the history
Change in logic for transfer dropdown for call type valid case
  • Loading branch information
devikasuresh20 authored Dec 21, 2023
2 parents c10dae2 + 52d4fc2 commit 706fbc3
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
56 changes: 43 additions & 13 deletions src/app/closure/closure.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { dataService } from "../services/dataService/data.service";
import { CallServices } from "../services/callservices/callservice.service";
import { FeedbackResponseModel } from "../sio-grievience-service/sio-grievience-service.component";
import { MdDialog } from "@angular/material";
import { Observable } from "rxjs/Rx";
import { Observable, Subscription } from "rxjs/Rx";
//import { Router } from '@angular/router';
import { Router } from "@angular/router";
import { ConfirmationDialogsService } from "./../services/dialog/confirmation.service";
Expand Down Expand Up @@ -141,6 +141,8 @@ export class ClosureComponent implements OnInit {
appointmnetSuccessFlag : boolean;
benDetailsSelectedData: any;
transferCallArr: Array<any> = [];
private benDetailSubscription: Subscription;


constructor(
public dialog: MdDialog,
Expand Down Expand Up @@ -174,6 +176,7 @@ export class ClosureComponent implements OnInit {

ngOnInit() {
console.log("@@@@@@@@@@@@@@@@@@@@");
this.saved_data.clearBenData();
this.currentLanguageSetValue();
let today = new Date();
this.followupOn = today;
Expand Down Expand Up @@ -296,6 +299,10 @@ export class ClosureComponent implements OnInit {
})
.subscribe((response) => this.IDsuccessHandeler(response));
}

ngOnDestroy(){
this.benDetailSubscription.unsubscribe();
}
IDsuccessHandeler(res) {
this.commonData = res;
if (this.saved_data.caste) {
Expand Down Expand Up @@ -437,10 +444,25 @@ export class ClosureComponent implements OnInit {
// if(this.current_role=="Supervisor"){
// this.roleFlag=false;

if (callType == "Valid" || callType == "Transfer" || callType == "Referral") {
this.validTrans = true;
this.nuisanceBLock = false;
} else {
if (callType.toLowerCase() === "valid" || callType.toLowerCase() === "transfer" || callType.toLowerCase() === "referral") {
this.nuisanceBLock = false;
this.benDetailSubscription = this.saved_data.isBenDetails$.subscribe((value) => {
this.benDetailsSelectedData = value;
if(this.benDetailsSelectedData === null || this.benDetailsSelectedData === undefined || this.benDetailsSelectedData === ""){
if(callType.toLowerCase() === "transfer"){
this.validTrans = true;
}
else{
this.validTrans = false;
}
}
else{
this.validTrans = true;
}
});

}
else {
this.validTrans = false;
this.nuisanceBLock = true; // this is done to disable S & COntinue in case of incomplete
}
Expand Down Expand Up @@ -566,7 +588,6 @@ export class ClosureComponent implements OnInit {
values.isFollowupRequired = this.doFollow;
values.isTransfered = this.doTransfer;
values.isFeedback = this.isFeedbackRequiredFlag;

if (values.isFollowupRequired == undefined) {
values.isFollowupRequired = false;
}
Expand Down Expand Up @@ -625,8 +646,12 @@ export class ClosureComponent implements OnInit {
values.isCompleted = true;
this.updateOutboundCallStatus(values);
}
// this.benDetailSubscription.unsubscribe();
console.log("BEN DETAILS CHECK***");
this.saved_data.clearBenData();
this.checkForSubmitCloseBtnType(btnType);
}

},
(err) => {
console.log(err);
Expand All @@ -639,9 +664,12 @@ export class ClosureComponent implements OnInit {
);
}
this.submitContinueBtnType(btnType);

}

}


setbenRegID(values) {
if (this.saved_data !== undefined && this.saved_data !== null) {
this.beneficiaryDetails =
Expand Down Expand Up @@ -891,6 +919,7 @@ export class ClosureComponent implements OnInit {
transferToCampaign,
"success"
);

sessionStorage.removeItem("onCall");
sessionStorage.removeItem("CLI");
this.router.navigate(["/MultiRoleScreenComponent/dashboard"]);
Expand All @@ -908,6 +937,7 @@ export class ClosureComponent implements OnInit {
);
}
}

}

transferEmergencyCallSuccessHandeler(response, transferToCampaign) {
Expand Down Expand Up @@ -1529,16 +1559,16 @@ export class ClosureComponent implements OnInit {

populateTransferDropDown(response: any) {
// this.benDetailsSelectedData = this.saved_data.benDetailsSelected;
this.saved_data.isBenDetails$.subscribe((value) => {
this.benDetailSubscription = this.saved_data.isBenDetails$.subscribe((value) => {
this.benDetailsSelectedData = value;

if ((this.current_role.toUpperCase() === "RO") && (this.benDetailsSelectedData === null || this.benDetailsSelectedData === undefined || this.benDetailsSelectedData === "")) {
if (response !== null || response !== undefined || response.length > 0) {
this.transferCallArr = response.filter(function (item) {
return item.subServiceName === 'Health Advisory Service';
});
}

if (response !== null || response !== undefined || response.length > 0) {
this.transferCallArr = response.filter(function (item) {
return item.subServiceName === 'Health Advisory Service';
});
}
}

else {
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/dataService/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,9 @@ export class dataService {
this.isBenDetails = value;
this.isBenDetailsData.next(this.isBenDetails);
}
clearBenData(){
this.isBenDetails = null;
this.isBenDetailsData.next(this.isBenDetails);
}

};

0 comments on commit 706fbc3

Please sign in to comment.