Skip to content
Snippets Groups Projects
Commit d028ab1c authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX #14755 TIME 0:15 force uppercase lastname fistrname and company

parent 68e26df3
No related branches found
No related tags found
No related merge requests found
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
*ngIf="field.type === 'string' && field.id !== 'communicationMeans' && field.id !== 'externalId_m2m'"> *ngIf="field.type === 'string' && field.id !== 'communicationMeans' && field.id !== 'externalId_m2m'">
<mat-form-field> <mat-form-field>
<input matInput [formControl]="field.control" [placeholder]="field.label" <input matInput [formControl]="field.control" [placeholder]="field.label"
(blur)="checkCompany(field);checkFilling();" [required]="field.required"> (blur)="checkCompany(field);checkFilling();" (ngModelChange)="toUpperCase(field, $event)" [required]="field.required">
<mat-hint *ngIf="!isEmptyValue(field.desc)" align="end" <mat-hint *ngIf="!isEmptyValue(field.desc)" align="end"
[innerHTML]="field.desc"> [innerHTML]="field.desc">
</mat-hint> </mat-hint>
......
...@@ -1018,4 +1018,24 @@ export class ContactsFormComponent implements OnInit { ...@@ -1018,4 +1018,24 @@ export class ContactsFormComponent implements OnInit {
this.fillingRate.class = 'accent'; this.fillingRate.class = 'accent';
} }
} }
toUpperCase(target: any, ev: any) {
setTimeout(() => {
const test = target.control.value;
if (['lastname'].indexOf(target.id) > -1) {
target.control.setValue(test.toUpperCase());
} else if (['firstname', 'company'].indexOf(target.id) > -1) {
let splitStr = test.toLowerCase().split(' ');
for (let i = 0; i < splitStr.length; i++) {
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
}
splitStr = splitStr.join(' ');
splitStr = splitStr.split('-');
for (let i = 0; i < splitStr.length; i++) {
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
}
target.control.setValue( splitStr.join('-'));
}
}, 100);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment