Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-05-21 11:27:58 +03:00
commit 060bfd8871
3 changed files with 11 additions and 3 deletions

View File

@ -113,6 +113,7 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist {
// // rootPath: `descriptionTemplates[${index}].`
// })), //context.getValidation('descriptionTemplates')
// ))
if (disabled) descriptionTemplatesFormGroup.disable();
formGroup.addControl('descriptionTemplates', descriptionTemplatesFormGroup);
return formGroup;

View File

@ -67,15 +67,21 @@
<mat-error *ngIf="user.get('role').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-12 col-xl mt-3" *ngIf="sections && (user.get('role').value == dmpUserRoleEnum.DescriptionContributor || user.get('role').value == dmpUserRoleEnum.Reviewer)">
<div class="col-12 col-xl mt-3" *ngIf="sections || hasTemplatesSections">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS.SECTIONS' | translate}}</mat-label>
<mat-select [formControl]="user.get('sectionId')">
<mat-select *ngIf="user.get('role').value != dmpUserRoleEnum.DescriptionContributor && sections" [formControl]="user.get('sectionId')">
<mat-option value="">{{'DMP-EDITOR.FIELDS.ALL-SECTIONS' | translate}}</mat-option>
<mat-option *ngFor="let section of sections" [value]="section.id">
{{ section.label }}
</mat-option>
</mat-select>
<mat-select *ngIf="user.get('role').value === dmpUserRoleEnum.DescriptionContributor && hasTemplatesSections" [formControl]="user.get('sectionId')">
<mat-option value="">{{'DMP-EDITOR.FIELDS.ALL-SECTIONS' | translate}}</mat-option>
<mat-option *ngFor="let section of hasTemplatesSections" [value]="section.id">
{{ section.label }}
</mat-option>
</mat-select>
<mat-error *ngIf="user.get('sectionId').hasError('backendError')">{{user.get('sectionId').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('sectionId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |translate}}</mat-error>
</mat-form-field>

View File

@ -28,6 +28,7 @@ export class DmpUserFieldComponent extends BaseComponent implements OnInit {
@Input() enableSorting: boolean = true;
hoveredUser:number = -1;
hasTemplatesSections: DmpBlueprintDefinitionSection[] = null;
dmpUserTypeEnum = DmpUserType;
dmpUserTypeEnumValues = this.enumUtils.getEnumValues<DmpUserType>(DmpUserType);
@ -43,7 +44,7 @@ export class DmpUserFieldComponent extends BaseComponent implements OnInit {
) { super(); }
ngOnInit() {
this.sections = this.sections?.filter(x => x.hasTemplates) || null;
this.hasTemplatesSections = this.sections?.filter(x => x.hasTemplates) || null;
console.log('sorting mode: ', this.enableSorting);
if(this.initializeUsers) {
this.addUser();