-
Notifications
You must be signed in to change notification settings - Fork 39
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: Show Completed Shipments Along with Open Shipments (#380) #381
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9dafc55
Improved: Show Completed Shipments Along with Open Shipments (#380)
amansinghbais faf022b
Reverted: unwanted getter in the shipment details page (#380)
amansinghbais a193f0a
Improved: added support for showing completed purchase orders (#380)
amansinghbais ed1881a
Improved: added support for showing completed returns and updated det…
amansinghbais 88d8306
Merge branch 'main' of https://github.com/hotwax/receiving into #380
amansinghbais 00b2698
Reverted: caching of order detail from po list in state on order deta…
amansinghbais 7c35a4a
Reverted: unwanted console statement in return details page (#380)
amansinghbais 89b0110
Improved: toast message while searching item in case of completed shi…
amansinghbais File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
<ion-button @click="receivingHistory()"> | ||
<ion-icon slot="icon-only" :icon="timeOutline"/> | ||
</ion-button> | ||
<ion-button :disabled="!hasPermission(Actions.APP_SHIPMENT_ADMIN)" @click="addProduct"> | ||
<ion-button :disabled="!hasPermission(Actions.APP_SHIPMENT_ADMIN) || isPOReceived()" @click="addProduct"> | ||
<ion-icon slot="icon-only" :icon="addOutline"/> | ||
</ion-button> | ||
</ion-buttons> | ||
|
@@ -31,15 +31,15 @@ | |
|
||
<div class="scanner"> | ||
<ion-item> | ||
<ion-input :label="translate('Scan items')" label-placement="fixed" autofocus :placeholder="translate('Scan barcodes to receive them')" v-model="queryString" @keyup.enter="updateProductCount()" /> | ||
<ion-input :label="translate(isPOReceived() ? 'Search items' : 'Scan items')" label-placement="fixed" autofocus v-model="queryString" @keyup.enter="isPOReceived() ? searchProduct() : updateProductCount()" /> | ||
</ion-item> | ||
<ion-button expand="block" fill="outline" @click="scan"> | ||
<ion-button expand="block" fill="outline" @click="scan" :disabled="isPOReceived()"> | ||
<ion-icon slot="start" :icon="cameraOutline" /> | ||
{{ translate("Scan") }} | ||
</ion-button> | ||
</div> | ||
|
||
<ion-item lines="none"> | ||
<ion-item lines="none" v-if="!isPOReceived()"> | ||
<ion-label v-if="getPOItems('pending').length > 1" color="medium" class="ion-margin-end"> | ||
{{ translate("Pending: items", { itemsCount: getPOItems('pending').length }) }} | ||
</ion-label> | ||
|
@@ -48,57 +48,59 @@ | |
</ion-label> | ||
</ion-item> | ||
|
||
<ion-card v-for="(item, index) in getPOItems('pending')" v-show="item.orderItemStatusId !== 'ITEM_COMPLETED' && item.orderItemStatusId !== 'ITEM_REJECTED'" :key="index" :class="item.internalName === lastScannedId ? 'scanned-item' : '' " :id="item.internalName"> | ||
<div class="product"> | ||
<div class="product-info"> | ||
<ion-item lines="none"> | ||
<ion-thumbnail slot="start" @click="openImage(getProduct(item.productId).mainImageUrl, getProduct(item.productId).productName)"> | ||
<DxpShopifyImg size="small" :src="getProduct(item.productId).mainImageUrl" /> | ||
</ion-thumbnail> | ||
<ion-label class="ion-text-wrap"> | ||
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2> | ||
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p> | ||
</ion-label> | ||
</ion-item> | ||
</div> | ||
|
||
<div class="location"> | ||
<LocationPopover :item="item" type="order" :facilityId="currentFacility.facilityId" /> | ||
</div> | ||
|
||
<div class="product-count"> | ||
<ion-item> | ||
<ion-input :label="translate('Qty')" label-placement="floating" type="number" value="0" min="0" v-model="item.quantityAccepted" :disabled="isForceScanEnabled" /> | ||
</ion-item> | ||
</div> | ||
</div> | ||
|
||
<div class="action border-top" v-if="item.quantity > 0"> | ||
<div class="receive-all-qty"> | ||
<ion-button @click="receiveAll(item)" :disabled="isForceScanEnabled || isItemReceivedInFull(item)" slot="start" size="small" fill="outline"> | ||
{{ translate("Receive All") }} | ||
</ion-button> | ||
<template v-if="!isPOReceived()"> | ||
<ion-card v-for="(item, index) in getPOItems('pending')" v-show="item.orderItemStatusId !== 'ITEM_COMPLETED' && item.orderItemStatusId !== 'ITEM_REJECTED'" :key="index" :class="item.internalName === lastScannedId ? 'scanned-item' : '' " :id="item.internalName"> | ||
<div class="product"> | ||
<div class="product-info"> | ||
<ion-item lines="none"> | ||
<ion-thumbnail slot="start" @click="openImage(getProduct(item.productId).mainImageUrl, getProduct(item.productId).productName)"> | ||
<DxpShopifyImg size="small" :src="getProduct(item.productId).mainImageUrl" /> | ||
</ion-thumbnail> | ||
<ion-label class="ion-text-wrap"> | ||
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2> | ||
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p> | ||
</ion-label> | ||
</ion-item> | ||
</div> | ||
|
||
<div class="location"> | ||
<LocationPopover :item="item" type="order" :facilityId="currentFacility.facilityId" /> | ||
</div> | ||
|
||
<div class="product-count"> | ||
<ion-item> | ||
<ion-input :label="translate('Qty')" label-placement="floating" type="number" value="0" min="0" v-model="item.quantityAccepted" :disabled="isForceScanEnabled" /> | ||
</ion-item> | ||
</div> | ||
</div> | ||
|
||
<div class="qty-progress"> | ||
<!-- TODO: improve the handling of quantityAccepted --> | ||
<ion-progress-bar :color="getRcvdToOrderedFraction(item) === 1 ? 'success' : getRcvdToOrderedFraction(item) > 1 ? 'danger' : 'primary'" :value="getRcvdToOrderedFraction(item)" /> | ||
<div class="action border-top" v-if="item.quantity > 0"> | ||
<div class="receive-all-qty"> | ||
<ion-button @click="receiveAll(item)" :disabled="isForceScanEnabled || isItemReceivedInFull(item)" slot="start" size="small" fill="outline"> | ||
{{ translate("Receive All") }} | ||
</ion-button> | ||
</div> | ||
|
||
<div class="qty-progress"> | ||
<!-- TODO: improve the handling of quantityAccepted --> | ||
<ion-progress-bar :color="getRcvdToOrderedFraction(item) === 1 ? 'success' : getRcvdToOrderedFraction(item) > 1 ? 'danger' : 'primary'" :value="getRcvdToOrderedFraction(item)" /> | ||
</div> | ||
|
||
<div class="po-item-history"> | ||
<ion-chip outline @click="receivingHistory(item.productId)"> | ||
<ion-icon :icon="checkmarkDone"/> | ||
<ion-label> {{ getPOItemAccepted(item.productId) }} {{ translate("received") }} </ion-label> | ||
</ion-chip> | ||
</div> | ||
|
||
<div class="qty-ordered"> | ||
<ion-label>{{ item.quantity }} {{ translate("ordered") }}</ion-label> | ||
</div> | ||
</div> | ||
</ion-card> | ||
</template> | ||
|
||
<div class="po-item-history"> | ||
<ion-chip outline @click="receivingHistory(item.productId)"> | ||
<ion-icon :icon="checkmarkDone"/> | ||
<ion-label> {{ getPOItemAccepted(item.productId) }} {{ translate("received") }} </ion-label> | ||
</ion-chip> | ||
</div> | ||
|
||
<div class="qty-ordered"> | ||
<ion-label>{{ item.quantity }} {{ translate("ordered") }}</ion-label> | ||
</div> | ||
</div> | ||
</ion-card> | ||
|
||
<ion-item lines="none"> | ||
<ion-item lines="none" v-if="!isPOReceived()"> | ||
<ion-text v-if="getPOItems('completed').length > 1" color="medium" class="ion-margin-end"> | ||
{{ translate("Completed: items", { itemsCount: getPOItems('completed').length }) }} | ||
</ion-text> | ||
|
@@ -142,7 +144,7 @@ | |
</main> | ||
</ion-content> | ||
|
||
<ion-footer> | ||
<ion-footer v-if="!isPOReceived()"> | ||
<ion-toolbar> | ||
<ion-buttons slot="end"> | ||
<ion-button fill="outline" size="small" color="primary" :disabled="!hasPermission(Actions.APP_SHIPMENT_UPDATE)" class="ion-margin-end" @click="closePO">{{ translate("Receive And Close") }}</ion-button> | ||
|
@@ -265,7 +267,7 @@ export default defineComponent({ | |
if(this.queryString) payload = this.queryString | ||
|
||
if(!payload) { | ||
showToast(translate("Please provide a valid valid barcode identifier.")) | ||
showToast(translate("Please provide a valid barcode identifier.")) | ||
return; | ||
} | ||
const result = await this.store.dispatch('order/updateProductCount', payload) | ||
|
@@ -305,6 +307,24 @@ export default defineComponent({ | |
} | ||
this.queryString = '' | ||
}, | ||
searchProduct() { | ||
if(!this.queryString) { | ||
showToast(translate("Please provide a valid barcode identifier.")) | ||
return; | ||
} | ||
const scannedElement = document.getElementById(this.queryString); | ||
if(scannedElement) { | ||
this.lastScannedId = this.queryString | ||
scannedElement.scrollIntoView() | ||
// Scanned product should get un-highlighted after 3s for better experience hence adding setTimeOut | ||
setTimeout(() => { | ||
this.lastScannedId = '' | ||
}, 3000) | ||
} else { | ||
showToast(translate("Scanned item is not present within the shipment:", { itemName: this.queryString })); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Searched item...." instead of "Scanned item...." |
||
} | ||
this.queryString = '' | ||
}, | ||
getPOItems(orderType: string) { | ||
if(orderType === 'completed'){ | ||
return this.order.items.filter((item: any) => item.orderItemStatusId === 'ITEM_COMPLETED') | ||
|
@@ -378,11 +398,17 @@ export default defineComponent({ | |
return true; | ||
} | ||
}) | ||
}, | ||
isPOReceived() { | ||
return this.order.orderStatusId === "ORDER_COMPLETED" | ||
} | ||
}, | ||
ionViewWillEnter() { | ||
this.store.dispatch("order/getOrderDetail", { orderId: this.$route.params.slug }).then(() => { | ||
this.store.dispatch('order/getPOHistory', { orderId: this.order.orderId }) | ||
this.store.dispatch("order/getOrderDetail", { orderId: this.$route.params.slug }).then(async () => { | ||
await this.store.dispatch('order/getPOHistory', { orderId: this.order.orderId }) | ||
if(this.isPOReceived()) { | ||
this.showCompletedItems = true; | ||
} | ||
}) | ||
}, | ||
setup() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is removed to fetch the data every time when we go to detail page, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so as to avoid old item status issue due to slow Solr updation.