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

FIX #11270 TIME 2 fix var lang + fix check values + fix update

parent 1b708e66
No related branches found
No related tags found
No related merge requests found
......@@ -62,8 +62,8 @@
</div>
</div>
<div class="col-md-12">
<mat-form-field *ngFor="let value of custom.values;let i=index;">
<input matInput [(ngModel)]="value.label">
<mat-form-field *ngFor="let value of custom.values;let i=index;" floatLabel="never">
<input matInput [(ngModel)]="value.label" [placeholder]="this.lang.newValue">
<button color="warn" mat-icon-button matSuffix [title]="lang.delete"
(click)="removeValue(custom, i)">
<mat-icon class="fa fa-trash"></mat-icon>
......
......@@ -134,7 +134,7 @@ export class CustomFieldsAdministrationComponent implements OnInit {
addValue(indexCustom: number) {
this.customFields[indexCustom].values.push(
{
label: this.lang.newValue
label: ''
}
);
}
......@@ -162,6 +162,8 @@ export class CustomFieldsAdministrationComponent implements OnInit {
updateCustomField(customField: any, indexCustom: number) {
customField.values = customField.values.filter((x: any, i: any, a: any) => a.map((info: any) => info.label).indexOf(x.label) == i);
// TO FIX DATA BINDING SIMPLE ARRAY VALUES
const customFieldToUpdate = { ...customField };
......@@ -175,7 +177,7 @@ export class CustomFieldsAdministrationComponent implements OnInit {
this.http.put('../../rest/customFields/' + customField.id, customFieldToUpdate).pipe(
tap(() => {
this.customFieldsClone[indexCustom] = customField;
this.customFieldsClone[indexCustom] = JSON.parse(JSON.stringify(customField));
this.notify.success(this.lang.customFieldUpdated);
}),
catchError((err: any) => {
......@@ -190,7 +192,7 @@ export class CustomFieldsAdministrationComponent implements OnInit {
}
isModified(customField: any, indexCustomField: number) {
if (JSON.stringify(customField) === JSON.stringify(this.customFieldsClone[indexCustomField])) {
if (JSON.stringify(customField) === JSON.stringify(this.customFieldsClone[indexCustomField]) || customField.label === '') {
return true;
} else {
return false;
......
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