smc credit pd changes

This commit is contained in:
gayathri1990 2021-05-13 14:33:19 +05:30
parent 4804b63ebd
commit 0f931e79d9
6 changed files with 30 additions and 22 deletions

View File

@ -98,7 +98,8 @@ export class DynamicQuestionTemplateComponent implements OnInit {
// setTimeout(()=>{ // setTimeout(()=>{
// this.json_answers = null // this.json_answers = null
// },700) // },700)
} this.quesService.formanswers=null;
}
// console.log(this.parent_ques,this.formGroupN,this.whole_json ,this.json_answers); // console.log(this.parent_ques,this.formGroupN,this.whole_json ,this.json_answers);
// debugger; // debugger;

View File

@ -1,4 +1,4 @@
import { Injectable } from '@angular/core'; import { Injectable, Testability } from '@angular/core';
import { FormGroup, FormArray, FormBuilder, FormControl, Validators } from '@angular/forms'; import { FormGroup, FormArray, FormBuilder, FormControl, Validators } from '@angular/forms';
import { HttpClient, HttpParams } from '@angular/common/http'; import { HttpClient, HttpParams } from '@angular/common/http';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
@ -10,7 +10,7 @@ const apiUrl = environment.apiEndpoint
providedIn: 'root' providedIn: 'root'
}) })
export class QuesFormService { export class QuesFormService {
formanswers=null;
pd_all_details:any= {} pd_all_details:any= {}
datepipe: DatePipe; datepipe: DatePipe;
constructor(private _fb:FormBuilder,private http:HttpClient) { constructor(private _fb:FormBuilder,private http:HttpClient) {
@ -326,6 +326,9 @@ export class QuesFormService {
//param = param.set(val,params[val]) //param = param.set(val,params[val])
}) })
// console.log('13may');
// console.log(temp);
// console.log('13may');
if(params.hasOwnProperty("records")) if(params.hasOwnProperty("records"))
{ {
params.records=temp params.records=temp
@ -335,7 +338,8 @@ export class QuesFormService {
params=temp; params=temp;
} }
} }
console.log('may13');
console.log(params);
return this.http.post(apiUrl+api_name,params) return this.http.post(apiUrl+api_name,params)
} }
else{ else{

View File

@ -20,7 +20,7 @@
</mat-card-title> </mat-card-title>
</mat-card-header> --> </mat-card-header> -->
<mat-card-content> <mat-card-content>
<app-dynamic-form [questions_JSON]="questions_JSON" [form_group_name] = "commonFormGroup" [json_answers]="form_answers"></app-dynamic-form> <app-dynamic-form [questions_JSON]="questions_JSON" [form_group_name] = "commonFormGroup" [json_answers]="quesService.formanswers"></app-dynamic-form>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</mat-dialog-content> </mat-dialog-content>

View File

@ -37,8 +37,9 @@ export class FormComponent implements OnInit {
private router: Router, private router: Router,
private _pd: PdTrigerService, private _pd: PdTrigerService,
private dialogRef: MatDialogRef<FormComponent>, private dialogRef: MatDialogRef<FormComponent>,
private dialog: MatDialog, private quesService:QuesFormService, private dialog: MatDialog, public quesService:QuesFormService,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any, @Inject(MAT_DIALOG_DATA) public pd_all_details: any,
private pdTriggerService:PdTrigerService, private pdTriggerService:PdTrigerService,
private awsService:AwsService,private loaderService:LoaderService) { private awsService:AwsService,private loaderService:LoaderService) {
// console.log(this.pd_all_details) // console.log(this.pd_all_details)
@ -48,6 +49,7 @@ export class FormComponent implements OnInit {
this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id; this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id;
this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.notifier = notifier; this.notifier = notifier;
this.quesService.formanswers=null;
this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant;
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
@ -60,7 +62,8 @@ export class FormComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
//alert(this.formanswers)
//alert(this.quesService.formanswers);
console.log("answered",this.pd_all_details.is_answered) console.log("answered",this.pd_all_details.is_answered)
if(this.pd_all_details.is_answered == '1') { if(this.pd_all_details.is_answered == '1') {
this.getSectionData() this.getSectionData()
@ -77,7 +80,7 @@ export class FormComponent implements OnInit {
let params = {"fk_entity_id":this.pd_all_details.pdmaster_details.fk_lender_id,"fk_product_id":this.pd_all_details.pdmaster_details.fk_product_id,"pd_form_id":this.pd_all_details.form_id,"fk_pd_id":this.pd_all_details.pdmaster_details.pd_id} let params = {"fk_entity_id":this.pd_all_details.pdmaster_details.fk_lender_id,"fk_product_id":this.pd_all_details.pdmaster_details.fk_product_id,"pd_form_id":this.pd_all_details.form_id,"fk_pd_id":this.pd_all_details.pdmaster_details.pd_id}
this.pdTriggerService.loadCreditPDTemplate(params).subscribe(result=>{ this.pdTriggerService.loadCreditPDTemplate(params).subscribe(result=>{
if(!environment.production){ if(!environment.production){
// result.dataStatus = false //result.dataStatus = false
} }
if(result.dataStatus) { if(result.dataStatus) {
let question_template: any = result.records let question_template: any = result.records
@ -130,10 +133,10 @@ export class FormComponent implements OnInit {
if(records && records.hasOwnProperty('json') && records.json) { if(records && records.hasOwnProperty('json') && records.json) {
formValues = JSON.parse(records.json) formValues = JSON.parse(records.json)
// console.log(this.form) // console.log(this.form)
this.form_answers= formValues this.quesService.formanswers= formValues
setTimeout(()=>{ // setTimeout(()=>{
this.form_answers = null // this.quesService.formanswers = null
},2000) // },2000)
// this.commonFormGroup.patchValue(formValues) // this.commonFormGroup.patchValue(formValues)
} }
} }
@ -166,10 +169,10 @@ export class FormComponent implements OnInit {
this.commonFormGroup.patchValue(formValues) this.commonFormGroup.patchValue(formValues)
} }
else { else {
this.form_answers= formValues this.quesService.formanswers= formValues
setTimeout(()=>{ // setTimeout(()=>{
this.form_answers = null // this.quesService.formanswers = null
},2500) // },2500)
} }
// this.commonFormGroup.patchValue(formValues) // this.commonFormGroup.patchValue(formValues)
} }

View File

@ -826,7 +826,7 @@ uploadSMCDataFile(file,pd_id ?) {
} }
loadTemplate(form_id) { loadTemplate(form_id) {
return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/'+form_id+'.json').map(rr=>{ return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/'+form_id+'.json').map(rr=>{
// return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/NBFCMFI/1.json').map(rr=>{ //return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/WCTL/1.json').map(rr=>{
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}} let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
// this.raw_credit_pd_template= returnValue.records.template // this.raw_credit_pd_template= returnValue.records.template
return returnValue return returnValue

View File

@ -6,9 +6,9 @@ import { environment } from './environments/environment';
if (environment.production) { if (environment.production) {
enableProdMode(); enableProdMode();
if(window){ // if(window){
window.console.log = function(){}; // window.console.log = function(){};
} // }
} }