mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Scanner Logik Fix
This commit is contained in:
@@ -59,6 +59,7 @@ export class ArticleDetailsStore extends ComponentStore<ArticleDetailsState> {
|
||||
//#region Lesepunkte
|
||||
readonly fetchingPromotionPoints$ = this.select((s) => s.fetchingPromotionPoints);
|
||||
readonly promotionPoints$ = this.item$.pipe(
|
||||
filter((item) => !!item?.id && !!item.catalogAvailability?.price?.value?.value),
|
||||
tap(() => this.patchState({ fetchingPromotionPoints: true, fetchingPromotionPointsError: undefined })),
|
||||
switchMap((item) =>
|
||||
!!item
|
||||
|
||||
@@ -57,6 +57,10 @@ export class ArticleSearchStore extends ComponentStore<ArticleSearchState> {
|
||||
|
||||
readonly selectSearchState$: Observable<'fetching' | 'empty' | ''> = this.select((s) => s.searchState);
|
||||
readonly selectQuery$: Observable<{ query: string; history?: boolean }> = this.select((s) => s.query);
|
||||
get query() {
|
||||
return this.get((s) => s.query);
|
||||
}
|
||||
|
||||
readonly selectRecentQueries$: Observable<{ input: string; filter: string; primaryFilter: string }[]> = this.select(
|
||||
(s) => s.recentQueries
|
||||
);
|
||||
|
||||
@@ -97,11 +97,11 @@ export class ArticleSearchboxComponent implements OnInit, OnDestroy {
|
||||
this.subscriptions.unsubscribe();
|
||||
}
|
||||
|
||||
async startSearch() {
|
||||
const isMobile = await this.environmentService.isMobile();
|
||||
const query = await this.query$.pipe(delay(100), first()).toPromise();
|
||||
startSearch() {
|
||||
const isNative = this.nativeContainer.isUiWebview().isNative;
|
||||
const query = this.articleSearchStore.query?.query ?? '';
|
||||
|
||||
if (isMobile && (query?.length ?? 0) === 0) {
|
||||
if (isNative && (query?.length ?? 0) === 0) {
|
||||
return this.scan();
|
||||
} else {
|
||||
this.articleSearchStore.search({ empty: true, scrollPosReset: true });
|
||||
@@ -152,11 +152,8 @@ export class ArticleSearchboxComponent implements OnInit, OnDestroy {
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
|
||||
async updateQuery(query: string) {
|
||||
const isHistoryCall = await this.isHistory$.pipe(first()).toPromise();
|
||||
if (!isHistoryCall) {
|
||||
this.articleSearchStore.setQuery({ query });
|
||||
}
|
||||
updateQuery(query: string) {
|
||||
this.articleSearchStore.setQuery({ query });
|
||||
}
|
||||
|
||||
async autocompleteTrigger(queryAutocomplete: string) {
|
||||
|
||||
@@ -63,14 +63,19 @@ export class UiSearchboxInputDirective implements ControlValueAccessor {
|
||||
}
|
||||
|
||||
setValue(value: string, { inputType }: { inputType?: 'input' | 'autocomplete' | 'init' }) {
|
||||
this.value = value;
|
||||
this.onChange(value);
|
||||
this.onTouched();
|
||||
if (this.value !== value) {
|
||||
this.value = value;
|
||||
|
||||
if (inputType === 'input') {
|
||||
this.inputChange.emit(value);
|
||||
} else if (inputType === 'autocomplete') {
|
||||
this.select.emit(value);
|
||||
if (inputType !== 'init') {
|
||||
this.onChange(value);
|
||||
this.onTouched();
|
||||
}
|
||||
|
||||
if (inputType === 'input') {
|
||||
this.inputChange.emit(value);
|
||||
} else if (inputType === 'autocomplete') {
|
||||
this.select.emit(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user