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

Updated UI for order details page and implemented feature to select store pickup location (#85zru5e18) #25

Merged
merged 7 commits into from
Mar 30, 2023

Conversation

alsoK2maan
Copy link

@alsoK2maan alsoK2maan commented Mar 29, 2023

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

order.line_items.map((item: any) => {
item.isBopis = item.properties.some((property: any) => property.name === "_pickupstore");
if (item.isBopis) {
item.deliveryMethodTypeId = 'STOREPICKUP'
Copy link
Contributor

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

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] }
Copy link
Contributor

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

item.deliveryMethodTypeId = 'STANDARD'
}
})
dispatch('stock/checkInventoryByFacility', productSkus, { root: true });
Copy link
Contributor

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

} 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'))
Copy link
Contributor

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/OrderDetail.vue Show resolved Hide resolved
async getStores(location: string) {
const payload = {
"viewSize": 50,
"filters": ["storeType: WAREHOUSE"],
Copy link
Contributor

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


try {
const storeLookupResp = await FacilityService.getStores(payload)
if (storeLookupResp.status !== 200 || hasError(storeLookupResp) || !storeLookupResp.data.response.numFound) {
Copy link
Contributor

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

Suggested change
if (storeLookupResp.status !== 200 || hasError(storeLookupResp) || !storeLookupResp.data.response.numFound) {
if (hasError(storeLookupResp)) {

Copy link
Author

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

}
})

if (locationResp.status !== 200 || hasError(locationResp) || !locationResp.data.response.numFound) {
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
if (locationResp.status !== 200 || hasError(locationResp) || !locationResp.data.response.numFound) {
if ( hasError(locationResp) || !locationResp.data.response.numFound) {

Copy link
Author

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

"fieldsToSelect": ["atp", "facilityName", "facilityId"],
});

if (hasError(productInventoryResp) || !productInventoryResp.data.count) {
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
if (hasError(productInventoryResp) || !productInventoryResp.data.count) {
if (hasError(productInventoryResp)) {

if (!storesWithInventory?.length) return;

stores.map((storeData: any) => {
const inventoryDetails = storesWithInventory.filter((store: any) => store.facilityId === storeData.storeCode);
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
const inventoryDetails = storesWithInventory.filter((store: any) => store.facilityId === storeData.storeCode);
const inventoryDetails = storesWithInventory.find((store: any) => store.facilityId === storeData.storeCode);

@alsoK2maan alsoK2maan changed the title Implemented: functionality to undo order edits (#85zru5e18) Updated UI for order details page and implemented feature to select store pickup location (#85zru5e18) Mar 30, 2023
@adityasharma7 adityasharma7 merged commit 0acae84 into hotwax:main Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement new UI for the order details page Add feature to select pickup location for store pickup orders
3 participants