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 0a95b6c..bc7dba3 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 @@ -26,12 +26,10 @@ export class PdStatusChangeDialogueComponent implements OnInit { usertype: string; vendorOfficerList: any; errorMessage: any; - updateData: { - pd_id: any; - // "fk_pd_allocated_to":allocateDetails.fk_user_id, - fk_pd_allocated_to: any; pd_agency_id: any; - }; - + updateData:any = {}; + public userRoleID = +localStorage.getItem('user_role'); + public userID = +localStorage.getItem('userid'); + constructor(notifier: NotifierService , private pd: PdTrigerService,private dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data: any) { this.notifier = notifier; @@ -41,6 +39,7 @@ 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.dialogType = this.data.dialogType; + } ngOnInit() { @@ -76,8 +75,7 @@ export class PdStatusChangeDialogueComponent implements OnInit { this.pd.getvendorlist(this.data.state_id).subscribe( list => { - console.log('list'); - console.log(list); + // console.log('getSmcVendorPdOfficerList1 fns entered result => ',list); if(list['status'] == '200') { this.vendorOfficerList= list['records'] @@ -95,14 +93,15 @@ export class PdStatusChangeDialogueComponent implements OnInit { changePDStatus(status: string,pdid): void { let pd=pdid; - // console.log(status); - // //return; + // console.log("At changePDStatus fns, Status = ",status); this.usertype=localStorage.getItem('usertype'); - console.log(this.dialogType,this.enableAddonPD) + // console.log("Dialog Type = ",this.dialogType); + // console.log("enableAddonPD = ",this.enableAddonPD); if(this.dialogType == 'actionOnly' && !this.enableAddonPD) { this.dialogRef.close({update_status:true}); return; } + if(this.usertype=='true') { @@ -112,8 +111,7 @@ export class PdStatusChangeDialogueComponent implements OnInit { "random_string":this.data.random_string }; this.pd.updateVendorStatus(update_status, status).subscribe(result => { - console.log('result'); - console.log(result); + // console.log('updateVendorStatus api Result = ',result); if (result.status == 200) { this.dialogRef.close({update_status:true}); this.notifier.notify('success', this.data.pd_status=='INPROGRESS' ? 'Discussions Started Successfully' : this.data.pd_status=='COMPLETED' ? 'Completed Successfully' : this.data.pd_status=='BOUNCED' ? 'PD Rejected Successfully' :'Discussions Updated Successfully'); @@ -149,10 +147,6 @@ export class PdStatusChangeDialogueComponent implements OnInit { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); }); } - if(status=='INPROGRESS') - { - this.selfallocate(pd); - } } selfallocate(pd) { @@ -160,9 +154,12 @@ export class PdStatusChangeDialogueComponent implements OnInit { this.updateData = { "pd_id":pd, "fk_pd_allocated_to":localStorage.getItem('userid'), - "pd_agency_id":localStorage.getItem('user_role')=='28'|| localStorage.getItem('user_role')=='29'?localStorage.getItem('smc_agency_id'):localStorage.getItem('user_role') } - console.log(this.updateData); + if((localStorage.getItem('smc_agency_id') != "") && (this.userRoleID==28|| this.userRoleID==29)){ + this.updateData.pd_agency_id =localStorage.getItem('smc_agency_id'); + } + // else{ this.notifier.notify('warning', 'agency-id not available');} + // return this.pd.updatePdOfficer(this.updateData).subscribe( result => { @@ -184,4 +181,4 @@ export class PdStatusChangeDialogueComponent implements OnInit { } -} +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 8fda757..f40c72d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -205,19 +205,15 @@
- -
+
{{master.pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : master.pd_status==pdStatusCheck.ALLOCATED_TO_FIA ?'Allocated to vendor':master.pd_status | titlecase}}
-
+
{{master.pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : master.pd_status==pdStatusCheck.ALLOCATED_TO_FIA ?'Allocated to vendor':master.pd_status | titlecase}}

{{(master.vendor_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : (master.vendor_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : master.vendor_status)) | titlecase}}

-
- -
+
@@ -228,9 +224,10 @@ - +
-
+
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index 9aa3a30..3db64ba 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -147,7 +147,6 @@ export class ViewPdComponent implements OnInit, OnDestroy { ngOnInit() { this.userRoleType=localStorage.getItem('user_role'); - if(this.userRoleType=='28' || this.userRoleType=='29') { this.is_agency_logged_in=true; @@ -358,11 +357,17 @@ export class ViewPdComponent implements OnInit, OnDestroy { // start pd getPDStart(pdDetails: any, status: string) { - console.log(pdDetails); - // console.log(pdDetails.fk_pd_id); - // console.log('pddetails'); + // console.log("status = ",status); + // console.log("pdDetails",pdDetails,pdDetails.fk_pd_id); localStorage.setItem('pdid',pdDetails.fk_pd_id) this.destroyType = 3; + let doSelfAllocated = 0;/** this for flag **/ + if((status == this.pdStatusCheck.ALLOCATED || status == this.pdStatusCheck.ALLOCATED_TO_FIA) && (this.userRoleID == 27 || this.userRoleID == 28) && this.userId != pdDetails.fk_pd_allocated_to){ + /* console.log("if for flag",status); + doSelfAllocated = 1;*/ + this.selfallocate(pdDetails.fk_pd_id); + // new Promise( resolve => setTimeout(resolve, 300) ); + } if (status == this.pdStatusCheck.ALLOCATED || status == this.pdStatusCheck.SCHEDULED || status == this.pdStatusCheck.TRIGGERED||status == this.pdStatusCheck.ALLOCATED_TO_FIA) { const dialogRef = this.dialog.open(PdStatusChangeDialogueComponent, { data: { pdid: pdDetails.assigned_pd, pd_status: this.pdStatusCheck.INPROGRESS,random_string:this.pdMasterData[0].random_string }, @@ -378,7 +383,6 @@ export class ViewPdComponent implements OnInit, OnDestroy { }); } else { - this.router.navigate(['../../../startpd', pdDetails.assigned_pd,this.masterRandomString], { relativeTo: this.route }); } } @@ -603,8 +607,8 @@ dialogRef1.afterClosed().subscribe(rr=>{ } /** To update pd officer*/ selfAllocation(state_id) { - // console.log('allocate'); - // console.log(this.pdMasterData[0].fk_city); + // console.log('selfAllocation city = ',this.pdMasterData[0].fk_city); + // console.log(this.pdMasterData[0]); // return if((this.LenderRoleID == '27') || (this.LenderRoleID == '25') || (this.LenderRoleID == '28')){ const dialogRef1 = this.dialog.open(PdAllocationComponent, { @@ -717,7 +721,6 @@ dialogRef1.afterClosed().subscribe(rr=>{ } cancelPD(pdDetails: any){ - console.log("cancelPD fns entered"); const dialogRef = this.dialog.open(PdCancellationDialogueComponent, { data: { pdid: pdDetails.assigned_pd, pd_status: this.pdStatusCheck.CANCELLED ,random_string:this.masterRandomString}, disableClose: true, @@ -743,6 +746,30 @@ dialogRef1.afterClosed().subscribe(rr=>{ // } // this.viewPdDetails(this.childData); // } + selfallocate(pd) + { + + let updateData : any = { + "pd_id":pd, + "fk_pd_allocated_to":localStorage.getItem('userid'), + } + console.log('updateData obj gotten -> ',updateData); + // return + this._pd.updatePdOfficer(updateData).subscribe( + result => { + if (result.status == 200) { + this.notifier.notify('success', 'Self Allocated.!'); + } + else { + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); + this.errorMessage = "Something Went Wrong Try Again.!"; + } + }, error => { + 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.!'); + this.errorMessage = "Some Thing Wents Wrong Try Again.!"; + }); + } + ngOnDestroy(): void { if (this.destroyType == 1) { this.ListPdComponent.pdListLoad(true);