Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
b9f1805bb2
|
@ -678,7 +678,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
saveAndClose(){
|
||||
this.formSubmit((data) => {
|
||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.refreshOnNavigateToData(data ? data.id : null);
|
||||
this.formGroup = null;
|
||||
this.backToDmp();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.CHECK_BOX" class="col-12">
|
||||
<mat-checkbox [formControl]="propertiesFormGroup?.get(field.id).get('textValue')">
|
||||
<mat-checkbox [checked]="propertiesFormGroup?.get(field.id).get('textValue').value == 'true'" [disabled]="propertiesFormGroup?.get(field.id).get('textValue').disabled"(change)="checkBoxChanged($event)">
|
||||
{{field.data.label}}</mat-checkbox>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('backendError')">{{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}}</mat-error>
|
||||
</div>
|
||||
|
@ -119,7 +119,7 @@
|
|||
<mat-label>{{ (field.data.label | translate)}}</mat-label>
|
||||
</button>
|
||||
|
||||
<button *ngIf="propertiesFormGroup?.get(field.id).get('textValue').value && !filesToUpload" mat-button (click)="download()" type="button" class="attach-file-btn" [disabled]="propertiesFormGroup?.get(field.id).get('textValue').disabled">
|
||||
<button *ngIf="propertiesFormGroup?.get(field.id).get('textValue').value && !filesToUpload" mat-button (click)="download()" type="button" class="attach-file-btn">
|
||||
<mat-icon class="mr-2">download</mat-icon>
|
||||
<mat-label>{{ "TYPES.DATASET-PROFILE-UPLOAD-TYPE.DOWNLOAD" | translate }}</mat-label>
|
||||
</button>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { COMMA, ENTER } from '@angular/cdk/keycodes';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit, SimpleChanges } from '@angular/core';
|
||||
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { MatDialog } from "@angular/material/dialog";
|
||||
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
|
||||
import { DescriptionTemplateFieldValidationType } from '@app/core/common/enum/description-template-field-validation-type';
|
||||
|
@ -116,6 +117,15 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
}
|
||||
}
|
||||
|
||||
checkBoxChanged(event: MatCheckboxChange){
|
||||
if (event.checked){
|
||||
this.propertiesFormGroup?.get(this.field.id).get('textValue').setValue("true");
|
||||
} else{
|
||||
this.propertiesFormGroup?.get(this.field.id).get('textValue').setValue("false");
|
||||
}
|
||||
this.visibilityRulesService.reloadVisibility();
|
||||
}
|
||||
|
||||
private applyFieldType(){
|
||||
this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required);
|
||||
|
||||
|
@ -164,7 +174,8 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
// }
|
||||
break;
|
||||
case DescriptionTemplateFieldType.CHECK_BOX:
|
||||
this.propertiesFormGroup?.get(this.field.id).get('textValue').setValue(this.propertiesFormGroup?.get(this.field.id).get('textValue').value === 'true');
|
||||
if (this.propertiesFormGroup?.get(this.field.id).get('textValue').value == undefined) this.propertiesFormGroup?.get(this.field.id).get('textValue').setValue("false");
|
||||
this.visibilityRulesService.reloadVisibility();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue