diff --git a/src/app/shared/enum/messageBar.ts b/src/app/shared/enum/messageBar.ts index 019692c0a9..0a4058916e 100644 --- a/src/app/shared/enum/messageBar.ts +++ b/src/app/shared/enum/messageBar.ts @@ -4,3 +4,9 @@ export enum messageType { warningBlue = 'priority_high', error = 'close', } + +export enum messageStatus { + left = 'Гурток успішно залишено', + approved = 'Статус заявки успішно змінено', + rejected = 'Заявку успішно відхилено' +} diff --git a/src/app/shared/store/user.state.ts b/src/app/shared/store/user.state.ts index d1db6a71a3..5e4bc8dd61 100644 --- a/src/app/shared/store/user.state.ts +++ b/src/app/shared/store/user.state.ts @@ -71,6 +71,8 @@ import { GetAllUsersChildren, ResetSelectedWorkshop, } from './user.actions'; +import { ApplicationStatus } from '../enum/applications'; +import { messageStatus } from '../enum/messageBar'; export interface UserStateModel { @@ -480,7 +482,10 @@ export class UserState { @Action(OnUpdateApplicationSuccess) onUpdateApplicationSuccess({ dispatch }: StateContext, { payload }: OnUpdateApplicationSuccess): void { - dispatch(new ShowMessageBar({ message: 'Статус заявки успішно змінено', type: 'success' })); + + dispatch(new ShowMessageBar({ message: payload.status === ApplicationStatus.Left + ? messageStatus.left + : messageStatus.approved, type: 'success' })); dispatch(new GetApplicationsByParentId(payload.parentId)); } @Action(CreateRating) diff --git a/src/app/shell/personal-cabinet/applications/applications.component.ts b/src/app/shell/personal-cabinet/applications/applications.component.ts index 1062b4dff8..913a0b2be1 100644 --- a/src/app/shell/personal-cabinet/applications/applications.component.ts +++ b/src/app/shell/personal-cabinet/applications/applications.component.ts @@ -95,7 +95,7 @@ export class ApplicationsComponent extends CabinetDataComponent implements OnIni * @param Application event */ onApprove(application: Application): void { - const applicationUpdate = new ApplicationUpdate(application.id, this.applicationStatus.Approved); + const applicationUpdate = new ApplicationUpdate(application.id, this.applicationStatus.Approved); this.store.dispatch(new UpdateApplication(applicationUpdate)); }