Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix select deselect on purchase order detail page #170

Merged
merged 5 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/PurchaseOrderDetail.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-for="(poItems, index) in purchaseOrders" :key="index">
<div v-for="(poItems, index) in itemsByPoId" :key="index">
<ion-item lines="none">
<h3>{{ index }}</h3>
</ion-item>
Expand Down Expand Up @@ -67,7 +67,7 @@ import {
} from "@ionic/vue";
import { sendOutline, ellipsisVerticalOutline } from 'ionicons/icons';
import { defineComponent } from "@vue/runtime-core";
import { mapGetters } from 'vuex';
import { mapGetters, useStore } from "vuex";
import ProductPopover from '@/components/ProductPopover.vue'
import { DateTime } from 'luxon'

Expand All @@ -86,6 +86,9 @@ export default defineComponent({
props: {
purchaseOrders: {
type: Object
},
itemsByPoId: {
type: Object
}
},
computed: {
Expand Down Expand Up @@ -127,6 +130,7 @@ export default defineComponent({
},
selectProduct(item: any, event: any) {
item.isSelected = event.detail.checked;
this.store.dispatch('order/updatePurchaseOrders', this.purchaseOrders);
},
getGroupPurchaseOrders (items: any) {
return Array.from(new Set(items.map((ele: any) => ele.parentProductId)));
Expand All @@ -149,11 +153,14 @@ export default defineComponent({
})
this.isParentProductUpdated = false;
}
this.store.dispatch('order/updatePurchaseOrders', this.purchaseOrders)
}
},
setup() {
const store = useStore();
return {
sendOutline,
store,
ellipsisVerticalOutline
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/PurchaseOrderReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
</div>
</div>
<div v-if="segmentSelected === 'all'">
<PurchaseOrderDetail :purchaseOrders="purchaseOrders.parsed" />
<PurchaseOrderDetail :purchaseOrders="purchaseOrders" :itemsByPoId ="purchaseOrders.parsed" />
</div>
<div v-for="(po, poId) in purchaseOrders.parsed" :key="poId" >
<PurchaseOrderDetail v-if="segmentSelected === poId" :purchaseOrders="{[poId]: po}" />
<PurchaseOrderDetail v-if="segmentSelected === poId" :itemsByPoId="{[poId]: po}" :purchaseOrders="purchaseOrders" />
</div>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
Expand Down