mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 1395: #3481 Remission Filter zwischenspeichern bei Wechsel zwischen Pflicht- und Ab...
#3481 Remission Filter zwischenspeichern bei Wechsel zwischen Pflicht- und Abteilungsremission Related work items: #3481
This commit is contained in:
committed by
Lorenz Hilpert
parent
ab345dae0d
commit
ed6ee36509
@@ -20,6 +20,9 @@ export interface RemissionState {
|
||||
items?: RemissionListItem[];
|
||||
requiredCapacities: [];
|
||||
fetching?: boolean;
|
||||
|
||||
pflichtQueryParams: Record<string, string>;
|
||||
abteilungQueryParams: Record<string, string>;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@@ -32,6 +35,8 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
|
||||
hits: 0,
|
||||
items: [],
|
||||
requiredCapacities: undefined,
|
||||
pflichtQueryParams: undefined,
|
||||
abteilungQueryParams: undefined,
|
||||
});
|
||||
|
||||
searchCompleted = this._searchCompleted.asObservable();
|
||||
@@ -75,6 +80,14 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
|
||||
return this.select((s) => s.selectedSource);
|
||||
}
|
||||
|
||||
get abteilungQueryParams() {
|
||||
return this.get((s) => s.abteilungQueryParams);
|
||||
}
|
||||
|
||||
get pflichtQueryParams() {
|
||||
return this.get((s) => s.pflichtQueryParams);
|
||||
}
|
||||
|
||||
get filter() {
|
||||
return this.get((s) => s.filter);
|
||||
}
|
||||
@@ -132,6 +145,8 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
|
||||
hits: 0,
|
||||
items: [],
|
||||
requiredCapacities: undefined,
|
||||
pflichtQueryParams: undefined,
|
||||
abteilungQueryParams: undefined,
|
||||
});
|
||||
this.loadSuppliers();
|
||||
this.loadSources();
|
||||
@@ -366,6 +381,8 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
|
||||
setFilter = this.updater<UiFilter>((state, filter) => ({
|
||||
...state,
|
||||
filter,
|
||||
pflichtQueryParams: this.selectedSource === 'Pflichtremission' ? filter.getQueryParams() : this.pflichtQueryParams,
|
||||
abteilungQueryParams: this.selectedSource === 'Abteilungsremission' ? filter.getQueryParams() : this.abteilungQueryParams,
|
||||
}));
|
||||
|
||||
setItems = this.updater<RemissionListItem[]>((state, items) => ({
|
||||
@@ -459,8 +476,11 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
|
||||
this._triggerReload$.next(true);
|
||||
this.setSearchResult({ result: [], hits: 0 });
|
||||
this.clearCache();
|
||||
|
||||
const queryParams = this.selectedSource === 'Abteilungsremission' ? this.pflichtQueryParams : this.abteilungQueryParams;
|
||||
await this._router.navigate([], {
|
||||
queryParams: {
|
||||
...queryParams,
|
||||
source: this.selectedSource,
|
||||
supplier: supplier.id,
|
||||
scroll_position: 0,
|
||||
@@ -475,8 +495,12 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
|
||||
this._triggerReload$.next(true);
|
||||
this.setSearchResult({ result: [], hits: 0 });
|
||||
this.clearCache();
|
||||
|
||||
// Damit beim Wechsel der Filter korrekt wiederhergestellt wird, werden die QueryParams im Store gemerkt und beim navigieren übergeben
|
||||
const queryParams = this.selectedSource === 'Abteilungsremission' ? this.pflichtQueryParams : this.abteilungQueryParams;
|
||||
await this._router.navigate([], {
|
||||
queryParams: {
|
||||
...queryParams,
|
||||
source,
|
||||
supplier: this.selectedSupplier.id,
|
||||
scroll_position: 0,
|
||||
|
||||
Reference in New Issue
Block a user