feat: extend getOrderData to include order name, table details, and cashier information for kitchen printer receipts
This commit is contained in:
parent
0f725b94fa
commit
6d11f0e83a
@ -25,6 +25,14 @@ patch(PosStore.prototype, {
|
|||||||
return super.createPrinter(...arguments);
|
return super.createPrinter(...arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getOrderData(order, reprint) {
|
||||||
|
const data = super.getOrderData(...arguments);
|
||||||
|
data.name = order.getName();
|
||||||
|
data.table_name = order.table_id ? (order.table_id.table_number ? "T " + order.table_id.table_number.toString() : order.table_id.name) : "";
|
||||||
|
data.cashier = order.employee_id?.name || order.user_id?.name || "";
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
async printOrderChanges(data, printer) {
|
async printOrderChanges(data, printer) {
|
||||||
if (printer.config && printer.config.printer_type === "network_escpos") {
|
if (printer.config && printer.config.printer_type === "network_escpos") {
|
||||||
const changesData = data.changes?.data || [];
|
const changesData = data.changes?.data || [];
|
||||||
@ -38,7 +46,7 @@ patch(PosStore.prototype, {
|
|||||||
|
|
||||||
const receipt_data = {
|
const receipt_data = {
|
||||||
order_name: data.name || '',
|
order_name: data.name || '',
|
||||||
order_time: data.time?.raw || new Date().toISOString(),
|
order_time: (typeof data.time === 'string' ? data.time : data.time?.raw) || new Date().toISOString(),
|
||||||
waiter: data.cashier || '',
|
waiter: data.cashier || '',
|
||||||
table: data.table_name || '',
|
table: data.table_name || '',
|
||||||
lines: lines
|
lines: lines
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user