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

Improved: code to auto select items which are received in their entirety in receive and close modal (#278) #282

Merged
merged 4 commits into from
Dec 14, 2023
Merged
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
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" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ion-checkbox slot="end" :modelValue="isPOItemStatusPending(item) ? item.isChecked : true" :disabled="isPOItemStatusPending(item) ? false : true" />
<ion-checkbox slot="end" :modelValue="isPOItemStatusPending(item) ? item.isChecked : true" :disabled="!isPOItemStatusPending(item)" />

</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
Loading