mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#3021 - Remission offene WBS werden nicht angezeigt
This commit is contained in:
@@ -30,8 +30,7 @@ export class DomainRemissionService {
|
||||
private readonly _stockService: StockService,
|
||||
private readonly _supplierService: SupplierService,
|
||||
private readonly _returnService: ReturnService,
|
||||
private readonly _search: SearchService,
|
||||
private readonly _dateAdapter: DateAdapter
|
||||
private readonly _search: SearchService
|
||||
) {}
|
||||
|
||||
@memorize()
|
||||
@@ -332,20 +331,21 @@ export class DomainRemissionService {
|
||||
.toPromise();
|
||||
}
|
||||
|
||||
getReturns(returncompleted?: boolean): Observable<ReturnDTO[]> {
|
||||
getReturns(params: { start?: Date; returncompleted: boolean }): Observable<ReturnDTO[]> {
|
||||
const queryToken: ReturnQueryTokenDTO = {
|
||||
start: this._dateAdapter.addCalendarDays(new Date(), -7).toISOString(),
|
||||
stop: new Date().toISOString(),
|
||||
start: params.start?.toISOString(),
|
||||
filter: {
|
||||
returncompleted: returncompleted ? 'true' : 'false',
|
||||
returncompleted: params.returncompleted ? 'true' : 'false',
|
||||
},
|
||||
eagerLoading: 3,
|
||||
input: {},
|
||||
};
|
||||
|
||||
if (returncompleted === undefined) {
|
||||
delete queryToken?.filter?.returncompleted;
|
||||
}
|
||||
Object.keys(queryToken).forEach((key) => {
|
||||
if (!queryToken[key]) {
|
||||
delete queryToken[key];
|
||||
}
|
||||
});
|
||||
|
||||
return this.getCurrentStock().pipe(
|
||||
switchMap((stock) => this._returnService.ReturnQueryReturns({ stockId: stock.id, queryToken })),
|
||||
|
||||
@@ -173,14 +173,13 @@ describe('ShellComponent', () => {
|
||||
|
||||
it('should display the menu items for section customer', () => {
|
||||
applicationServiceMock.getSection$.and.returnValue(of('customer'));
|
||||
spyOnProperty(spectator.component, 'lastCartProcessId$').and.returnValue(of(123));
|
||||
spectator.detectComponentChanges();
|
||||
|
||||
const anchors = spectator.queryAll('shell-footer a');
|
||||
expect(anchors[0]).toHaveText('Artikelsuche');
|
||||
expect(anchors[0]).toHaveAttribute('href', '/kunde/123/product');
|
||||
expect(anchors[0]).toHaveAttribute('href', '/kunde/product');
|
||||
expect(anchors[1]).toHaveText('Kundensuche');
|
||||
expect(anchors[1]).toHaveAttribute('href', '/kunde/123/customer');
|
||||
expect(anchors[1]).toHaveAttribute('href', '/kunde/customer');
|
||||
expect(anchors[2]).toHaveText('Warenausgabe');
|
||||
expect(anchors[2]).toHaveAttribute('href', '/kunde/goods/out');
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Router } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ProductImagePipe } from '@cdn/product-image';
|
||||
import { createComponentFactory, Spectator } from '@ngneat/spectator';
|
||||
import { UiSliderComponent } from '@ui/slider';
|
||||
@@ -8,6 +10,7 @@ describe('ProductsCardComponent', () => {
|
||||
|
||||
const createComponent = createComponentFactory({
|
||||
component: ProductsCardComponent,
|
||||
imports: [RouterTestingModule],
|
||||
declarations: [MockComponent(UiSliderComponent), MockPipe(ProductImagePipe, (ean) => 'ean-' + ean)],
|
||||
});
|
||||
|
||||
@@ -69,4 +72,27 @@ describe('ProductsCardComponent', () => {
|
||||
expect((spectator.queryAll('img')[0] as any).alt).toBe('Product 1');
|
||||
expect((spectator.queryAll('img')[1] as any).alt).toBe('Product 2');
|
||||
});
|
||||
|
||||
describe('navigatetToProduct()', () => {
|
||||
it('should navigate to product details', () => {
|
||||
const router = spectator.inject(Router);
|
||||
spyOn(router, 'navigate');
|
||||
const ean = '1234567890123';
|
||||
spectator.setInput('feed', {
|
||||
label: 'title',
|
||||
type: 'products',
|
||||
items: [
|
||||
{
|
||||
product: {
|
||||
ean,
|
||||
name: 'Product 1',
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
spectator.detectChanges();
|
||||
spectator.click('ui-slider img');
|
||||
expect(router.navigate).toHaveBeenCalledWith(['/kunde/product/details/ean', ean]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -180,7 +180,11 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
|
||||
this.returnCount$ = this._remissionService.getReturns(false).pipe(map((items) => items?.length || 0));
|
||||
this.returnCount$ = this._remissionService
|
||||
.getReturns({
|
||||
returncompleted: false,
|
||||
})
|
||||
.pipe(map((items) => items?.length || 0));
|
||||
|
||||
this._activatedRoute.params.pipe(takeUntil(this._onDestroy$)).subscribe((params) => {
|
||||
const id = +params.returnId;
|
||||
|
||||
@@ -3,7 +3,9 @@ import { BreadcrumbService } from '@core/breadcrumb';
|
||||
import { Config } from '@core/config';
|
||||
import { DomainRemissionService } from '@domain/remission';
|
||||
import { ReturnDTO } from '@swagger/remi';
|
||||
import { Observable } from 'rxjs';
|
||||
import { DateAdapter } from '@ui/common';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'page-shipping-document-list',
|
||||
@@ -14,12 +16,24 @@ import { Observable } from 'rxjs';
|
||||
export class ShippingDocumentListComponent implements OnInit {
|
||||
returns$: Observable<ReturnDTO[]>;
|
||||
|
||||
constructor(private _remissionService: DomainRemissionService, private _breadcrumb: BreadcrumbService, private _config: Config) {}
|
||||
constructor(
|
||||
private _remissionService: DomainRemissionService,
|
||||
private _breadcrumb: BreadcrumbService,
|
||||
private _config: Config,
|
||||
private readonly _dateAdapter: DateAdapter
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.addBreadcrumbIfNotExists();
|
||||
this.removeDetailBreadcrumbs();
|
||||
this.returns$ = this._remissionService.getReturns();
|
||||
this.returns$ = combineLatest([
|
||||
this._remissionService.getReturns({ returncompleted: false }),
|
||||
this._remissionService.getReturns({ returncompleted: true, start: this._dateAdapter.addCalendarDays(new Date(), -7) }),
|
||||
]).pipe(
|
||||
map(([returns, returnsLastWeek]) => {
|
||||
return [...returns, ...returnsLastWeek];
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
addBreadcrumbIfNotExists() {
|
||||
|
||||
Reference in New Issue
Block a user