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

Implemented: order details page on packed tab (#284) #330

Merged
merged 12 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 11 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
6 changes: 6 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
"Facility": "Facility",
"Failed to load packing slip": "Failed to load packing slip",
"Failed to update configuration": "Failed to update configuration",
"Failed to print shipping label and packing slip": "Failed to print shipping label and packing slip",
"First name": "First name",
"Generate packing slips": "Generate packing slips",
"Generate shipping documents": "Generate shipping documents",
"Go to OMS": "Go to OMS",
"Go to Launchpad": "Go to Launchpad",
"Handover": "Handover",
Expand Down Expand Up @@ -88,6 +90,8 @@
"Order details": "Order details",
"Order edit permissions": "Order edit permissions",
"Order is now ready to handover.": "Order is now ready to handover.",
"Order is successfully handed over to customer.": "Order is successfully handed over to customer.",
"Order is successfully shipped.": "Order is successfully shipped.",
"Order has been rejected.": "Order has been rejected.",
"Order marked as ready for pickup, an email notification has been sent to the customer": "Order marked as ready for pickup, an email notification has been sent to the customer",
"Order marked as ready for pickup but something went wrong while sending the email notification": "Order marked as ready for pickup but something went wrong while sending the email notification",
Expand Down Expand Up @@ -120,6 +124,7 @@
"Reject Order Item": "Reject Order Item",
"Reason": "Reason",
"Report an issue": "Report an issue",
"Resend customer email": "Resend customer email",
"Resend ready for pickup email": "Resend ready for pickup email",
"Search": "Search",
"Search Orders": "Search Orders",
Expand Down Expand Up @@ -163,6 +168,7 @@
"This order will be rejected from this store with the selected reason and shipped to the address that has been inputed.Please make sure the address you have entered is correct.": "This order will be rejected from this store with the selected reason and shipped to the address that has been inputed. { space } Please make sure the address you have entered is correct.",
"Track Pickers": "Track Pickers",
"Track who picked orders by entering picker IDs when packing an order.": "Track who picked orders by entering picker IDs when packing an order.",
"Unable to open as browser is blocking pop-ups.": "Unable to open { documentName } as browser is blocking pop-ups.",
"Unfillable Items": "Unfillable Items",
"Update time zone": "Update time zone",
"Username": "Username",
Expand Down
6 changes: 6 additions & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
"Facility": "Instalación",
"Failed to load packing slip": "Error al cargar el documento de embalaje",
"Failed to update configuration": "No se pudo actualizar la configuración",
"Failed to print shipping label and packing slip": "Failed to print shipping label and packing slip",
"First name": "Nombre",
"Generate packing slips": "Generar documentos de embalaje",
"Generate shipping documents": "Generate shipping documents",
"Go to OMS": "Ir a OMS",
"Go to Launchpad": "Go to Launchpad",
"Handover": "Entregar",
Expand Down Expand Up @@ -87,6 +89,8 @@
"Order details": "Detalles de la orden",
"Order edit permissions": "Permisos de edición de la orden",
"Order is now ready to handover.": "Order is now ready to handover.",
"Order is successfully handed over to customer.": "Order is successfully handed over to customer.",
"Order is successfully shipped.": "Order is successfully shipped.",
"Order has been rejected.": "Order has been rejected.",
"Order marked as ready for pickup, an email notification has been sent to the customer": "Pedido marcado como listo para recoger, se ha enviado una notificación por correo electrónico al cliente",
"Order marked as ready for pickup but something went wrong while sending the email notification": "Pedido marcado como listo para recoger pero algo salió mal al enviar la notificación por correo electrónico",
Expand Down Expand Up @@ -119,6 +123,7 @@
"Reject Order Item": "Reject Order Item",
"Reason": "Razón",
"Report an issue": "Report an issue",
"Resend customer email": "Resend customer email",
"Resend ready for pickup email": "Reenviar correo electrónico de listo para recoger",
"Search": "Buscar",
"Search Orders": "Buscar pedidos",
Expand Down Expand Up @@ -163,6 +168,7 @@
"This order will be rejected from this store with the selected reason and shipped to the address that has been inputted. Please make sure the address you have entered is correct.": "Este pedido será rechazado en esta tienda con la razón seleccionada y se enviará a la dirección que se ha ingresado.{ space } Por favor, asegúrate de que la dirección que has ingresado sea correcta.",
"Track Pickers": "Seguimiento de recolectores",
"Track who picked orders by entering picker IDs when packing an order.": "Realiza un seguimiento de quién recogió los pedidos ingresando los ID de los recolectores al empacar un pedido.",
"Unable to open as browser is blocking pop-ups.": "Unable to open { documentName } as browser is blocking pop-ups.",
"Unfillable Items": "Artículos no disponibles",
"Update time zone": "Actualizar zona horaria",
"Username": "Nombre de usuario",
Expand Down
6 changes: 6 additions & 0 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
"Facility": "拠点",
"Failed to load packing slip": "納品書の読み込みに失敗しました",
"Failed to update configuration": "設定の更新に失敗しました",
"Failed to print shipping label and packing slip": "Failed to print shipping label and packing slip",
"First name": "名",
"Generate packing slips": "内容明細票の作成",
"Generate shipping documents": "Generate shipping documents",
"Go to OMS": "OMSへ",
"Go to Launchpad": "Go to Launchpad",
"Handover": "引き継ぐ",
Expand Down Expand Up @@ -87,6 +89,8 @@
"Order details": "注文詳細",
"Order edit permissions": "注文の編集権限",
"Order is now ready to handover.": "Order is now ready to handover.",
"Order is successfully handed over to customer.": "Order is successfully handed over to customer.",
"Order is successfully shipped.": "Order is successfully shipped.",
"Order has been rejected.": "Order has been rejected.",
"Order marked as ready for pickup, an email notification has been sent to the customer": "注文された商品の受取準備完了とマークされ、Eメールによる通知がお客様に送信されました。",
"Order marked as ready for pickup but something went wrong while sending the email notification": "注文された商品の受取準備完了とマークされましたが、Eメールによる通知の送信中に何かしらの問題が発生しました。",
Expand Down Expand Up @@ -119,6 +123,7 @@
"Reject Order Item": "Reject Order Item",
"Reason": "理由",
"Report an issue": "Report an issue",
"Resend customer email": "Resend customer email",
"Resend ready for pickup email": "受取準備完了メールの再送",
"Search": "検索",
"Search Orders": "注文の検索",
Expand Down Expand Up @@ -162,6 +167,7 @@
"This order will be rejected from this store with the selected reason and shipped to the address that has been inputed.Please make sure the address you have entered is correct.": "この注文は、選択された理由によりこのストアから拒否され、入力された住所に発送されます。{ space } 入力したアドレスが正しいことを確認してください。",
"Track Pickers": "受取人の追跡",
"Track who picked orders by entering picker IDs when packing an order.": "注文を梱包する際に受取人IDを入力することで、誰が注文を受け取ったかを追跡できます。",
"Unable to open as browser is blocking pop-ups.": "Unable to open { documentName } as browser is blocking pop-ups.",
"Unfillable Items": "記入不可の項目",
"Update time zone": "タイムゾーンを更新する",
"Username": "ユーザーネーム",
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const routes: Array<RouteRecordRaw> = [
beforeEnter: loginGuard
},
{
path: "/orderdetail/:orderId/:orderPartSeqId",
path: "/orderdetail/:orderType/:orderId/:orderPartSeqId",
name: "OrderDetail",
component: OrderDetail,
beforeEnter: authGuard,
Expand Down
35 changes: 34 additions & 1 deletion src/services/OrderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,38 @@ const fetchOrderPaymentPreferences = async (params: any): Promise<any> => {
});
}

const printShippingLabelAndPackingSlip = async (shipmentIds: Array<string>): Promise<any> => {
try {
// Get packing slip from the server
const resp: any = await api({
method: 'get',
url: 'LabelAndPackingSlip.pdf',
params: {
shipmentIds
},
responseType: "blob"
})

if (!resp || resp.status !== 200 || hasError(resp)) {
throw resp.data;
}

// Generate local file URL for the blob received
const pdfUrl = window.URL.createObjectURL(resp.data);
// Open the file in new tab
try {
(window as any).open(pdfUrl, "_blank").focus();
}
catch {
showToast(translate('Unable to open as browser is blocking pop-ups.', {documentName: 'shipping label and packing slip'}));
}

} catch (err) {
showToast(translate('Failed to print shipping label and packing slip'))
console.error("Failed to load shipping label and packing slip", err)
}
}

export const OrderService = {
fetchOrderPaymentPreferences,
getOpenOrders,
Expand All @@ -194,5 +226,6 @@ export const OrderService = {
sendPickupScheduledNotification,
getShipToStoreOrders,
getShipmentItems,
getCustomerContactDetails
getCustomerContactDetails,
printShippingLabelAndPackingSlip
}
32 changes: 25 additions & 7 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,21 @@
return resp;
},

async getOrderDetail( { dispatch, state }, payload ) {
async getOrderDetail( { dispatch, state }, { payload, orderType } ) {
if(orderType === 'open') {
payload['orderStatusId']= "ORDER_APPROVED"
payload['-shipmentStatusId']= "*"
} else if(orderType === 'packed') {
payload['shipmentStatusId']= "SHIPMENT_PACKED"
} else {
dispatch('order/updateCurrent', { order: {} })
return;
}

const current = state.current as any
const orders = JSON.parse(JSON.stringify(state.open.list)) as any
// As one order can have multiple parts thus checking orderId and partSeq as well before making any api call
if(current.orderId === payload.orderId && current.part?.orderPartSeqId === payload.orderPartSeqId) {
if(current.orderId === payload.orderId && current.orderType === orderType && current.part?.orderPartSeqId === payload.orderPartSeqId) {
this.dispatch('product/getProductInformation', { orders: [ current ] })
return current
}
Expand All @@ -114,12 +124,12 @@
return order;
}
}


const orderQueryPayload = prepareOrderQuery({
...payload,
shipmentMethodTypeId: !store.state.user.preference.showShippingOrders ? 'STOREPICKUP' : '',
'-shipmentStatusId': '*',
'-fulfillmentStatus': '(Cancelled OR Rejected)',
orderStatusId: 'ORDER_APPROVED',
orderTypeId: 'SALES_ORDER'
})

Expand Down Expand Up @@ -166,7 +176,8 @@
return arr
}, []),
placedDate: orderItem.orderDate,
shippingInstructions: orderItem.shippingInstructions
shippingInstructions: orderItem.shippingInstructions,
orderType: orderType
}
})

Expand Down Expand Up @@ -338,7 +349,7 @@
return resp;
},

async deliverShipment ({ state, commit }, order) {
async deliverShipment ({ state, dispatch, commit }, order) {
emitter.emit("presentLoader");
const params = {
shipmentId: order.shipmentId,
Expand All @@ -362,7 +373,14 @@
state.packed.list.splice(orderIndex, 1);
commit(types.ORDER_PACKED_UPDATED, { orders: state.packed.list, total: state.packed.total -1 })
}
showToast(translate('Order delivered to', {customerName: order.customer.name}))

if(order.part.shipmentMethodEnum.shipmentMethodEnumId === 'STOREPICKUP'){
order = { ...order, handovered: true }
}else {
order = { ...order, shipped: true }
}

dispatch('updateCurrent', { order })
} else {
showToast(translate("Something went wrong"))
}
Expand All @@ -376,7 +394,7 @@
return resp;
},

async packDeliveryItems ({ commit }, shipmentId) {

Check warning on line 397 in src/store/modules/order/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (16.x)

'commit' is defined but never used
const params = {
shipmentId: shipmentId,
statusId: 'SHIPMENT_PACKED'
Expand Down Expand Up @@ -488,7 +506,7 @@
}).catch(err => err);
},

async rejectOrderItems ({ commit }, order) {

Check warning on line 509 in src/store/modules/order/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (16.x)

'commit' is defined but never used
const payload = {
'orderId': order.orderId
}
Expand Down
Loading
Loading