invite dmp user changes

This commit is contained in:
amentis 2024-06-07 12:24:43 +03:00
parent 37ab19b945
commit 66fe4cf311
3 changed files with 14 additions and 14 deletions

View File

@ -35,7 +35,7 @@
<mat-icon *ngIf="isUserSelected(userIndex)" [ngClass]="{'drag-handle-disabled': viewOnly}" cdkDragHandle class="drag-handle">drag_indicator</mat-icon>
</div>
<div class="col-12 col-xl-auto">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style" [formControl]="user.get('userType')" class="w-100">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style" [formControl]="user.get('userType')" (change)="userTypeChange($event, userIndex)" class="w-100">
<div *ngFor="let userType of dmpUserTypeEnumValues" class="col p-0">
<mat-button-toggle class="lang-button w-100" [value]="userType">{{enumUtils.toDmpUserTypeString(userType)}}</mat-button-toggle>
</div>

View File

@ -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);
}
}
}

View File

@ -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<number, string>();
// 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<number, string>();
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) {