From 66fe4cf31174c155ee4758cdb56682c7317475eb Mon Sep 17 00:00:00 2001 From: amentis Date: Fri, 7 Jun 2024 12:24:43 +0300 Subject: [PATCH] invite dmp user changes --- .../dmp-user-field.component.html | 2 +- .../dmp-user-field/dmp-user-field.component.ts | 9 +++++++++ .../dialog/dmp-invitation-dialog.component.ts | 17 ++++------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html index 8b769a12f..94c90d240 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html @@ -35,7 +35,7 @@ drag_indicator
- +
{{enumUtils.toDmpUserTypeString(userType)}}
diff --git a/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.ts b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.ts index 810aef4b5..e55566616 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.ts @@ -10,6 +10,7 @@ import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/mu import { BaseComponent } from '@common/base/base.component'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { DmpEditorModel, DmpUserEditorModel } from '../dmp-editor-blueprint/dmp-editor.model'; +import { MatButtonToggleChange } from '@angular/material/button-toggle'; @Component({ selector: 'app-dmp-user-field-component', @@ -103,4 +104,12 @@ export class DmpUserFieldComponent extends BaseComponent implements OnInit { clearHoveredUser(): void { this.hoveredUser = -1; } + + userTypeChange(type: MatButtonToggleChange, userIndex: number){ + if (type.value === DmpUserType.Internal){ + (this.form.get('users') as FormArray).at(userIndex).get('email').patchValue(null); + } else { + (this.form.get('users') as FormArray).at(userIndex).get('user').patchValue(null); + } + } } diff --git a/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.ts index a6f7ce512..00f2af113 100644 --- a/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.ts @@ -18,14 +18,11 @@ import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; import { DmpEditorModel } from '../../dmp-editor-blueprint/dmp-editor.model'; -import { DmpEditorService } from '../../dmp-editor-blueprint/dmp-editor.service'; -import { ResponseErrorCode } from '@app/core/common/enum/respone-error-code'; @Component({ selector: 'app-invitation-dialog-component', templateUrl: 'dmp-invitation-dialog.component.html', - styleUrls: ['./dmp-invitation-dialog.component.scss'], - providers: [DmpEditorService] + styleUrls: ['./dmp-invitation-dialog.component.scss'] }) export class DmpInvitationDialogComponent extends BaseComponent implements OnInit { @@ -47,7 +44,6 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni private httpErrorHandlingService: HttpErrorHandlingService, private dmpService: DmpService, private formService: FormService, - private dmpEditorService: DmpEditorService, @Inject(MAT_DIALOG_DATA) public data: any ) { super(); @@ -91,16 +87,11 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni this.uiNotificationService.snackBarNotification(this.language.instant('DMP-USER-INVITATION-DIALOG.SUCCESS'), SnackBarNotificationLevel.Success); } - // onCallbackError(errorResponse: HttpErrorResponse) { - // this.inProgressSendButton = false; - // let errorOverrides = new Map(); - // errorOverrides.set(-1, this.language.instant('DMP-USER-INVITATION-DIALOG.ERROR')); - // this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides, SnackBarNotificationLevel.Error); - // } - onCallbackError(errorResponse: HttpErrorResponse) { this.inProgressSendButton = false; - this.httpErrorHandlingService.handleBackedRequestError(errorResponse); + let errorOverrides = new Map(); + errorOverrides.set(-1, this.language.instant('DMP-USER-INVITATION-DIALOG.ERROR')); + this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides, SnackBarNotificationLevel.Error); const error: HttpError = this.httpErrorHandlingService.getError(errorResponse); if (error.statusCode === 400) {