Skip to content

Commit

Permalink
Merge pull request #40 from ymaheshwari1/#39
Browse files Browse the repository at this point in the history
Fixed: issue of unable to select a previously selected facility(#39)
  • Loading branch information
ymaheshwari1 authored Jul 2, 2024
2 parents 5a159f9 + a0c058d commit 6f56fb4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/views/OrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,17 @@ export default defineComponent({
// role will have the passed data
const facilityData = result.role as any
item.selectedFacility = facilityData.selectedFacility
item.properties.push({ name: '_pickupstore', value: facilityData.storeCode }, { name: 'Store Pickup', value: item.selectedFacility })
// Filtering item properties that are not related to pickup as we want to remove the previously associated properties and add the new one
// Using this approach, as if we will filter and update the pickup properties we will need multiple looping on the properties
const itemProperties = item.properties.filter((property: any) => property.name != "_pickupstore" && property.name != "Store Pickup")
// Adding the selected facility information as pickup facility
itemProperties.push({ name: '_pickupstore', value: facilityData.storeCode }, { name: 'Store Pickup', value: item.selectedFacility })
// Reassigning the item properties with updated properties array
item.properties = itemProperties
this.store.dispatch('order/updateLineItems', this.order);
}
});
Expand Down

0 comments on commit 6f56fb4

Please sign in to comment.