Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Support Print Preview (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsiosanchez authored Aug 24, 2022
1 parent f1f678f commit 70a5b0e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/api/ADempiere/form/point-of-sales.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,23 @@ export function printTicket({
})
}

export function printTicketPreviwer({
posUuid,
orderUuid
}) {
return request({
url: `${config.pointOfSales.endpoint}/print-preview`,
method: 'post',
data: {
pos_uuid: posUuid,
order_uuid: orderUuid
}
})
.then(printTicketPreviwer => {
return printTicketPreviwer
})
}

export function generateImmediateInvoice({
posId,
posUuid
Expand Down
1 change: 1 addition & 0 deletions src/lang/ADempiere/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ export default {
cancelSaleTransaction: 'Cancel Sale Transaction',
createPos: 'Create Point of Sale Withdrawal',
print: 'Print Document',
preview: 'View Preview',
cancelOrder: 'Cancel Order',
orderRemoved: 'Order Deleted',
copyOrder: 'Copy Order',
Expand Down
1 change: 1 addition & 0 deletions src/lang/ADempiere/es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ export default {
cancelSaleTransaction: 'Anular Transacción de Venta',
createPos: 'Crear Retiro de Punto de Venta',
print: 'Imprimir Documento',
preview: 'Ver Vista Previa',
cancelOrder: 'Cancelar Orden',
orderRemoved: 'Orden Borrada',
copyOrder: 'Copiar Orden',
Expand Down
28 changes: 26 additions & 2 deletions src/store/modules/ADempiere/pointOfSales/order/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
updateOrder,
createOrderLine,
listOrders,
printTicket
printTicket,
printTicketPreviwer
} from '@/api/ADempiere/form/point-of-sales.js'

// utils and helper methods
Expand Down Expand Up @@ -316,7 +317,7 @@ export default {
commit('findOrder', {})
},
printTicket({ commit, dispatch }, { posUuid, orderUuid }) {
printTicket({
return printTicket({
posUuid,
orderUuid
})
Expand All @@ -326,6 +327,29 @@ export default {
message: response.result,
showClose: true
})
return response
})
.catch(error => {
console.warn(error.message)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
},
printTicketPreviwer({ commit, dispatch }, { posUuid, orderUuid }) {
return printTicketPreviwer({
posUuid,
orderUuid
})
.then(response => {
showMessage({
type: 'success',
message: response.result,
showClose: true
})
return response
})
.catch(error => {
console.warn(error.message)
Expand Down

0 comments on commit 70a5b0e

Please sign in to comment.