Restyles invitation dialog and adds message on successfully sent
This commit is contained in:
parent
9c7bd9a59c
commit
dcc8f3823b
|
@ -16,6 +16,9 @@ import { Observable } from 'rxjs';
|
|||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { Role } from '@app/core/common/enum/role';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { SnackBarNotificationLevel } from '@common/modules/notification/ui-notification-service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-invitation-dialog-component',
|
||||
|
@ -41,7 +44,9 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni
|
|||
public enumUtils: EnumUtils,
|
||||
public route: ActivatedRoute,
|
||||
public router: Router,
|
||||
private language: TranslateService,
|
||||
public dialogRef: MatDialogRef<DmpInvitationDialogComponent>,
|
||||
private uiNotificationService: UiNotificationService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
super();
|
||||
|
@ -98,9 +103,13 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni
|
|||
|
||||
this.invitationService.inviteDmpInvitationUsers(invitationObject)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(items => {
|
||||
this.dialogRef.close();
|
||||
});
|
||||
.subscribe(
|
||||
complete => {
|
||||
this.dialogRef.close();
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
||||
closeDialog(): void {
|
||||
|
@ -130,4 +139,12 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni
|
|||
return this.formGroup.get('users') && this.formGroup.get('users').value && this.formGroup.get('users').value.length > 0;
|
||||
}
|
||||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.INVITATION-DIALOG.SUCCESS' ), SnackBarNotificationLevel.Success);
|
||||
}
|
||||
|
||||
onCallbackError(errorResponse: any) {
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.INVITATION-DIALOG.ERROR' ), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,7 +87,9 @@
|
|||
"UPLOAD-FILE": "Upload File"
|
||||
},
|
||||
"INVITATION-DIALOG": {
|
||||
"HINT": "Press comma or enter between authors"
|
||||
"HINT": "Press comma or enter between authors",
|
||||
"SUCCESS": "Invitation successfully sent",
|
||||
"ERROR": "Invitation sent failed"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"VIEW-ALL": "View All",
|
||||
|
|
Loading…
Reference in New Issue