RED-4361: Improve actions after archiving dossier
This commit is contained in:
parent
c1eee73804
commit
27f2ab35a9
@ -165,7 +165,6 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
|||||||
if (result === ConfirmOptions.CONFIRM) {
|
if (result === ConfirmOptions.CONFIRM) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await firstValueFrom(this._archivedDossiersService.archive([this.dossier]));
|
await firstValueFrom(this._archivedDossiersService.archive([this.dossier]));
|
||||||
await this._router.navigate([this.dossier.dossiersListRouterLink]);
|
|
||||||
this._toaster.success(_('dossier-listing.archive.archive-succeeded'), { params: this.dossier });
|
this._toaster.success(_('dossier-listing.archive.archive-succeeded'), { params: this.dossier });
|
||||||
this._editDossierDialogRef.close();
|
this._editDossierDialogRef.close();
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
return this._dossierTemplate;
|
return this._dossierTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
set dossierTemplate(value) {
|
set dossierTemplate(value: DossierTemplate) {
|
||||||
this._dossierTemplate = value;
|
this._dossierTemplate = value;
|
||||||
this.dictionaries = this._dictionaries;
|
this.dictionaries = this._dictionaries;
|
||||||
this._compareDictionary = this.selectDictionary;
|
this._compareDictionary = this.selectDictionary;
|
||||||
|
|||||||
@ -11,9 +11,8 @@ const templatesSorter = (a: DashboardStats, b: DashboardStats) => {
|
|||||||
return -1;
|
return -1;
|
||||||
} else if (a.isEmpty && !b.isEmpty) {
|
} else if (a.isEmpty && !b.isEmpty) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Injectable, Injector } from '@angular/core';
|
import { Injectable, Injector } from '@angular/core';
|
||||||
import { ARCHIVE_ROUTE, Dossier, DOSSIERS_ARCHIVE } from '@red/domain';
|
import { ARCHIVE_ROUTE, Dossier, DOSSIERS_ARCHIVE, DOSSIERS_ROUTE } from '@red/domain';
|
||||||
import { catchError, switchMap, tap } from 'rxjs/operators';
|
import { catchError, switchMap, tap } from 'rxjs/operators';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
@ -8,6 +8,7 @@ import { DossiersService } from './dossiers.service';
|
|||||||
import { FilesMapService } from '../files/files-map.service';
|
import { FilesMapService } from '../files/files-map.service';
|
||||||
import { FeaturesService } from '../features.service';
|
import { FeaturesService } from '../features.service';
|
||||||
import { DashboardStatsService } from '@services/dossier-templates/dashboard-stats.service';
|
import { DashboardStatsService } from '@services/dossier-templates/dashboard-stats.service';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ArchivedDossiersService extends DossiersService {
|
export class ArchivedDossiersService extends DossiersService {
|
||||||
@ -17,6 +18,7 @@ export class ArchivedDossiersService extends DossiersService {
|
|||||||
private readonly _filesMapService: FilesMapService,
|
private readonly _filesMapService: FilesMapService,
|
||||||
private readonly _featuresService: FeaturesService,
|
private readonly _featuresService: FeaturesService,
|
||||||
private readonly _dashboardStats: DashboardStatsService,
|
private readonly _dashboardStats: DashboardStatsService,
|
||||||
|
private readonly _router: Router,
|
||||||
) {
|
) {
|
||||||
super(_injector, 'archived-dossiers', ARCHIVE_ROUTE);
|
super(_injector, 'archived-dossiers', ARCHIVE_ROUTE);
|
||||||
}
|
}
|
||||||
@ -28,10 +30,18 @@ export class ArchivedDossiersService extends DossiersService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const archivedDossiersIds = dossiers.map(d => d.dossierId);
|
const archivedDossiersIds = dossiers.map(d => d.dossierId);
|
||||||
|
const dossierTemplateId = dossiers[0].dossierTemplateId;
|
||||||
|
|
||||||
return this._post(archivedDossiersIds, `${this._defaultModelPath}/archive`).pipe(
|
return this._post(archivedDossiersIds, `${this._defaultModelPath}/archive`).pipe(
|
||||||
switchMap(() => this._dashboardStats.loadAll()),
|
switchMap(() => this._dashboardStats.loadAll()),
|
||||||
tap(() => this.#removeFromActiveDossiers(archivedDossiersIds)),
|
tap(() => this.#removeFromActiveDossiers(archivedDossiersIds)),
|
||||||
|
switchMap(async () => {
|
||||||
|
let route = dossiers[0].dossiersListRouterLink;
|
||||||
|
if (!this._activeDossiersService.all.find(d => d.dossierTemplateId === dossierTemplateId)) {
|
||||||
|
route = route.replace(DOSSIERS_ROUTE, ARCHIVE_ROUTE);
|
||||||
|
}
|
||||||
|
await this._router.navigate([route]);
|
||||||
|
}),
|
||||||
catchError(showArchiveFailedToast),
|
catchError(showArchiveFailedToast),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user