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

Improved: open order structure for handling #316

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,22 @@ const actions: ActionTree<OrderState, RootState> = {
total = resp.data.grouped.orderId.ngroups
orders = resp.data.grouped.orderId.groups
this.dispatch('product/getProductInformation', { orders })

orders = orders.map((order: any) => {
const orderItem = order.doclist.docs[0];
return {
customerId: orderItem.customerId,
customerName: orderItem.customerName,
orderId: orderItem.orderId,
orderDate: orderItem.orderDate,
orderName: orderItem.orderName,
groupValue: order.groupValue,
items: order.doclist.docs,
shipmentMethodTypeId: orderItem.shipmentMethodTypeId,
shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc,
reservedDatetime: orderItem.reservedDatetime
}
})
} else {
throw resp.data
}
Expand Down Expand Up @@ -486,9 +502,11 @@ const actions: ActionTree<OrderState, RootState> = {
await dispatch('fetchInProgressOrdersAdditionalInformation', { viewIndex: payload.viewIndex});
commit(types.ORDER_INPROGRESS_QUERY_UPDATED, payload)
},

async updateCompletedOrderIndex({ commit }, payload) {
commit(types.ORDER_COMPLETED_QUERY_UPDATED, payload)
},

async updateOpenOrderIndex({ commit }, payload) {
commit(types.ORDER_OPEN_QUERY_UPDATED, payload)
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/AssignPickerModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ export default defineComponent({
const orderItems = []

if(this.order) {
this.order.doclist.docs.map((item) => orderItems.push(item))
this.order.items.map((item) => orderItems.push(item))
} else {
this.openOrders.list.map((order) => {
order.doclist.docs.map((item) => orderItems.push(item))
order.items.map((item) => orderItems.push(item))
});
}

Expand Down
28 changes: 14 additions & 14 deletions src/views/OpenOrders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,49 +35,49 @@
<div class="results">
<ion-button class="bulk-action desktop-only" size="large" @click="assignPickers">{{ translate("Print Picksheet") }}</ion-button>

<ion-card class="order" v-for="(orders, index) in getOpenOrders()" :key="index">
<ion-card button class="order" v-for="(order, index) in getOpenOrders()" :key="index">
<div class="order-header">
<div class="order-primary-info">
<ion-label>
<strong>{{ orders.doclist.docs[0].customerName }}</strong>
<p>{{ translate("Ordered") }} {{ formatUtcDate(orders.doclist.docs[0].orderDate, 'dd MMMM yyyy t a ZZZZ') }}</p>
<strong>{{ order.customerName }}</strong>
<p>{{ translate("Ordered") }} {{ formatUtcDate(order.orderDate, 'dd MMMM yyyy t a ZZZZ') }}</p>
</ion-label>
</div>

<div class="order-tags">
<ion-chip @click="orderActionsPopover(orders, $event)" outline>
<ion-chip @click.stop="orderActionsPopover(order, $event)" outline>
<ion-icon :icon="pricetagOutline" />
<ion-label>{{ orders.doclist.docs[0].orderName }}</ion-label>
<ion-label>{{ order.orderName }}</ion-label>
</ion-chip>
</div>

<div class="order-metadata">
<ion-label>
{{ orders.doclist.docs[0].shipmentMethodTypeDesc }}
<p v-if="orders.doclist.docs[0].reservedDatetime">{{ translate("Last brokered") }} {{ formatUtcDate(orders.doclist.docs[0].reservedDatetime, 'dd MMMM yyyy t a ZZZZ') }}</p>
{{ order.shipmentMethodTypeDesc }}
<p v-if="order.reservedDatetime">{{ translate("Last brokered") }} {{ formatUtcDate(order.reservedDatetime, 'dd MMMM yyyy t a ZZZZ') }}</p>
</ion-label>
</div>
</div>

<div v-for="order in orders.doclist.docs" :key="order">
<div v-for="item in order.items" :key="item">
<div class="order-item">
<div class="product-info">
<ion-item lines="none">
<ion-thumbnail slot="start">
<ShopifyImg :src="getProduct(order.productId).mainImageUrl" size="small"/>
<ShopifyImg :src="getProduct(item.productId).mainImageUrl" size="small"/>
</ion-thumbnail>
<ion-label>
<p class="overline">{{ order.productSku }}</p>
{{ order.virtualProductName }}
<p>{{ getFeature(getProduct(order.productId).featureHierarchy, '1/COLOR/')}} {{ getFeature(getProduct(order.productId).featureHierarchy, '1/SIZE/')}}</p>
<p class="overline">{{ item.productSku }}</p>
{{ item.virtualProductName }}
<p>{{ getFeature(getProduct(item.productId).featureHierarchy, '1/COLOR/')}} {{ getFeature(getProduct(item.productId).featureHierarchy, '1/SIZE/')}}</p>
</ion-label>
</ion-item>
</div>

<!-- TODO: add a spinner if the api takes too long to fetch the stock -->
<div class="product-metadata">
<ion-note v-if="getProductStock(order.productId).quantityOnHandTotal">{{ getProductStock(order.productId).quantityOnHandTotal }} {{ translate('pieces in stock') }}</ion-note>
<ion-button fill="clear" v-else size="small" @click="fetchProductStock(order.productId)">
<ion-note v-if="getProductStock(item.productId).quantityOnHandTotal">{{ getProductStock(item.productId).quantityOnHandTotal }} {{ translate('pieces in stock') }}</ion-note>
<ion-button fill="clear" v-else size="small" @click.stop="fetchProductStock(item.productId)">
<ion-icon color="medium" slot="icon-only" :icon="cubeOutline"/>
</ion-button>
</div>
Expand Down
Loading