From ff124fe27041d8a78e8fa240f1713d6d951ed807 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Sat, 18 Nov 2023 21:04:12 +0530 Subject: [PATCH] Radio button : ps --- .../dynamic-question-template.component.html | 120 +++++++++++------- .../dynamic-question-template.component.ts | 1 + .../list-pd/view-pd/view-pd.component.html | 106 +++++++++------- .../list-pd/view-pd/view-pd.component.ts | 50 ++++++++ .../pd-service/pd-triger.service.ts | 7 + 5 files changed, 195 insertions(+), 89 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html index 6291203..6be79ac 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html @@ -1,13 +1,12 @@
-
+
{{parent_ques.sub_title}} -
+
- - + + {{parent_ques.question}} - - {{parent_ques.question}} - - - - {{val.answer}} - - - {{"₹"}} {{formGroupN.value[parent_ques.question_key] | numberToWords}} - - - - - {{validation.message}} - - + + {{parent_ques.question}} + + + + {{val.answer}} + + + {{"₹"}} {{formGroupN.value[parent_ques.question_key] | numberToWords}} + + + + + {{validation.message}} + +
@@ -60,18 +59,21 @@ [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}
- + {{validation.message}}
{{parent_ques.question}} - + Select add_circle_outline {{val.answer}} + (click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option">add_circle_outline {{val.answer}} @@ -84,11 +86,11 @@ {{val.answer}}
- - - {{validation.message}} - - {{formGroupN.value[parent_ques.question_key] | json}} + + + {{validation.message}} + + {{formGroupN.value[parent_ques.question_key] | json}}
@@ -155,8 +157,8 @@ {{parent_ques.question}} - + @@ -164,25 +166,53 @@ - + {{parent_ques.question}} - + - close + [noEntriesFoundLabel]="'No Matching Result'"> + close Select - add_circle_outline {{val.answer}} + (click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option">add_circle_outline {{val.answer}} {{validation.message}} + + + {{parent_ques.question}} + + + + + + {{validation.message}} + + + + + {{parent_ques.question}} + + + + + +
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts index e090ae9..f193fa2 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts @@ -6,6 +6,7 @@ import { Observable, ReplaySubject } from 'rxjs'; import { MatDialog } from '@angular/material'; import { AnswerOptionCreateDialogComponent } from '../../answer-option-create-dialog/answer-option-create-dialog.component'; import { LoaderService } from 'app/shared/loaderService/loader.service'; +import { DatePipe } from '@angular/common'; @Component({ selector: 'app-dynamic-question-template', 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 d7fc96c..20e8bc4 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 @@ -85,67 +85,86 @@
- - -
-
-
- {{master.pd_sno}} + + +
+
+
+ {{master.pd_sno}} +
+
-
-
- +
+ +
-
-
- {{master.lender_short_name}}
-

{{master.pd_type_name}}

-
-
- {{master.branch_name}} -
-
+
+
+ {{master.lender_short_name}}
+ +
+
+ {{master.branch_name}} +
+
-
- +
- -
-
-
- {{master.lender_applicant_id}} + +
+
+
+ + + {{ item.display_name }} + + +
+ +
+

{{item.display_name}}

-
- {{master.pd_date_of_initiation}} +
-
-
-
+
+ - -
+ +
+
+
+ {{master.lender_applicant_id}} +
+
+ {{master.pd_date_of_initiation}} +
+
+
+
+ + +
-
+
{{master.product_name}}
{{master.subproduct_name}} -
- +
-
+
-
+
Loan Amount -
-
+
+
{{master.loan_amount}}
-
+
-
+
@@ -153,9 +172,8 @@
{{master.loan_amount | numberToWords}} Only
-
- - + +
Lender Contact Details 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 5385b47..1d2431e 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 @@ -135,6 +135,17 @@ export class ViewPdComponent implements OnInit, OnDestroy { currentVendorStatus: any; pdAgencyid: any; dummyFlag:any; + defaultPDType: any ; + oldPDType :any; + credit_pd_type_list:any=[{ + fk_pd_type:"1", + original_name:"Full PD", + display_name:"Physical PD" + },{ + fk_pd_type:"3", + original_name:"Tele PD", + display_name:"Tele PD" + }]; constructor(notifier: NotifierService, private dialog: MatDialog, private _fb: FormBuilder, private _pd: PdTrigerService, private route: ActivatedRoute, private router: Router, private ListPdComponent: ListPdComponent, @@ -190,6 +201,11 @@ export class ViewPdComponent implements OnInit, OnDestroy { this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2); this.CustomerSegmentAbbr = this.pdMasterData[0].customer_segment_abbr; this.product=this.pdMasterData[0].product_abbr; + this.defaultPDType = this.pdMasterData[0].fk_pd_type; + this.oldPDType = this.pdMasterData[0].fk_pd_type; + console.log("0) this.defaultPDType = ",this.defaultPDType); + console.log("0.1) this.oldPDType = ",this.oldPDType); + this.pdDocumentsData = data.records.pd_documnets; this.masterPdLogsData = Object.keys(data.records.pd_logs.master).map(function (key) { return data.records.pd_logs.master[key]; @@ -244,6 +260,40 @@ export class ViewPdComponent implements OnInit, OnDestroy { this.ListPdComponent.pdListLoad(true); } + changePDTypeValue(event: any) { + const isConfirmed = window.confirm(`Are you sure you want to change PD Type?`); + if (isConfirmed && event.value !== this.oldPDType) { + + let template = { + "pd_id": this.viewID, + "random_string": this.pdMasterData[0].random_string, + "fk_pd_type": event.value + }; + + this._pd.changePDTypeValue(template).subscribe((data: any) => { + if (data.dataStatus) { + // Only update defaultPDType if the API call is successful + this.defaultPDType = event.value; + console.log('API call successful. Navigating to the same route...'); + this.notifier.notify('success', 'Updated!'); + window.location.reload(); + } else { + // Handle error cases here + this.notifier.notify('warning', data.msg ? data.msg : 'Something Went Wrong. Try Again!'); + window.location.reload(); + } + }, (err: any) => { + // Handle error cases here + this.notifier.notify('warning', 'Something Went Wrong. Try Again!'); + window.location.reload(); + }); + } else { + this.defaultPDType = this.oldPDType; + window.location.reload(); + console.log('Canceled. PD Type remains unchanged.'); + } + } + // isactiveBranch(id: number,isactive : number){ // let ActiveDatas = isactive == 0 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 f5e2760..7c8e4b4 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 @@ -1093,4 +1093,11 @@ loadTemplate(form_id) { ) } + changePDTypeValue(editData: any): Observable { + editData.fk_updatedby = this._aws.getlocale(); + // return this._http.post("http://localhost/AWSEC2/sparqapi/api/updatePDMaster", { records: editData }) + return this._http.post(this.apiUrl + "updatePDMaster", { records: editData }) + .pipe(catchError(this.handleError('operation', []))) + } + }