From 62c2ed40b87e4ca1e2fe4dc61d360bb3aad3c535 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 18 Jul 2022 13:32:44 +0530 Subject: [PATCH 1/6] fix: Deselecting a single product from a group, deselects all variants(#2kbkwnr) --- src/views/OrderDetail.vue | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 0ae52b42..b604154c 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -97,7 +97,7 @@
- + @@ -205,12 +205,16 @@ export default defineComponent({ facilities: [] as any, queryString: "", searchedProduct: {} as any, + handleOnChange: false } }, ionViewDidEnter(){ this.fetchFacilities(); }, methods: { + handleChange(value: any){ + this.handleOnChange = value; + }, async listMissingSkus() { const missingSkuModal = await modalController.create({ component: MissingSkuModal, @@ -331,7 +335,7 @@ export default defineComponent({ return popover.present(); }, isParentProductChecked(parentProductId: string) { - const items = (this as any).ordersList.items.filter((item: any) => item.parentProductId === parentProductId) + const items = (this as any).getGroupItems(parentProductId, this.ordersList.items); return items.every((item: any) => item.isSelected) }, selectProduct(item: any, event: any) { @@ -370,11 +374,14 @@ export default defineComponent({ }) }, selectParentProduct(parentProductId: any, event: any) { - this.ordersList.items.forEach((item: any) => { - if (item.parentProductId == parentProductId) { - item.isSelected = event.detail.checked; - } - }) + if(this.handleOnChange){ + this.ordersList.items.forEach((item: any) => { + if (item.parentProductId === parentProductId) { + item.isSelected = event.detail.checked; + } + }) + } + this.handleOnChange = false; } }, setup() { From 5536bb06a4ae9b597232fe55e86923af669e81c2 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 18 Jul 2022 15:59:39 +0530 Subject: [PATCH 2/6] fix: Popover option on a searched product are not working correctly(#2k06eqx) --- src/views/OrderDetail.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index b604154c..f5912598 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -80,7 +80,7 @@ - +
@@ -331,7 +331,10 @@ export default defineComponent({ translucent: true, showBackdrop: true, componentProps: { 'id': id, 'isVirtual': isVirtual, 'item': item } - }) + }); + popover.onDidDismiss().then(() => { + this.searchProduct(this.queryString); + }); return popover.present(); }, isParentProductChecked(parentProductId: string) { From 9e0781e9a781ee36fe334bc7bd62289e7d19223b Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Wed, 19 Oct 2022 19:03:33 +0530 Subject: [PATCH 3/6] Removed extra code(#2kbkwnr) --- src/views/OrderDetail.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index f5912598..3d83f4b8 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -97,7 +97,7 @@
- + @@ -212,9 +212,6 @@ export default defineComponent({ this.fetchFacilities(); }, methods: { - handleChange(value: any){ - this.handleOnChange = value; - }, async listMissingSkus() { const missingSkuModal = await modalController.create({ component: MissingSkuModal, From 40622e19153f028b43546be09c79c76269321ba0 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Wed, 19 Oct 2022 19:08:48 +0530 Subject: [PATCH 4/6] Updated code(#2kbkwnr) --- src/views/OrderDetail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 3d83f4b8..2a2910b5 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -335,7 +335,7 @@ export default defineComponent({ return popover.present(); }, isParentProductChecked(parentProductId: string) { - const items = (this as any).getGroupItems(parentProductId, this.ordersList.items); + const items = this.getGroupItems(parentProductId, this.ordersList.items); return items.every((item: any) => item.isSelected) }, selectProduct(item: any, event: any) { From 63ab24e1602a3e5654f862dd2d0de3e93ad655d8 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Wed, 19 Oct 2022 19:26:16 +0530 Subject: [PATCH 5/6] Updated variable name and added comment(#2kbkwnr) --- src/views/OrderDetail.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 2a2910b5..1a78db8d 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -97,7 +97,7 @@
- + @@ -205,7 +205,7 @@ export default defineComponent({ facilities: [] as any, queryString: "", searchedProduct: {} as any, - handleOnChange: false + toggleParentProduct: false } }, ionViewDidEnter(){ @@ -374,14 +374,15 @@ export default defineComponent({ }) }, selectParentProduct(parentProductId: any, event: any) { - if(this.handleOnChange){ + // Todo: Need to find a better approach. + if(this.toggleParentProduct){ this.ordersList.items.forEach((item: any) => { if (item.parentProductId === parentProductId) { item.isSelected = event.detail.checked; } }) + this.toggleParentProduct = false; } - this.handleOnChange = false; } }, setup() { From 28fc6658ef1669664327ef12b03f5baafa38a6c9 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Wed, 2 Nov 2022 12:09:24 +0530 Subject: [PATCH 6/6] Improved variable name(#2kbkwnr) --- src/views/OrderDetail.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 1a78db8d..87d86857 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -97,7 +97,7 @@
- + @@ -205,7 +205,7 @@ export default defineComponent({ facilities: [] as any, queryString: "", searchedProduct: {} as any, - toggleParentProduct: false + isParentProductUpdated: false } }, ionViewDidEnter(){ @@ -375,13 +375,13 @@ export default defineComponent({ }, selectParentProduct(parentProductId: any, event: any) { // Todo: Need to find a better approach. - if(this.toggleParentProduct){ + if(this.isParentProductUpdated){ this.ordersList.items.forEach((item: any) => { if (item.parentProductId === parentProductId) { item.isSelected = event.detail.checked; } }) - this.toggleParentProduct = false; + this.isParentProductUpdated = false; } } },