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

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

(cherry picked from commit d028ab1c)
parent 2f0f8712
No related branches found
No related tags found
No related merge requests found
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -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>
......
...@@ -1017,4 +1017,24 @@ export class ContactsFormComponent implements OnInit { ...@@ -1017,4 +1017,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