-
Notifications
You must be signed in to change notification settings - Fork 37
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
Implemented: common admin permission on ship now button if any shipment package require tracking (#281) #289
Conversation
…nt package require tracking (hotwax#281)
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.
suggested some variable name changes
src/views/Completed.vue
Outdated
// if there are orders with tracking required and label image present | ||
const trackingRequiredOrders = orderList.filter((order: any) => this.isTrackingRequiredForAnyShipmentPackage(order)) | ||
if (trackingRequiredOrders.length) { | ||
const orderHasMissingLabelImage = orderList.some((order: any) => order.missingLabelImage) |
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.
I think the terminology here should be around "trackingCode" so that even if label image is missing but user puts tracking code on shipment the variable still makes semantic sense.
src/authorization/Rules.ts
Outdated
@@ -10,4 +10,5 @@ export default { | |||
"APP_UNPACK_ORDER": "COMMON_ADMIN", | |||
"APP_RECYCLE_ORDER": "COMMON_ADMIN", | |||
"APP_STOREFULFILLMENT_ADMIN": "STOREFULFILLMENT_ADMIN", | |||
"APP_SHIP_ORDER": "COMMON_ADMIN" |
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.
permission name should also include that this is "forceful" like "APP_FORCE_SHIP_ORDER" because for normal orders anyone is allowed to ship them
src/views/Completed.vue
Outdated
@@ -332,6 +331,15 @@ export default defineComponent({ | |||
handler: async () => { | |||
let orderList = JSON.parse(JSON.stringify(this.completedOrders.list)) | |||
|
|||
// if there are orders with tracking required and label image present |
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.
Here we only need to exclude those orders for which tracking is required but the shipping label is missing. Please correct the logic.
if (resp.status == 200 && !hasError(resp)) { | ||
!trackingRequiredAndMissingLabelOrders.length | ||
? showToast(translate('Orders shipped successfully')) | ||
: showToast(translate('out of cannot be shipped due to missing tracking codes.', { remainingOrders: trackingRequiredAndMissingLabelOrders.length, totalOrders: packedOrdersCount })) |
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.
: showToast(translate('out of cannot be shipped due to missing tracking codes.', { remainingOrders: trackingRequiredAndMissingLabelOrders.length, totalOrders: packedOrdersCount })) | |
: showToast(translate('out of orders cannot be shipped due to missing tracking codes.', { remainingOrders: trackingRequiredAndMissingLabelOrders.length, totalOrders: packedOrdersCount })) |
@@ -609,6 +624,13 @@ export default defineComponent({ | |||
}, | |||
fetchProductStock(productId: string) { | |||
this.store.dispatch('stock/fetchStock', { productId }) | |||
}, | |||
isTrackingRequiredForAnyShipmentPackage(order: any) { | |||
if (!order.shipmentPackages) { |
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.
Check the length of shipment packages.
Related Issues
Closes #281
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
IMPORTANT NOTICE - Remember to add changelog entry
Contribution and Currently Important Rules Acceptance