mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 1181: #3023 Remission Required Capacities Department wird mitgegeben
#3023 Remission Required Capacities Department wird mitgegeben Related work items: #3023
This commit is contained in:
committed by
Lorenz Hilpert
parent
962f0bc2c6
commit
776115fbed
@@ -250,14 +250,14 @@ export class DomainRemissionService {
|
||||
);
|
||||
}
|
||||
|
||||
getRequiredCapacities(params: { selectedFilters?: { [filterId: string]: string[] }; supplierId: number }) {
|
||||
getRequiredCapacities(params: { departments?: string[]; supplierId: number }) {
|
||||
return this.getCurrentStock().pipe(
|
||||
switchMap((stock) =>
|
||||
this._remiService
|
||||
.RemiGetRequiredCapacities({
|
||||
stockId: stock?.id,
|
||||
payload: {
|
||||
departments: params?.selectedFilters?.abteilungen || params?.selectedFilters?.department || [],
|
||||
departments: params?.departments || [],
|
||||
supplierId: params?.supplierId,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -170,14 +170,19 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
|
||||
$.pipe(
|
||||
tap((_) => this.setFetching(true)),
|
||||
withLatestFrom(this.selectedSupplier$, this.filter$),
|
||||
switchMap(([_, supplier, filter]) =>
|
||||
this._domainRemissionService.getRequiredCapacities({ supplierId: supplier?.id }).pipe(
|
||||
switchMap(([_, supplier, filter]) => {
|
||||
let departments = [];
|
||||
if (filter?.getQueryParams()?.filter_abteilungen) {
|
||||
departments = filter?.getQueryParams()?.filter_abteilungen?.split(';') || [];
|
||||
}
|
||||
|
||||
return this._domainRemissionService.getRequiredCapacities({ supplierId: supplier?.id, departments }).pipe(
|
||||
tapResponse(
|
||||
(response) => this.setRequiredCapacities(response),
|
||||
(err) => {}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { animate, AnimationBuilder, state, style, transition, trigger } from '@angular/animations';
|
||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
||||
import { Component, ChangeDetectionStrategy, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ApplicationService } from '@core/application';
|
||||
@@ -7,7 +7,7 @@ import { Config } from '@core/config';
|
||||
import { DomainRemissionService } from '@domain/remission';
|
||||
import { SupplierDTO } from '@swagger/remi';
|
||||
import { Subject, Observable, combineLatest } from 'rxjs';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { map, takeUntil, withLatestFrom } from 'rxjs/operators';
|
||||
import { RemissionListComponentStore } from './remission-list.component-store';
|
||||
import { RemissionComponentStore } from './remission.component-store';
|
||||
|
||||
@@ -180,6 +180,14 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
|
||||
this._remissionListStore.filter$
|
||||
.pipe(takeUntil(this._onDestroy$), withLatestFrom(this._remissionListStore.selectedSource$))
|
||||
.subscribe(([_, source]) => {
|
||||
if (source === 'Abteilungsremission') {
|
||||
this._remissionListStore.loadRequiredCapacities();
|
||||
}
|
||||
});
|
||||
|
||||
this.returnCount$ = this._remissionService
|
||||
.getReturns({
|
||||
returncompleted: false,
|
||||
|
||||
Reference in New Issue
Block a user