diff --git a/src/views/catalog.vue b/src/views/catalog.vue index efefca6c..68fb027f 100644 --- a/src/views/catalog.vue +++ b/src/views/catalog.vue @@ -9,7 +9,7 @@ - +
@@ -77,7 +77,7 @@ -->
- +
@@ -157,7 +157,8 @@ export default defineComponent({ value: 'REMOVED' }*/], queryString: '', - preordBckordComputationJob: {} as any + preordBckordComputationJob: {} as any, + isScrollingEnabled: false } }, computed: { @@ -169,6 +170,7 @@ export default defineComponent({ }) }, async ionViewWillEnter() { + this.isScrollingEnabled = false; await this.getCatalogProducts() await this.preparePreordBckordComputationJob() }, @@ -200,13 +202,28 @@ export default defineComponent({ await this.store.dispatch("product/findCatalogProducts", payload); }, + enableScrolling() { + const parentElement = (this as any).$refs.contentRef.$el + const scrollEl = parentElement.shadowRoot.querySelector("main[part='scroll']") + let scrollHeight = scrollEl.scrollHeight, infiniteHeight = (this as any).$refs.infiniteScrollRef.$el.offsetHeight, scrollTop = scrollEl.scrollTop, threshold = 100, height = scrollEl.offsetHeight + const distanceFromInfinite = scrollHeight - infiniteHeight - scrollTop - threshold - height + if(distanceFromInfinite < 0) { + this.isScrollingEnabled = false; + } else { + this.isScrollingEnabled = true; + } + }, async loadMoreProducts(event: any){ + // Added this check here as if added on infinite-scroll component the Loading content does not gets displayed + if(!(this.isScrollingEnabled && this.isCatalogScrollable)) { + await event.target.complete(); + } this.getCatalogProducts( undefined, Math.ceil(this.products.length / process.env.VUE_APP_VIEW_SIZE).toString() - ).then(() => { - event.target.complete(); - }) + ).then(async () => { + await event.target.complete(); + }); }, async applyFilter(value: string) { if(value !== this.prodCatalogCategoryTypeId) { diff --git a/src/views/orders.vue b/src/views/orders.vue index 30bdaaf8..f85d2297 100644 --- a/src/views/orders.vue +++ b/src/views/orders.vue @@ -18,7 +18,7 @@ - +
- - + + @@ -258,6 +266,7 @@ export default defineComponent({ data() { return { cusotmerLoyaltyOptions : JSON.parse(process.env?.VUE_APP_CUST_LOYALTY_OPTIONS), + isScrollingEnabled: false } }, computed: { @@ -278,17 +287,35 @@ export default defineComponent({ query: 'order/getQuery', }), }, + async ionViewWillEnter() { + this.isScrollingEnabled = false; + }, methods: { updateQuery() { this.query.viewSize = parseInt(process.env.VUE_APP_VIEW_SIZE); this.query.viewIndex = 0; this.store.dispatch("order/updateQuery", { query: this.query}); }, + enableScrolling() { + const parentElement = (this as any).$refs.contentRef.$el + const scrollEl = parentElement.shadowRoot.querySelector("main[part='scroll']") + let scrollHeight = scrollEl.scrollHeight, infiniteHeight = (this as any).$refs.infiniteScrollRef.$el.offsetHeight, scrollTop = scrollEl.scrollTop, threshold = 100, height = scrollEl.offsetHeight + const distanceFromInfinite = scrollHeight - infiniteHeight - scrollTop - threshold - height + if(distanceFromInfinite < 0) { + this.isScrollingEnabled = false; + } else { + this.isScrollingEnabled = true; + } + }, async loadMoreOrders(event: any) { + // Added this check here as if added on infinite-scroll component the Loading content does not gets displayed + if(!(this.isScrollingEnabled && this.isScrolleable)) { + await event.target.complete(); + } this.query.viewIndex = Math.ceil(this.orders.length / process.env.VUE_APP_VIEW_SIZE); - this.store.dispatch("order/updateQuery", { query: this.query}).then(() => { - event.target.complete(); - }) + this.store.dispatch("order/updateQuery", { query: this.query}).then(async () => { + await event.target.complete(); + }); }, async releaseItems() { emitter.emit("presentLoader") diff --git a/src/views/products.vue b/src/views/products.vue index 22636b5c..1fcab287 100644 --- a/src/views/products.vue +++ b/src/views/products.vue @@ -14,7 +14,7 @@ - + @@ -38,7 +38,7 @@ {{ product.doclist.numFound }} {{ $t("pieces preordered") }} - + @@ -101,7 +101,8 @@ export default defineComponent({ orderedAfter: '', orderedBefore: '', selectedItems: [] as any, - hasQuery: false + hasQuery: false, + isScrollingEnabled: false } }, computed: { @@ -114,14 +115,32 @@ export default defineComponent({ currentEComStore: 'user/getCurrentEComStore', }) }, + async ionViewWillEnter() { + this.isScrollingEnabled = false; + }, methods: { + enableScrolling() { + const parentElement = (this as any).$refs.contentRef.$el + const scrollEl = parentElement.shadowRoot.querySelector("main[part='scroll']") + let scrollHeight = scrollEl.scrollHeight, infiniteHeight = (this as any).$refs.infiniteScrollRef.$el.offsetHeight, scrollTop = scrollEl.scrollTop, threshold = 100, height = scrollEl.offsetHeight + const distanceFromInfinite = scrollHeight - infiniteHeight - scrollTop - threshold - height + if(distanceFromInfinite < 0) { + this.isScrollingEnabled = false; + } else { + this.isScrollingEnabled = true; + } + }, async loadMoreProducts(event: any) { + // Added this check here as if added on infinite-scroll component the Loading content does not gets displayed + if(!(this.isScrollingEnabled && this.isScrolleable)) { + await event.target.complete(); + } this.getProducts( undefined, Math.ceil(this.products.length / process.env.VUE_APP_VIEW_SIZE).toString() - ).then(() => { - event.target.complete(); - }) + ).then(async () => { + await event.target.complete(); + }); }, async getProducts( vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE;