feat: add internal and customer notes to receipt data and consolidate multi-line note extraction logic
This commit is contained in:
parent
923671cc56
commit
fa2f72cf61
@ -1018,7 +1018,9 @@ patch(PosPrinterService.prototype, {
|
|||||||
date: getText('#order-date') || getText('.pos-receipt-date') || new Date().toLocaleString(),
|
date: getText('#order-date') || getText('.pos-receipt-date') || new Date().toLocaleString(),
|
||||||
cashier: formatFirstLastName(getText('.cashier') || getText('.pos-receipt-cashier') || ''),
|
cashier: formatFirstLastName(getText('.cashier') || getText('.pos-receipt-cashier') || ''),
|
||||||
customer: getText('.pos-receipt-customer') || getText('.customer') || null,
|
customer: getText('.pos-receipt-customer') || getText('.customer') || null,
|
||||||
tableName: tableName
|
tableName: tableName,
|
||||||
|
internalNote: getText('.order-internal-note')?.replace(/^Order Note:\s*/i, '') || '',
|
||||||
|
customerNote: getText('.order-customer-note')?.replace(/^Customer Note:\s*/i, '') || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse order lines
|
// Parse order lines
|
||||||
@ -1082,8 +1084,8 @@ patch(PosPrinterService.prototype, {
|
|||||||
const qty = parseNumber(qtyText);
|
const qty = parseNumber(qtyText);
|
||||||
|
|
||||||
// Extract customer note/kitchen note from this line element
|
// Extract customer note/kitchen note from this line element
|
||||||
const noteEl = line.querySelector('.customer-note, .note, li.note, li.customer-note');
|
const noteElements = line.querySelectorAll('.customer-note, .internal-note, .note, li.note, li.customer-note, li.internal-note');
|
||||||
let note = noteEl ? noteEl.textContent.trim() : '';
|
let note = Array.from(noteElements).map(el => el.textContent.trim()).filter(Boolean).join(' | ');
|
||||||
|
|
||||||
if (isComboSubLine && lastParentLine) {
|
if (isComboSubLine && lastParentLine) {
|
||||||
// This is a combo subline, add it to the last parent line!
|
// This is a combo subline, add it to the last parent line!
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user