This commit is contained in:
Lorenz Hilpert
2021-09-22 17:51:26 +02:00
9 changed files with 72 additions and 34 deletions

View File

@@ -45,6 +45,8 @@ export class ReOrderActionHandler extends ActionHandler<OrderItemsContext> {
context = await this._command.handleCommand('NOTAVAILABLE', context);
updatedItems.push(...context.items);
}
} else {
return data;
}
}

View File

@@ -1,5 +1,4 @@
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core';
import { Router } from '@angular/router';
import { BreadcrumbService } from '@core/breadcrumb';
import { CommandService } from '@core/command';
import { OrderItemsContext } from '@domain/oms';
@@ -64,12 +63,7 @@ export class GoodsInCleanupListComponent implements OnInit, OnDestroy {
private _onDestroy$ = new Subject<void>();
constructor(
private _breadcrumb: BreadcrumbService,
private _store: GoodsInCleanupListStore,
private _commandService: CommandService,
private _router: Router
) {}
constructor(private _breadcrumb: BreadcrumbService, private _store: GoodsInCleanupListStore, private _commandService: CommandService) {}
ngOnInit(): void {
this.initInitialSearch();
@@ -94,11 +88,7 @@ export class GoodsInCleanupListComponent implements OnInit, OnDestroy {
initInitialSearch() {
if (this._store.hits === 0) {
this._store.searchResult$.pipe(takeUntil(this._onDestroy$)).subscribe(async (result) => {
if (result.hits === 0) {
await this._router.navigate(['/goods/in']);
} else {
await this.updateBreadcrumb();
}
await this.updateBreadcrumb();
});
}

View File

@@ -1,13 +1,26 @@
<div class="list-count">{{ hits$ | async }} Titel</div>
<ui-scroll-container [loading]="loading$ | async" (reachEnd)="loadMore()" [deltaEnd]="150" [itemLength]="itemLength$ | async">
<ui-scroll-container
*ngIf="!(listEmpty$ | async); else emptyMessage"
[loading]="loading$ | async"
(reachEnd)="loadMore()"
[deltaEnd]="150"
[itemLength]="itemLength$ | async"
>
<ng-container *ngFor="let item of items$ | async">
<goods-in-list-item [item]="item" [editSsc]="editSsc" (refresh)="refreshList()"></goods-in-list-item>
<hr />
</ng-container>
</ui-scroll-container>
<div class="actions">
<ng-template #emptyMessage>
<div class="empty-message">
Momentan steht kein Bestellposten zur Nachbearbeitung aus.<br />
Alle Bestellposten sind ordnungsgemäß bearbeitet.
</div>
</ng-template>
<div *ngIf="!(listEmpty$ | async)" class="actions">
<button *ngIf="!editSsc" class="cta-edit-ssc cta-action-primary" (click)="editSsc = true">
Meldenummern vergeben
</button>

View File

@@ -10,6 +10,10 @@
@apply bg-white;
}
.empty-message {
@apply bg-white text-center font-semibold text-inactive-branch py-10 rounded-card;
}
hr {
@apply bg-branch;
height: 2px;

View File

@@ -1,5 +1,4 @@
import { AfterViewInit, ChangeDetectionStrategy, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core';
import { Router } from '@angular/router';
import { BreadcrumbService } from '@core/breadcrumb';
import { DomainOmsService } from '@domain/oms';
import { BehaviorSubject, combineLatest, Observable, Subject } from 'rxjs';
@@ -25,6 +24,11 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
loading$ = this._store.loading$.pipe(shareReplay());
listEmpty$ = combineLatest([this.loading$, this.hits$]).pipe(
map(([loading, hits]) => !loading && hits === 0),
shareReplay()
);
editSsc: boolean;
editSscDisabled$: Observable<boolean>;
@@ -33,12 +37,7 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
private _onDestroy$ = new Subject();
constructor(
private _breadcrumb: BreadcrumbService,
private _domainOmsService: DomainOmsService,
private _store: GoodsInListStore,
private _router: Router
) {}
constructor(private _breadcrumb: BreadcrumbService, private _domainOmsService: DomainOmsService, private _store: GoodsInListStore) {}
ngOnInit() {
this.initInitialSearch();
@@ -75,11 +74,7 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
initInitialSearch() {
if (this._store.hits === 0) {
this._store.searchResult$.pipe(takeUntil(this._onDestroy$)).subscribe(async (result) => {
if (result.hits === 0) {
await this._router.navigate(['/goods/in']);
} else {
await this.updateBreadcrumb();
}
await this.updateBreadcrumb();
});
}

View File

@@ -118,13 +118,9 @@ export class GoodsInReservationComponent implements OnInit, OnDestroy {
initInitialSearch() {
if (this._store.hits === 0) {
this._store.searchResult$.pipe(takeUntil(this._onDestroy$)).subscribe(async (result) => {
if (result.hits === 0) {
await this._router.navigate(['/goods/in']);
} else {
await this.updateBreadcrumb();
if (result.hits === 1) {
this.navigateToDetails(result.result[0]);
}
await this.updateBreadcrumb();
if (result.hits === 1) {
this.navigateToDetails(result.result[0]);
}
});
}

View File

@@ -32,3 +32,21 @@
</ng-container>
</div>
</ng-container>
<ng-container *ngIf="isToday$ | async">
<div class="task-list ongoing-list" *ngIf="ongoingItems$ | async; let ongoingItems">
<div class="head-row">
<div class="head-row-title">
<h4>Laufende Aufgaben</h4>
</div>
<div class="head-row-info">
<span class="muted"> {{ ongoingItems?.length }} Aufgaben </span>
</div>
</div>
<hr />
<ng-container *ngFor="let item of ongoingItems">
<page-task-list-item [item]="item" (click)="select.emit(item)"></page-task-list-item>
<hr />
</ng-container>
</div>
</ng-container>

View File

@@ -58,6 +58,26 @@ export class TaskListComponent {
})
);
ongoingItems$ = combineLatest([this.items$, this.selected$]).pipe(
map(([items, selectedDate]) => {
// Filter Aufgaben die vor dem aktuellen Tag gestartet sind und nicht überfällig oder abgeschlossen sind
const list = items.filter((item) => {
const type = this.domainTaskCalendarService.getInfoType(item);
const processingStatus = this.domainTaskCalendarService.getProcessingStatusList(item);
if (
type === 'Task' &&
processingStatus.includes('InProcess') &&
!processingStatus.includes('Overdue') &&
!processingStatus.includes('Completed')
) {
return new Date(item.taskDate) < this.today;
}
return false;
});
return this.sort(list, ['Overdue', 'InProcess', 'Approved', 'Completed']);
})
);
selectedItems$ = combineLatest([this.items$, this.selected$]).pipe(
map(([items, date]) => items.filter((item) => this.dateAdapter.equals(this.domainTaskCalendarService.getDisplayInfoDate(item), date))),
// Sortierung der aufgaben nach Rot => Gelb => Grau => Grün

View File

@@ -5,6 +5,6 @@ import { Pipe, PipeTransform } from '@angular/core';
})
export class ReplacePipe implements PipeTransform {
transform(value: string, replaceStr: string = '', replaceWith: string = ''): string {
return value?.replace(replaceStr, replaceWith);
return value?.replace(new RegExp(replaceStr, 'gi'), replaceWith);
}
}