Skip to content

Commit

Permalink
Merge pull request #282 from amansinghbais/receiving/#278
Browse files Browse the repository at this point in the history
Improved: code to auto select items which are received in their entirety in receive and close modal (#278)
  • Loading branch information
ravilodhi authored Dec 14, 2023
2 parents 069c56f + 69ba863 commit f94800f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/ClosePurchaseOrderModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
<ion-buttons>
<ion-badge v-if="item.orderItemStatusId === 'ITEM_COMPLETED'" slot="end">{{ $t("Completed") }}</ion-badge>
<ion-badge v-else-if="item.orderItemStatusId === 'ITEM_REJECTED'" color="danger" slot="end">{{ $t("Rejected") }}</ion-badge>
<ion-checkbox v-else slot="end" :modelValue="item.isChecked" />
<ion-checkbox slot="end" :modelValue="isPOItemStatusPending(item) ? item.isChecked : true" :disabled="isPOItemStatusPending(item) ? false : true" />
</ion-buttons>
</ion-item>
</ion-list>
Expand All @@ -44,7 +42,6 @@

<script lang="ts">
import {
IonBadge,
IonButton,
IonButtons,
IonCheckbox,
Expand Down Expand Up @@ -75,7 +72,6 @@ import { useRouter } from 'vue-router';
export default defineComponent({
name: "ClosePurchaseOrderModal",
components: {
IonBadge,
IonButton,
IonButtons,
IonCheckbox,
Expand All @@ -96,6 +92,7 @@ export default defineComponent({
computed: {
...mapGetters({
getProduct: 'product/getProduct',
getPOItemAccepted: 'order/getPOItemAccepted',
order: 'order/getCurrent',
productIdentificationPref: 'user/getProductIdentificationPref'
})
Expand Down Expand Up @@ -163,8 +160,18 @@ export default defineComponent({
},
getPOItems() {
return this.order.items.filter((item: any) => item.orderId)
},
checkAlreadyFulfilledItems() {
this.order.items.map((item: any) => {
if(this.isPOItemStatusPending(item) && this.getPOItemAccepted(item.productId) > 0) {
item.isChecked = true;
}
})
}
},
mounted() {
this.checkAlreadyFulfilledItems()
},
setup() {
const router = useRouter()
const store = useStore()
Expand Down

0 comments on commit f94800f

Please sign in to comment.