diff --git a/ng6-seed/Sparq-Lender Test(22-07-2021)Web.zip b/ng6-seed/Sparq-Lender Test(22-07-2021)Web.zip new file mode 100644 index 0000000..de3d24f Binary files /dev/null and b/ng6-seed/Sparq-Lender Test(22-07-2021)Web.zip differ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.html index edff34d..2c7de16 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.html @@ -12,13 +12,14 @@
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts index bfd0423..f40d096 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts @@ -15,6 +15,7 @@ export class DynamicFormComponent implements OnInit { @Input() form_group_name:FormGroup; @Input() questions_JSON:any; @Input() json_answers:any; + length:any; step: number=0; isDefaultGenerated:boolean = false step_child:number = 0 @@ -23,30 +24,34 @@ export class DynamicFormComponent implements OnInit { constructor(private _fb:FormBuilder,private questionService:QuesFormService) { } ngOnInit() { - - // this.form_group_name=new FormGroup({questions:this._fb.array([])}) - // console.log(this.questions_JSON,this.json_answers,this.questionService); + //console.log('testing'); + // console.log(this.json_answers); + // this.questions_JSON.questions.push({"ans_length":this.json_answers.key_stakeholders.length}) + //this.length=this.questionService.ques_length(this.json_answers.key_stakeholders.length) this.form_group_name=this.questionService.assignFormControl_array(this.form_group_name,this.questions_JSON.questions) - + // debugger this.generateGroupControls(); } - generateGroupControls() { + + generateGroupControls() { + + if(this.json_answers && this.json_answers != null){ this.isDefaultGenerated = true; this.questions_JSON.questions.forEach(parent_ques=>{ // debugger; - // FOR ADDING THE GROUP QUES TO DISPLAY WITHOUT CONSIDERING INDEX 0 + // FOR ADDING THE GROUP QUES TO DISPLAY WITHOUT CONSIDERING INDEX 0 if(parent_ques.is_repeatable == '1'){ if(this.json_answers[parent_ques.group_key] && this.json_answers[parent_ques.group_key].length > this.form_group_name.value[parent_ques.group_key].length) { - + // this.json_answers[parent_ques.group_key].mobile_numbers= [{mobile_no:93299},{mobile_no:948392}] this.json_answers[parent_ques.group_key].forEach((group_ques,g_i)=>{ // debugger; - + if(g_i != 0){ // let parent_control=this.form_group_name 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 144b51d..8187b1e 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 @@ -26,7 +26,7 @@ {{validation.message}} - + {{parent_ques.question}} @@ -185,7 +185,7 @@ {{validation.message}} - + 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 e19bf8b..1895365 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 @@ -22,45 +22,127 @@ export class DynamicQuestionTemplateComponent implements OnInit { @Input() whole_form:FormGroup; @Input() json_answers:any; @Input()group_key:any; + length:any; @Output() generateGroupControls= new EventEmitter() local_city: any; local_pincode: any; + json_answers1:any; autoCompleteAns:Observable public commonFilterCtrl:FormControl = new FormControl(); public ngxFilteredValue:ReplaySubject = new ReplaySubject(1); + parent_ques1: any; constructor(private quesService:QuesFormService,private _fb:FormBuilder, private matDialog:MatDialog, private loaderService:LoaderService) { } ngOnInit() { + this.parent_ques = this.currFormArrayObj + if(this.parent_ques.type == '9' && this.parent_ques.answers && this.parent_ques.answers.length > 0) { this.autoCompleteAns =this.formGroupN.get(this.parent_ques.question_key).valueChanges.pipe( startWith(''), map(value => this.autoCompleteFilter(value)) ) } - - - } + //let length=this.quesService.ans_length() + } + ngOnChanges() { this.parent_ques = this.currFormArrayObj + + this.json_answers1=[{ + stakeholder_name0: "SUMIT KHANDELWAL", + share_holding0: 10, + vintage_in_current_biz0: 5, + total_work_exp0: 10, + started_biz0: "", + + stakeholder_name1: "RAM", + share_holding1: 10.5, + vintage_in_current_biz1: 8, + total_work_exp1: 5, + started_biz1: "", + + stakeholder_name2: "VIGNESH", + share_holding2: 55, + vintage_in_current_biz2: 6, + total_work_exp2: 0, + started_biz2: "", + + company_name: 3}, + { + stakeholder_name0: "SUMIT KHANDELWAL", + share_holding0: 15, + vintage_in_current_biz0: 6, + total_work_exp0: 11, + started_biz0: "", + + + + stakeholder_name1: "RAM", + share_holding1: 0, + vintage_in_current_biz1: 10, + total_work_exp1: 9, + started_biz1: "", + + + + stakeholder_name2: "VIGNESH", + share_holding2: 25, + vintage_in_current_biz2: 12, + total_work_exp2: 8, + started_biz2: "", + + + company_name: 2},{ + stakeholder_name0: "SUMIT KHANDELWAL", + share_holding0: 25, + vintage_in_current_biz0: 7, + total_work_exp0: 12, + started_biz0: "", + + + + stakeholder_name1: "RAM", + share_holding1: 25.5, + vintage_in_current_biz1: 15, + total_work_exp1: 0, + started_biz1: "", + + + + stakeholder_name2: "VIGNESH", + share_holding2: 0, + vintage_in_current_biz2: 10, + total_work_exp2: 9, + started_biz2: "", + + + company_name: 1} + + ] + if(this.json_answers!=null && this.json_answers != undefined && this.json_answers) { // setTimeout(()=>{ // console.clear() - if(this.json_answers!=null && this.json_answers != undefined && this.json_answers && !this.group_key) { + if(this.json_answers!=null && this.json_answers!= undefined && this.json_answers&& !this.group_key) { this.formGroupN.get(this.parent_ques.question_key).patchValue((this.json_answers[this.parent_ques.question_key] || '')) + // this.formGroupN.get(this.parent_ques1.question_key).patchValue((this.json_answers[1][this.parent_ques1.question_key] || '')) this.onChangeProperty({value:this.json_answers[this.parent_ques.question_key]},this.parent_ques,'','','','TS') } else if(this.json_answers!=null && this.json_answers != undefined && this.json_answers){ // this.formGroupN.patchValue((this.json_answers[this.group_key] || '')) // debugger; + this.whole_form.get(this.group_key).patchValue(this.json_answers) if(this.json_answers.length > 1) { this.generateGroupControls.emit() } + + console.log(this.json_answers); this.json_answers.forEach((value,index)=>{ @@ -176,7 +258,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { } } onChangeProperty(event,sec_control,question_key,options?,sec_index?,from?){ - console.log(from,"sadf") + // alert('datatamil'); if(!from && from != 'TS' && this.quesService.formanswers != null) { console.log("Value changes",from); this.quesService.formanswers = null @@ -262,6 +344,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { let params={records:{state_id:event.value}} this.quesService.apiCall(onChangeProperty.api,params,onChangeProperty.api_method).subscribe(res=>{ + if(res['dataStatus']){ this.local_city=res['records'].cities this.local_pincode=res['records'].pincode @@ -284,7 +367,9 @@ export class DynamicQuestionTemplateComponent implements OnInit { }) } else{ + this.quesService.apiCall(onChangeProperty.api,onChangeProperty.params,onChangeProperty.api_method).subscribe((result:any)=>{ + if(result['dataStatus']){ if(result.hasOwnProperty('records')){ result=result['records'] @@ -564,6 +649,10 @@ export class DynamicQuestionTemplateComponent implements OnInit { }) } addOrRemoveControl(val,ques_control,question_index_after,options,paren_ques) { + console.log(val); + console.log(ques_control); + console.log(question_index_after); + console.log(paren_ques); if(options == 1){ let check_dup=ques_control.filter(control_key=>control_key.question_key == val.question_key) @@ -595,7 +684,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { } } - else{ + else{ if(control_key.question_key == val.question_key){ this.whole_json.splice(index,1) this.formGroupN.controls[val.question_key].reset() @@ -609,6 +698,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { } } checkAndRemoveSubQuestion(question_obj,ques_control) { + let getSubQuestion = this.whole_json.filter(vv=>vv.parent_question_key == question_obj.question_key) if(getSubQuestion.length > 0) { getSubQuestion.forEach(val=>{ @@ -619,7 +709,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { } setValidations_onChange(validation_obj_raw,group_ques,sec_control,sec_index){ - + if(validation_obj_raw.validations.length > 0){ validation_obj_raw.validations.forEach(validation_obj=>{ @@ -686,6 +776,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { } proceedValidationSet(validation_obj,group_ques,sec_control,validator_single?){ + let ques_control; if(validation_obj.validation_to == null){ @@ -738,7 +829,17 @@ export class DynamicQuestionTemplateComponent implements OnInit { } } newAnswerCreateDialog(choosed_answer_obj,curr_ques_obj) { - + // console.log('aa'); + // console.log(choosed_answer_obj); + // console.log(curr_ques_obj); + // console.log('abx'); + // console.log(choosed_answer_obj.answer) + // if(choosed_answer_obj.answer!='') + // { + // console.log('changed'); + + // let company=this.quesService.companynamechanged(choosed_answer_obj,curr_ques_obj) + // } if(choosed_answer_obj.is_others == '-1') { this.formGroupN.get(curr_ques_obj.question_key).setValue('') let dialog = this.matDialog.open(AnswerOptionCreateDialogComponent,{ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts index c633897..6b7338f 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts @@ -10,37 +10,590 @@ const apiUrl = environment.apiEndpoint providedIn: 'root' }) export class QuesFormService { + formgroup_company:FormGroup; + ques_data_company:any; + company_name:any; + formanswers=null; - pd_all_details:any= {} + pd_all_details:any= {} datepipe: DatePipe; + length: string; constructor(private _fb:FormBuilder,private http:HttpClient) { this.datepipe=new DatePipe('en-US') // this.apiUrl = constantProvider.environment().url } // FOR CREATING A FORM CONTROL DYNAMICALLY - assignFormControl_array(formgroup: FormGroup, ques_data: any) { - - const control: any = formgroup + // companynamechanged(choosed_answer_obj,curr_ques_obj) { + // alert('new'); + // console.log('aa'); + // console.log(choosed_answer_obj); + // console.log(curr_ques_obj); + // console.log('abx'); + // console.log(choosed_answer_obj.answer) + // if(choosed_answer_obj.answer!='') + // { + // console.log('changed'); + // this.company_name=choosed_answer_obj.answer + // } - ques_data.forEach((val, index) => { + // } + + + assignFormControl_array(formgroup: FormGroup, ques_data: any) { + const control: any = formgroup + console.log(formgroup); + ques_data.forEach((val, index) => { + if (val.hasOwnProperty('is_repeatable') && val.is_repeatable == '1') { + + + // control.push(this._fb.group({ // "is_repeatable": [val.is_repeatable || null], // "group_title": [val.group_title || null], "group_type": [val.group_type || null] // ,"question_key":[val.question[0].question_key] // })) - + control.addControl(val.group_key, this._fb.array([])) - + let childControl: any = control.get(val.group_key) as FormArray - + // childControl.push(this._fb.group({ 'questions': this._fb.array([]) })) - + + this.length='3'; + + if(this.length=='3') + { + + val.question.push({ + "question":"", + "question_key":"stakeholder_name1", + "place_holder":"Enter text", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + } + ] + + }, + { + "question":"", + "question_key":"share_holding1", + "place_holder":"Enter number", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Share value Required", + "value":null + }, + { + "name":"max", + "validator":"100", + "isactive":"1", + "message":"Number must be less than 100", + "value":null + } + ] + }, + { + "question":"", + "question_key":"vintage_in_current_biz1", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Current vintage Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz1", + "expression":"(total_work_exp1 > vintage_in_current_biz1)", + "value_keys":[ + "total_work_exp1", + "vintage_in_current_biz1" + ], + "questions":[ + { + "question_key":"previous_experience_details1", + "question":"Previous Experience Details1", + "place_holder":"Enter text", + "type":"1", + + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"vintage_in_current_biz1", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] + }, + { + "question":"", + "question_key":"total_work_exp1", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Total experience Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz1", + "expression":"(total_work_exp1 > vintage_in_current_biz1)", + "value_keys":[ + "total_work_exp1", + "vintage_in_current_biz1" + ], + "questions":[ + { + "question":"Previous Experience Details1", + "question_key":"previous_experience_details1", + "place_holder":"Enter text", + "type":"1", + + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"total_work_exp1", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] + }, + { + "question":"", + "question_key":"started_biz1", + "type":"2", + "field_width":"19", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes" + }, + { + "answer_id":"No", + "answer":"No" + } + ], + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Started Business Required", + "value":null + } + ] + + },{ + "question":"", + "question_key":"stakeholder_name2", + "place_holder":"Enter text", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + } + ] + + }, + { + "question":"", + "question_key":"share_holding2", + "place_holder":"Enter number", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Share value Required", + "value":null + }, + { + "name":"max", + "validator":"100", + "isactive":"1", + "message":"Number must be less than 100", + "value":null + } + ] + }, + { + "question":"", + "question_key":"vintage_in_current_biz2", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Current vintage Required", + "value":null + } + ], + + }, + { + "question":"", + "question_key":"total_work_exp2", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Total experience Required", + "value":null + } + ], + + }, + { + "question":"", + "question_key":"started_biz2", + "type":"2", + "field_width":"19", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes" + }, + { + "answer_id":"No", + "answer":"No" + } + ], + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Started Business Required", + "value":null + } + ] + + } + ) + } + else if(this.length=='2') + { + + val.question.push({ + "question":"", + "question_key":"stakeholder_name1", + "place_holder":"Enter text", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + } + ] + + }, + { + "question":"", + "question_key":"share_holding1", + "place_holder":"Enter number", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Share value Required", + "value":null + }, + { + "name":"max", + "validator":"100", + "isactive":"1", + "message":"Number must be less than 100", + "value":null + } + ] + }, + { + "question":"", + "question_key":"vintage_in_current_biz1", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Current vintage Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz1", + "expression":"(total_work_exp1 > vintage_in_current_biz1)", + "value_keys":[ + "total_work_exp1", + "vintage_in_current_biz1" + ], + "questions":[ + { + "question_key":"previous_experience_details1", + "question":"Previous Experience Details1", + "place_holder":"Enter text", + "type":"1", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"vintage_in_current_biz1", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] + }, + { + "question":"", + "question_key":"total_work_exp1", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Total experience Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz1", + "expression":"(total_work_exp1 > vintage_in_current_biz1)", + "value_keys":[ + "total_work_exp1", + "vintage_in_current_biz1" + ], + "questions":[ + { + "question":"Previous Experience Details1", + "question_key":"previous_experience_details1", + "place_holder":"Enter text", + "type":"1", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"total_work_exp1", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] + }, + { + "question":"", + "question_key":"started_biz1", + "type":"2", + "field_width":"19", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes" + }, + { + "answer_id":"No", + "answer":"No" + } + ], + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Started Business Required", + "value":null + } + ] + + }) + } + + + // let sub_childControl: any = childControl.controls[0].get('questions') as FormArray let control_names:any={} ques_data[index].group_questions = [] - ques_data[index].group_questions.push(val.question) + + //ques_data[index].group_questions1 = [] + ques_data[index].group_questions.push(val.question) + val.group_questions[0].forEach((group_indi, arr_index) => { // CREATING A FORMARRAY AND CONTROL FOR CHILD REPEATABLE if(group_indi.is_repeatable == '2') { @@ -128,6 +681,7 @@ export class QuesFormService { // }) } else { + // console.log("con",control) // let key_list=Object.keys(val) // console.log(Object.keys(val)) @@ -338,9 +892,9 @@ export class QuesFormService { params=temp; } } - console.log('may13'); - console.log(params); + return this.http.post(apiUrl+api_name,params) + } else{ let httpParams = new HttpParams() diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.html index 8708743..1d11f22 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.html @@ -22,7 +22,8 @@ --> - + + 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 80ae4c7..6748899 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 @@ -825,8 +825,9 @@ uploadSMCDataFile(file,pd_id ?) { return this._http.post(this.apiUrl+'uploadSMCDataFile',formData) } 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/WCTL/1.json').map(rr=>{ + //return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json').map(rr=>{ let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}} // this.raw_credit_pd_template= returnValue.records.template return returnValue diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json index c73f156..c500dac 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json @@ -5,196 +5,8 @@ ], "questions":[ { - "question":[ - { - "question":"Name of key Stakeholder", - "question_key":"stakeholder_name", - "place_holder":"Enter text", - "type":"1", - "api_properties":null, - "answers":null, - "onchange_properties":null, - "is_repeatable":null, - "field_type":"string", - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Name Required", - "value":null - } - ] - }, - { - "question":"Share Holding (%)", - "question_key":"share_holding", - "place_holder":"Enter number", - "type":"1", - "api_properties":null, - "answers":null, - "onchange_properties":null, - "is_repeatable":null, - "field_type":"num", - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Share value Required", - "value":null - }, - { - "name":"max", - "validator":"100", - "isactive":"1", - "message":"Number must be less than 100", - "value":null - } - ] - }, - { - "question":"Vintage in Current Business (in years)", - "question_key":"vintage_in_current_biz", - "place_holder":"Enter in years", - "type":"1", - "api_properties":null, - "answers":null, - "is_repeatable":null, - "field_type":"num", - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Current vintage Required", - "value":null - } - ], - "onchange_properties":[ - { - "purpose":"FORM_CTRL", - "form_controls":[ - { - "insert_index":"total_work_exp", - "expression":"(total_work_exp > vintage_in_current_biz)", - "value_keys":[ - "total_work_exp", - "vintage_in_current_biz" - ], - "questions":[ - { - "question_key":"previous_experience_details", - "question":"Previous Experience Details", - "place_holder":"Enter text", - "type":"1", - "api_properties":null, - "answers":null, - "onchange_properties":null, - "is_repeatable":null, - "field_type":"string", - "parent_question_key":"vintage_in_current_biz", - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Previous Experience Required", - "value":null - } - ] - } - ] - } - ] - } - ] - }, - { - "question":"Total Work Experience (in years)", - "question_key":"total_work_exp", - "place_holder":"Enter in years", - "type":"1", - "api_properties":null, - "answers":null, - "is_repeatable":null, - "field_type":"num", - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Total experience Required", - "value":null - } - ], - "onchange_properties":[ - { - "purpose":"FORM_CTRL", - "form_controls":[ - { - "insert_index":"total_work_exp", - "expression":"(total_work_exp > vintage_in_current_biz)", - "value_keys":[ - "total_work_exp", - "vintage_in_current_biz" - ], - "questions":[ - { - "question":"Previous Experience Details", - "question_key":"previous_experience_details", - "place_holder":"Enter text", - "type":"1", - "api_properties":null, - "answers":null, - "onchange_properties":null, - "is_repeatable":null, - "field_type":"string", - "parent_question_key":"total_work_exp", - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Previous Experience Required", - "value":null - } - ] - } - ] - } - ] - } - ] - }, - { - "question":"Started Business (Yes / No)", - "question_key":"started_biz", - "type":"2", - "api_properties":null, - "onchange_properties":null, - "is_repeatable":null, - "answers":[ - { - "answer_id":"Yes", - "answer":"Yes" - }, - { - "answer_id":"No", - "answer":"No" - } - ], - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Started Business Required", - "value":null - } - ] - }, - { + "question":[ + { "question":"Name of the Company", "question_key":"company_name", "place_holder":"Enter text", @@ -224,7 +36,207 @@ "value":null } ] + + }, + { + "question":"Name of key Stakeholder", + "question_key":"stakeholder_name0", + "place_holder":"Enter text", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + } + ] + + }, + { + "question":"Share Holding (%)", + "question_key":"share_holding0", + "place_holder":"Enter number", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Share value Required", + "value":null + }, + { + "name":"max", + "validator":"100", + "isactive":"1", + "message":"Number must be less than 100", + "value":null + } + ] + }, + { + "question":"Vintage in Current Business (in years)", + "question_key":"vintage_in_current_biz0", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Current vintage Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz0", + "expression":"(total_work_exp0 > vintage_in_current_biz0)", + "value_keys":[ + "total_work_exp0", + "vintage_in_current_biz0" + ], + "questions":[ + { + "question_key":"previous_experience_details", + "question":"Previous Experience Details0", + "place_holder":"Enter text", + "type":"1", + + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"vintage_in_current_biz0", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] + }, + { + "question":"Total Work Experience (in years)", + "question_key":"total_work_exp0", + "place_holder":"Enter in years", + "type":"1", + "field_width":"19", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Total experience Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz0", + "expression":"(total_work_exp0 > vintage_in_current_biz0)", + "value_keys":[ + "total_work_exp0", + "vintage_in_current_biz0" + ], + "questions":[ + { + "question":"Previous Experience Details", + "question_key":"previous_experience_details0", + "place_holder":"Enter text", + "type":"1", + + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"total_work_exp0", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] + }, + { + "question":"Started Business (Yes / No)", + "question_key":"started_biz0", + "type":"2", + "field_width":"19", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes" + }, + { + "answer_id":"No", + "answer":"No" + } + ], + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Started Business Required", + "value":null + } + ] + } + + ], "is_repeatable":"1", "group_title":"Details of Key Stakeholders in the Business",