Merged PR 1220: #3092 Remission Empty List Message

#3092 Remission Empty List Message
This commit is contained in:
Nino Righi
2022-05-09 09:43:20 +00:00
committed by Andreas Schickinger
parent b2dd96f044
commit dd6821642f
3 changed files with 11 additions and 5 deletions

View File

@@ -239,8 +239,6 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
}
this.setFilter(filter);
this.items ? this.setFetching(false) : '';
},
(err) => {}
)
@@ -269,8 +267,8 @@ export class RemissionListComponentStore extends ComponentStore<RemissionState>
tapResponse(
(res) => {
const results = options?.newSearch
? { result: [...res.result], hits: res.hits }
: { result: [...(items ?? []), ...(res.result ?? [])], hits: res.hits };
? { result: [...res.result], hits: res.hits ?? 0 }
: { result: [...(items ?? []), ...(res.result ?? [])], hits: res.hits ?? 0 };
this.setSearchResult(results);
this._searchCompleted.next(this.get());
},

View File

@@ -71,6 +71,9 @@
<page-remission-list-item [item]="item" [returnDto]="return$ | async"></page-remission-list-item>
</div>
<page-remission-list-item-loading *ngIf="fetching$ | async"></page-remission-list-item-loading>
<div *ngIf="listEmpty$ | async" class="bg-white text-center font-semibold text-inactive-branch py-10 rounded-card">
Es sind im Moment keine Artikel vorhanden
</div>
</div>
</div>
<div class="h-px-100"></div>

View File

@@ -7,7 +7,7 @@ import { Config } from '@core/config';
import { RemissionListItem } from '@domain/remission';
import { SupplierDTO } from '@swagger/remi';
import { Subject, combineLatest, BehaviorSubject } from 'rxjs';
import { debounceTime, first, map, takeUntil, withLatestFrom } from 'rxjs/operators';
import { debounceTime, first, map, shareReplay, takeUntil, withLatestFrom } from 'rxjs/operators';
import { RemissionListItemComponent } from './remission-list-item';
import { RemissionListComponentStore } from './remission-list.component-store';
import { RemissionComponentStore } from './remission.component-store';
@@ -98,6 +98,11 @@ export class RemissionListComponent implements OnInit, OnDestroy {
})
);
listEmpty$ = combineLatest([this.fetching$, this.hits$]).pipe(
map(([loading, hits]) => !loading && hits === 0),
shareReplay()
);
trackByItemId = (item: RemissionListItem) => item?.dto?.id;
showScrollArrow$ = new BehaviorSubject<boolean>(false);