From be841d8ad54baac3afd1023d221c911e02538bf8 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Tue, 18 Jan 2022 10:24:09 +0530 Subject: [PATCH] single company name,camel case --- .../list-pd/add-pd/add-pd.component.html | 2 +- .../list-pd/add-pd/add-pd.component.ts | 22 ++++++++++++++++++- .../dynamic-question-template.component.ts | 21 ++++++++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index cd8e6f5..ae3ae69 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -299,7 +299,7 @@ - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index 83209b5..2ac85b1 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -32,7 +32,7 @@ export class AddPdComponent implements OnInit, OnDestroy { PDTriggerStatus: string; private notifier: NotifierService; public _PDtriggerForm: FormGroup; - + addresses: FormArray; coapplicants: FormArray; addtional_requirements: FormArray; @@ -83,6 +83,7 @@ export class AddPdComponent implements OnInit, OnDestroy { role_id: any; prod_seg: any; usertype: string; + range: any; constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent, private titleCase : TitleCasePipe,private userService:UserService,private matDialog:MatDialog) { @@ -972,6 +973,25 @@ export class AddPdComponent implements OnInit, OnDestroy { } } + capitalize(str) { + + console.log(str) + + console.log(this.range) + var splitStr = str.toLowerCase().split(' '); + for (var i = 0; i < splitStr.length; i++) { + // You do not need to check if i is larger than splitStr length, as your for does that for you + // Assign it back to the array + splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); + } + // Directly return the joined string + let d = splitStr.join(' '); + console.log(d) + this._PDtriggerForm.get('company_name'); + console.log(this._PDtriggerForm.get('company_name')) + this.range = d + return d + } ngOnDestroy(): void { this.ListPdComponent.showListView(true); } 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 3242f53..539c15b 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 @@ -34,7 +34,8 @@ export class DynamicQuestionTemplateComponent implements OnInit { constructor(private quesService:QuesFormService,private _fb:FormBuilder, private matDialog:MatDialog, private loaderService:LoaderService) { } ngOnInit() { - + console.log(this.json_answers) + console.log(this.whole_json) 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( @@ -124,6 +125,17 @@ export class DynamicQuestionTemplateComponent implements OnInit { this.json_answers1=[{"question":"a","answer":"a"},{"question":"b","answer":"b"},{"question":"c","answer":"c"}] console.log('answers'); console.log(this.json_answers); + console.log(this.parent_ques); + + if(this.parent_ques.answers && this.parent_ques.answers instanceof Array){ + console.log(this.parent_ques.answers.length) + if(this.parent_ques.answers.length == 1){ + console.log(this.parent_ques.answers.answer_id) + this.formGroupN.get(this.parent_ques.question_key).patchValue(this.parent_ques.answers[0].answer_id || '') + } + } + + //console.log(this.group_key); if(this.json_answers!=null && this.json_answers != undefined && this.json_answers) { @@ -131,6 +143,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { // console.clear() 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.onChangeProperty({value:this.json_answers[this.parent_ques.question_key]},this.parent_ques,'','','','TS') @@ -141,6 +154,10 @@ export class DynamicQuestionTemplateComponent implements OnInit { // debugger; this.formGroupN.get(this.parent_ques.question_key) + + console.log(this.group_key) + console.log(this.whole_form) + console.log( this.whole_form.get(this.group_key)) this.whole_form.get(this.group_key).patchValue(this.json_answers) @@ -883,4 +900,4 @@ export class DynamicQuestionTemplateComponent implements OnInit { ques_control.validations = updateMsg return updateMsg; } -} +} \ No newline at end of file