-
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 code to make the open orders flow functional(#1wut90a) #27
Conversation
…played on the open orders page(#1wut90a)
…ly the specific products(#1wut90a)
…nt and defined state to store the shipment methods(#1wut90a)
…code to show and save the response(#1wut90a)
…anted object assignment when calling the API(#1wut90a)
…us as components(#1wut90a)
…t and improved variable names(#1wut90a)
…d shipment methods information in state(#1wut90a)
…dded orderState in RootState(#1wut90a)
… logic, also removed PicklistSize component and used a common component ViewSizeSelector(#1wut90a)
…String when shipment method and picklist Size is changed(#1wut90a)
…ed unwanted imports(#1wut90a)
src/components/ViewSizeSelector.vue
Outdated
computed: { | ||
...mapGetters({ | ||
openOrders: 'order/getOpenOrders', | ||
viewSize: 'util/getViewSize' |
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 we should not store the current view size in util, it should be part of open order query
@@ -0,0 +1,8 @@ | |||
export default interface OrderState { | |||
open: { |
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.
We should query and list together as we will keep inprogress/completed list too
src/store/modules/order/actions.ts
Outdated
const actions: ActionTree<OrderState, RootState> = { | ||
|
||
// get open orders | ||
async fetchOpenOrders ({ commit, state }, payload = {}) { |
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.
async fetchOpenOrders ({ commit, state }, payload = {}) { | |
async findOpenOrders ({ commit, state }, payload = {}) { |
src/store/modules/order/actions.ts
Outdated
resp = await OrderService.fetchOpenOrders(orderQueryPayload); | ||
if (resp.status === 200 && resp.data.grouped.orderId.matches > 0 && !hasError(resp)) { | ||
const total = resp.data.grouped.orderId.ngroups | ||
commit(types.ORDER_OPEN_UPDATED, {list: resp.data.grouped.orderId.groups, total}) |
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.
initially prepare orders object, assign it values and commit at end
src/views/AssignPickerModal.vue
Outdated
|
||
emitter.emit("dismissLoader") | ||
}, | ||
async fetchPickers() { |
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.
async fetchPickers() { | |
async findPickers() { |
src/views/AssignPickerModal.vue
Outdated
closeModal() { | ||
modalController.dismiss({ dismissed: true }); | ||
}, | ||
pickerChanged(id) { |
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.
pickerChanged(id) { | |
changePicker(id) { |
src/views/AssignPickerModal.vue
Outdated
this.fetchPickers() | ||
}, | ||
async printPicklist () { | ||
if (!this.selectedPickers.length) { |
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.
We should handle by disabling the button
src/views/AssignPickerModal.vue
Outdated
orders.map((order) => { | ||
order.doclist.docs.map((item) => items.push(item)) | ||
}); | ||
|
||
items.map((item, index) => { | ||
formData.append("facilityId_o_"+index, this.currentFacility.facilityId) | ||
formData.append("shipmentMethodTypeId_o_"+index, item.shipmentMethodTypeId) | ||
formData.append("itemStatusId_o_"+index, "PICKITEM_PENDING") | ||
formData.append("shipGroupSeqId_o_"+index, item.shipGroupSeqId) | ||
formData.append("orderId_o_"+index, item.orderId) | ||
formData.append("orderItemSeqId_o_"+index, item.orderItemSeqId) | ||
formData.append("productId_o_"+index, item.productId) | ||
formData.append("quantity_o_"+index, item.itemQuantity) | ||
formData.append("inventoryItemId_o_"+index, item.inventoryItemId) | ||
formData.append("picked_o_"+index, item.itemQuantity) | ||
formData.append("_rowSubmit_o_"+index, "Y") | ||
}) |
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.
We could skip an iteration
orders.map((order) => { | |
order.doclist.docs.map((item) => items.push(item)) | |
}); | |
items.map((item, index) => { | |
formData.append("facilityId_o_"+index, this.currentFacility.facilityId) | |
formData.append("shipmentMethodTypeId_o_"+index, item.shipmentMethodTypeId) | |
formData.append("itemStatusId_o_"+index, "PICKITEM_PENDING") | |
formData.append("shipGroupSeqId_o_"+index, item.shipGroupSeqId) | |
formData.append("orderId_o_"+index, item.orderId) | |
formData.append("orderItemSeqId_o_"+index, item.orderItemSeqId) | |
formData.append("productId_o_"+index, item.productId) | |
formData.append("quantity_o_"+index, item.itemQuantity) | |
formData.append("inventoryItemId_o_"+index, item.inventoryItemId) | |
formData.append("picked_o_"+index, item.itemQuantity) | |
formData.append("_rowSubmit_o_"+index, "Y") | |
}) | |
int index = 0; | |
orders.map((order) => { | |
order.doclist.docs.map((item) => { | |
formData.append("facilityId_o_"+index, this.currentFacility.facilityId) | |
formData.append("shipmentMethodTypeId_o_"+index, item.shipmentMethodTypeId) | |
formData.append("itemStatusId_o_"+index, "PICKITEM_PENDING") | |
formData.append("shipGroupSeqId_o_"+index, item.shipGroupSeqId) | |
formData.append("orderId_o_"+index, item.orderId) | |
formData.append("orderItemSeqId_o_"+index, item.orderItemSeqId) | |
formData.append("productId_o_"+index, item.productId) | |
formData.append("quantity_o_"+index, item.itemQuantity) | |
formData.append("inventoryItemId_o_"+index, item.inventoryItemId) | |
formData.append("picked_o_"+index, item.itemQuantity) | |
formData.append("_rowSubmit_o_"+index, "Y") | |
index++; | |
} | |
}); |
src/views/AssignPickerModal.vue
Outdated
|
||
try { | ||
const resp = await UtilService.getAvailablePickers(payload); | ||
if (resp.status === 200 && !hasError(resp) && resp.data.count > 0) { |
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.
We should not show "Something went wrong" error when there are no pickers found. It should be empty state.
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.
Sir, we are not displaying it on the UI, we are just adding the error in console for debugging, also we already have empty state for the same.
I'll update the message to be more informative.
src/components/ViewSizeSelector.vue
Outdated
// This scenario occurs when we have selected a shipping method having for example 3 orders, so we set the size to 3 | ||
// Now when we de-select the shipping method or select another shipping method than the orders totals will increase, | ||
// and thus 3 as an option will not be available, thus checking for below condition | ||
viewSizeOptions.includes(this.viewSize) || (viewSizeOptions.includes(+process.env.VUE_APP_VIEW_SIZE) ? this.setViewSize(+process.env.VUE_APP_VIEW_SIZE) : this.setViewSize(viewSizeOptions[0])) |
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 we should set it with query while fetching the order, if not already. This way one of the check would be reduced
…der query(#1wut90a)
…d clear the selected shipment methods(#1wut90a)
…ad of updating the size after preparing the options(#1wut90a)
…d moved it to open order state(#1wut90a)
…onViewWillEnter hook(#1wut90a)
src/components/ViewSizeSelector.vue
Outdated
return; | ||
} | ||
|
||
await this.store.dispatch('order/updateViewSize', { size, page: this.currentPage }) |
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 we should not bind it with page, viewSize should be passed to respective page in progress, open etc and page should decide what to do with it
src/store/modules/order/actions.ts
Outdated
showToast(translate('Something went wrong')) | ||
} | ||
|
||
dispatch('updateViewSize', { size: orders.length, page: 'open' }) |
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.
Why a separate action here, we could directly commit
src/views/AssignPickerModal.vue
Outdated
closeModal() { | ||
modalController.dismiss({ dismissed: true }); | ||
}, | ||
changePicker(id) { |
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.
changePicker(id) { | |
selectPicker(id) { |
src/views/AssignPickerModal.vue
Outdated
this.selectedPickers.push(this.pickers.find((picker) => picker.id == id)) | ||
} | ||
}, | ||
async searchPicker () { |
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.
Why 2 methods?
…he size selector(#1wut90a)
closes #81 #83