mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#2333 Erstellung einer Remission abbrechen
This commit is contained in:
@@ -8,6 +8,7 @@ export const SET_REMISSION_CREATED = '[REMISSION] Set created';
|
||||
export const SET_REMISSION_STARTED = '[REMISSION] Set started';
|
||||
export const SET_REMISSION_COMPLETED = '[REMISSION] Set compleated';
|
||||
export const SET_REMISSION_PROCESS = '[REMISSION] Set remission process';
|
||||
export const REMOVE_REMISSION_PROCESS = '[REMISSION] Remove remission process';
|
||||
export const RELOAD_REMISSION = '[REMISSION] Reload';
|
||||
export const INIT_REMISSION_STATE = '[REMISSION] Init';
|
||||
export const RESET_REMISSION_STATE = '[REMISSION] Reset';
|
||||
@@ -57,6 +58,12 @@ export class SetRemissionProcess {
|
||||
constructor(public remissionProcess: RemissionProcess, public initialValue: boolean = false) {}
|
||||
}
|
||||
|
||||
export class RemoveRemissionProcess {
|
||||
static readonly type = REMOVE_REMISSION_PROCESS;
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
export class ReloadRemission {
|
||||
static readonly type = RELOAD_REMISSION;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import { ReloadFormState } from '../actions/forms.actions';
|
||||
import { FILIALE_LANDING_PAGE } from '../../utils/app.constants';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export const SYNC_DATA_VERSION = 222;
|
||||
export const SYNC_DATA_VERSION = 223;
|
||||
|
||||
export class AppStateModel {
|
||||
currentProcesssId: number;
|
||||
@@ -172,7 +172,8 @@ export class AppState {
|
||||
serverData = JSON.parse(data);
|
||||
}
|
||||
|
||||
const syncedData = { ...currentUserData, ...serverData };
|
||||
const syncedData = { ...currentUserData, ...serverData, version: SYNC_DATA_VERSION };
|
||||
|
||||
const updatedUserDataString = JSON.stringify(syncedData);
|
||||
|
||||
ctx.patchState({
|
||||
@@ -304,6 +305,7 @@ export class AppState {
|
||||
processIds: processIds,
|
||||
activeModule: activeModule,
|
||||
};
|
||||
|
||||
const userData = JSON.stringify(userSyncData);
|
||||
this.store.dispatch(new AppUserDataSync(userData));
|
||||
}
|
||||
|
||||
@@ -102,6 +102,21 @@ export class RemissionState {
|
||||
this.syncApiState(remission);
|
||||
}
|
||||
|
||||
@Action(actions.RemoveRemissionProcess)
|
||||
removeRemissionProcess(ctx: StateContext<RemissionStateModel>, action: actions.RemoveRemissionProcess) {
|
||||
const state = ctx.getState();
|
||||
ctx.patchState({
|
||||
...state,
|
||||
remission: {
|
||||
...state.remission,
|
||||
remissionProcess: undefined,
|
||||
remissionProcessCompleted: false,
|
||||
remissionProcessCreated: false,
|
||||
remissionProcessStarted: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@Action(actions.SetRemissionFinishedProcessStatus)
|
||||
setRemissionFinishedProcessStatus(ctx: StateContext<RemissionStateModel>, { status }: actions.SetRemissionFinishedProcessStatus) {
|
||||
const state = ctx.getState();
|
||||
|
||||
@@ -10,6 +10,7 @@ import { RemissionListStartedComponent } from './../pages/remission-list-started
|
||||
import { RemissionFinishComponent } from './../pages/remission-finish/remission-finish.component';
|
||||
import { ROUTES } from './../remission.const';
|
||||
import { RemissionSelectors } from '../../../core/store/selectors/remission.selectors';
|
||||
import { RemoveRemissionProcess } from '../../../core/store/actions/remission.actions';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -23,6 +24,14 @@ export class CanDeactivatedGuard implements CanDeactivate<RemissionListStartedCo
|
||||
state: RouterStateSnapshot,
|
||||
nextState: RouterStateSnapshot
|
||||
): Observable<boolean> | boolean {
|
||||
const remissionProcess = this.store.selectSnapshot(RemissionSelectors.getRemissionProcess);
|
||||
const remissionProcessStatuses = this.store.selectSnapshot(RemissionSelectors.getRemissionProcessStatuses);
|
||||
|
||||
if (!remissionProcess?.shippingDocuments?.length) {
|
||||
this.store.dispatch(new RemoveRemissionProcess());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!nextState.url.includes(ROUTES.BASE) && !this.noRemissionProcess()) {
|
||||
this.appService.showLeavingRemissionModal();
|
||||
const obs$ = this.modalConfirmationService.afterClosed();
|
||||
|
||||
Reference in New Issue
Block a user