From 87da79af3a35e096a951add1a57f430c1c72d13f Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 7 Dec 2023 18:19:19 +0530 Subject: [PATCH 1/3] Improved: code to remove disable property in selectProductStore modal (#70) --- src/components/SelectProductStoreModal.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/SelectProductStoreModal.vue b/src/components/SelectProductStoreModal.vue index 9dd78e96..70f63f2a 100644 --- a/src/components/SelectProductStoreModal.vue +++ b/src/components/SelectProductStoreModal.vue @@ -21,7 +21,7 @@ - + @@ -108,9 +108,6 @@ export default defineComponent({ }, isSelected(productStoreId: string) { return this.selectedProductStoreValues.some((productStore: any) => productStore.productStoreId === productStoreId); - }, - isProductStoreUpdated() { - return this.selectedProductStoreValues.some((selectedStore: any) => this.selectedProductStores.some((store: any) => store.productStoreId === selectedStore.productStoreId)); } }, setup() { From 543719af766aec3afeff260247bdaa81f1ee501e Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 7 Dec 2023 19:20:55 +0530 Subject: [PATCH 2/3] Improved: code for filtering stores to add or remove based on productStoreId (#70) --- src/components/SelectProductStoreModal.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectProductStoreModal.vue b/src/components/SelectProductStoreModal.vue index 70f63f2a..a166181c 100644 --- a/src/components/SelectProductStoreModal.vue +++ b/src/components/SelectProductStoreModal.vue @@ -84,8 +84,8 @@ export default defineComponent({ modalController.dismiss({ dismissed: true}); }, async saveProductStores() { - const productStoresToCreate = this.selectedProductStoreValues.filter((selectedFacility: any) => !this.selectedProductStores.some((facility: any) => facility.facilityId === selectedFacility.facilityId)) - const productStoresToRemove = this.selectedProductStores.filter((facility: any) => !this.selectedProductStoreValues.some((selectedFacility: any) => facility.facilityId === selectedFacility.facilityId)) + const productStoresToCreate = this.selectedProductStoreValues.filter((selectedStore: any) => !this.selectedProductStores.some((store: any) => store.productStoreId === selectedStore.productStoreId)) + const productStoresToRemove = this.selectedProductStores.filter((store: any) => !this.selectedProductStoreValues.some((selectedStore: any) => store.productStoreId === selectedStore.productStoreId)) modalController.dismiss({ dismissed: true, From 9f8c19bdb0d90c89be549b0f26953f048f63eb3d Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 7 Dec 2023 19:24:26 +0530 Subject: [PATCH 3/3] Improved: code to remove unused prop in selectProductStoreModal(#70) --- src/components/SelectProductStoreModal.vue | 2 +- src/views/FacilityDetails.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectProductStoreModal.vue b/src/components/SelectProductStoreModal.vue index a166181c..a2db2a5f 100644 --- a/src/components/SelectProductStoreModal.vue +++ b/src/components/SelectProductStoreModal.vue @@ -73,7 +73,7 @@ export default defineComponent({ facilityProductStores: 'facility/getFacilityProductStores', }) }, - props: ["facilityId", "selectedProductStores"], + props: ["selectedProductStores"], data() { return { selectedProductStoreValues: JSON.parse(JSON.stringify(this.selectedProductStores)), diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 40b15d9c..6b1dc176 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -593,7 +593,7 @@ export default defineComponent({ async selectProductStores() { const selectProductStoreModal = await modalController.create({ component: SelectProductStoreModal, - componentProps: { facilityId: this.facilityId, selectedProductStores: this.facilityProductStores } + componentProps: { selectedProductStores: this.facilityProductStores } }) selectProductStoreModal.onDidDismiss().then(async(result: any) => {