-
Notifications
You must be signed in to change notification settings - Fork 6
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
Updated UI for order details page and implemented feature to select store pickup location (#85zru5e18) #25
Conversation
order.line_items.map((item: any) => { | ||
item.isBopis = item.properties.some((property: any) => property.name === "_pickupstore"); | ||
if (item.isBopis) { | ||
item.deliveryMethodTypeId = 'STOREPICKUP' |
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 either decide upon the property or remove the deliveryMethodTypeId method upon saving the order. Adding a property could give uncertain behaviour
src/store/modules/order/actions.ts
Outdated
if (item.isBopis) { | ||
item.deliveryMethodTypeId = 'STOREPICKUP' | ||
const facilityAddress = item.properties.find((property: any) => property.name == 'Store Pickup').value.split(', ') | ||
item.selectedFacility = { facilityName: facilityAddress[0], address1: facilityAddress[1], city: facilityAddress[2] } |
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.
Maybe we could store the property value as is
src/store/modules/order/actions.ts
Outdated
item.deliveryMethodTypeId = 'STANDARD' | ||
} | ||
}) | ||
dispatch('stock/checkInventoryByFacility', productSkus, { root: true }); |
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 this might not be needed
src/views/OrderDetail.vue
Outdated
} else { | ||
updateDeliveryMethod(event: any, item: any) { | ||
item.deliveryMethodTypeId = event.detail.value; | ||
item.properties = item.properties.filter((property: any) => !(property.name === '_pickupstore' || property.name === 'Store Pickup' || property.name === 'Pickup Store')) |
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 handle the case when the bopis item is changed to delivery
src/views/PickupLocationModal.vue
Outdated
async getStores(location: string) { | ||
const payload = { | ||
"viewSize": 50, | ||
"filters": ["storeType: WAREHOUSE"], |
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 make it configurable from .env
src/views/PickupLocationModal.vue
Outdated
|
||
try { | ||
const storeLookupResp = await FacilityService.getStores(payload) | ||
if (storeLookupResp.status !== 200 || hasError(storeLookupResp) || !storeLookupResp.data.response.numFound) { |
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 docs will already have empty array if no record found
if (storeLookupResp.status !== 200 || hasError(storeLookupResp) || !storeLookupResp.data.response.numFound) { | |
if (hasError(storeLookupResp)) { |
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.
storeLookup
does not return any errors in case of failure. We can check for !storeLookupResp.data.response.numFound
src/views/PickupLocationModal.vue
Outdated
} | ||
}) | ||
|
||
if (locationResp.status !== 200 || hasError(locationResp) || !locationResp.data.response.numFound) { |
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.
if (locationResp.status !== 200 || hasError(locationResp) || !locationResp.data.response.numFound) { | |
if ( hasError(locationResp) || !locationResp.data.response.numFound) { |
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.
In case of error, postcodeLookup
returns an error field and omits the response field. So, I've added a check for !locationResp.response
src/views/PickupLocationModal.vue
Outdated
"fieldsToSelect": ["atp", "facilityName", "facilityId"], | ||
}); | ||
|
||
if (hasError(productInventoryResp) || !productInventoryResp.data.count) { |
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.
if (hasError(productInventoryResp) || !productInventoryResp.data.count) { | |
if (hasError(productInventoryResp)) { |
src/views/PickupLocationModal.vue
Outdated
if (!storesWithInventory?.length) return; | ||
|
||
stores.map((storeData: any) => { | ||
const inventoryDetails = storesWithInventory.filter((store: any) => store.facilityId === storeData.storeCode); |
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.
const inventoryDetails = storesWithInventory.filter((store: any) => store.facilityId === storeData.storeCode); | |
const inventoryDetails = storesWithInventory.find((store: any) => store.facilityId === storeData.storeCode); |
…ional checks for disabling the save button (#85zru5e18)
…Made to isChanged (#85zru5e18)
Related Issues
Closes #22
Closes #20
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance