single company name,camel case

This commit is contained in:
venbatechnologies@gmail.com 2022-01-18 10:24:09 +05:30
parent 6edccd86bc
commit be841d8ad5
3 changed files with 41 additions and 4 deletions

View File

@ -299,7 +299,7 @@
</mat-form-field>
<mat-form-field fxFlex="38%" fxFlex.xs="100%" *ngIf="pdMain.fk_customer_segment.value != '8'">
<input matInput autocomplete="off" [placeholder]="cus_abbr_value == 'SEP_INDV' ? 'Nature of Service' : 'Company / Firm Name'" formControlName="company_name" type="text">
<input matInput autocomplete="off" [placeholder]="cus_abbr_value == 'SEP_INDV' ? 'Nature of Service' : 'Company / Firm Name'" formControlName="company_name" type="text" [ngModel]="range" (input)="capitalize($event.target.value)" >
</mat-form-field>
<mat-form-field fxFlex="38%" fxFlex.xs="100%">

View File

@ -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);
}

View File

@ -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;
}
}
}