Poprawka botto bar i wersje językowe
This commit is contained in:
@@ -15,16 +15,16 @@ import { showToast } from "./toast.js";
|
||||
import {
|
||||
getBillState,
|
||||
getHashParam,
|
||||
getTableParam,
|
||||
setBillState,
|
||||
} from "./state.js";
|
||||
|
||||
function sendApiSimulated(actionName, details) {
|
||||
console.log(`[SYMULACJA API] Akcja: ${actionName}`, details);
|
||||
// Przykładowe wysłanie docelowo:
|
||||
// if (window.socket && window.socket.readyState === WebSocket.OPEN) {
|
||||
// window.socket.send(JSON.stringify({ action: "sendUpstream", payload: { type: actionName, table: tableParam, ...details } }));
|
||||
// }
|
||||
function escapeHtml(value) {
|
||||
return String(value ?? "")
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
export async function callWaiter(type) {
|
||||
@@ -48,7 +48,6 @@ export async function callWaiter(type) {
|
||||
}
|
||||
|
||||
trackEvent("waiter_call_requested", { waiterType: "order" });
|
||||
sendApiSimulated("CallWaiter_Order", { table: getTableParam() });
|
||||
showToast(t("waiter.toast_ok"));
|
||||
}
|
||||
|
||||
@@ -142,10 +141,10 @@ function renderBillList(bills) {
|
||||
const numerFormat = b.numer ? `#${b.numer}` : t("bill.bill_fallback");
|
||||
div.innerHTML = `
|
||||
<div>
|
||||
<div style="font-weight:bold;">${numerFormat}</div>
|
||||
<div style="font-size:12px; color:var(--text-muted);">${b.opis}</div>
|
||||
<div style="font-weight:bold;">${escapeHtml(numerFormat)}</div>
|
||||
<div style="font-size:12px; color:var(--text-muted);">${escapeHtml(b.opis)}</div>
|
||||
</div>
|
||||
<div style="font-weight:bold; color:var(--primary);">${b.suma.toFixed(2)} PLN</div>
|
||||
<div style="font-weight:bold; color:var(--primary);">${Number(b.suma).toFixed(2)} PLN</div>
|
||||
`;
|
||||
container.appendChild(div);
|
||||
});
|
||||
@@ -172,10 +171,10 @@ export function showBillReview(bill) {
|
||||
|
||||
div.innerHTML = `
|
||||
<div style="flex:1;">
|
||||
<div style="font-weight:600; font-size: 14px;">${p.nazwa}</div>
|
||||
<div style="font-size:12px; color:var(--text-muted);">${p.ilosc} x ${p.cena.toFixed(2)} PLN</div>
|
||||
<div style="font-weight:600; font-size: 14px;">${escapeHtml(p.nazwa)}</div>
|
||||
<div style="font-size:12px; color:var(--text-muted);">${escapeHtml(p.ilosc)} x ${Number(p.cena).toFixed(2)} PLN</div>
|
||||
</div>
|
||||
<div style="font-weight:600;">${p.wartosc.toFixed(2)} PLN</div>
|
||||
<div style="font-weight:600;">${Number(p.wartosc).toFixed(2)} PLN</div>
|
||||
`;
|
||||
content.appendChild(div);
|
||||
});
|
||||
@@ -220,12 +219,6 @@ export async function selectDocument(docType) {
|
||||
}
|
||||
trackEvent("bill_request_sent", { docType: "paragon" });
|
||||
closeBillDialog();
|
||||
sendApiSimulated("CallWaiter_Bill", {
|
||||
table: getTableParam(),
|
||||
billId: billState.selectedBillId,
|
||||
payment: billState.payment,
|
||||
doc: "paragon",
|
||||
});
|
||||
showToast(t("bill.toast_receipt"));
|
||||
} else {
|
||||
goToStep("stepNIP");
|
||||
@@ -343,13 +336,5 @@ export async function confirmInvoice() {
|
||||
|
||||
closeBillDialog();
|
||||
trackEvent("bill_request_sent", { docType: "faktura" });
|
||||
sendApiSimulated("CallWaiter_Bill", {
|
||||
table: getTableParam(),
|
||||
billId: billState.selectedBillId,
|
||||
payment: billState.payment,
|
||||
doc: "faktura",
|
||||
nip: billState.nip,
|
||||
company: billState.company,
|
||||
});
|
||||
showToast(t("bill.toast_invoice"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user