Zmiana aplikacji na wersje lang
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { endpoints } from "./config.js";
|
||||
import { t } from "./i18n.js";
|
||||
import { trackEvent } from "./analytics.js";
|
||||
import { requireFullAccess } from "./access.js";
|
||||
import {
|
||||
@@ -41,14 +42,14 @@ export async function callWaiter(type) {
|
||||
if (queued.reason === "pending") {
|
||||
showToast(guestActionBlockedMessage("waiter_call"));
|
||||
} else {
|
||||
showToast("Nie udało się wysłać wezwania. Spróbuj ponownie za chwilę.");
|
||||
showToast(t("waiter.toast_fail"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
trackEvent("waiter_call_requested", { waiterType: "order" });
|
||||
sendApiSimulated("CallWaiter_Order", { table: getTableParam() });
|
||||
showToast("Kelner wkrótce do Ciebie podejdzie!");
|
||||
showToast(t("waiter.toast_ok"));
|
||||
}
|
||||
|
||||
export function openWaiterDialog() {
|
||||
@@ -96,6 +97,7 @@ export async function openBillDialogInternal() {
|
||||
document.body.style.overflow = "hidden"; // Zablokuj scroll tła
|
||||
|
||||
document.getElementById("billLoading").classList.remove("hidden");
|
||||
document.getElementById("billLoading").textContent = t("bill.loading");
|
||||
document.getElementById("billListContainer").classList.add("hidden");
|
||||
goToStep("stepBillList");
|
||||
|
||||
@@ -115,10 +117,10 @@ export async function openBillDialogInternal() {
|
||||
document.getElementById("btnBackToBills").style.display = "block";
|
||||
}
|
||||
} else {
|
||||
document.getElementById("billLoading").innerHTML = "Brak otwartych rachunków do opłacenia.";
|
||||
document.getElementById("billLoading").innerHTML = t("bill.loading_empty");
|
||||
}
|
||||
} catch (err) {
|
||||
document.getElementById("billLoading").innerHTML = "Błąd pobierania rachunków.";
|
||||
document.getElementById("billLoading").innerHTML = t("bill.loading_error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +139,7 @@ function renderBillList(bills) {
|
||||
div.style.padding = "15px";
|
||||
div.onclick = () => showBillReview(b);
|
||||
|
||||
const numerFormat = b.numer ? `#${b.numer}` : "Rachunek";
|
||||
const numerFormat = b.numer ? `#${b.numer}` : t("bill.bill_fallback");
|
||||
div.innerHTML = `
|
||||
<div>
|
||||
<div style="font-weight:bold;">${numerFormat}</div>
|
||||
@@ -212,7 +214,7 @@ export async function selectDocument(docType) {
|
||||
if (queued.reason === "pending") {
|
||||
showToast(guestActionBlockedMessage("bill_request"));
|
||||
} else {
|
||||
showToast("Nie udało się wysłać prośby o rachunek. Spróbuj ponownie za chwilę.");
|
||||
showToast(t("bill.toast_fail"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -224,7 +226,7 @@ export async function selectDocument(docType) {
|
||||
payment: billState.payment,
|
||||
doc: "paragon",
|
||||
});
|
||||
showToast("Kelner przyniesie paragon do opłacenia!");
|
||||
showToast(t("bill.toast_receipt"));
|
||||
} else {
|
||||
goToStep("stepNIP");
|
||||
document.getElementById("nipInput").value = "";
|
||||
@@ -235,11 +237,11 @@ export async function selectDocument(docType) {
|
||||
export async function fetchGUS() {
|
||||
const nip = document.getElementById("nipInput").value.replace(/[\s-]/g, "");
|
||||
if (nip.length < 10) {
|
||||
alert("Wprowadź poprawny numer NIP.");
|
||||
alert(t("bill.nip_invalid"));
|
||||
return;
|
||||
}
|
||||
const btn = document.getElementById("btnGUS");
|
||||
btn.textContent = "Szukam...";
|
||||
btn.textContent = t("bill.gus_searching");
|
||||
btn.disabled = true;
|
||||
|
||||
try {
|
||||
@@ -267,24 +269,24 @@ export async function fetchGUS() {
|
||||
document.getElementById("cmpStreet").value = billState.company.street;
|
||||
document.getElementById("cmpZip").value = billState.company.zip;
|
||||
document.getElementById("cmpCity").value = billState.company.city;
|
||||
document.getElementById("cmpNip").value = "NIP: " + billState.company.nip;
|
||||
document.getElementById("cmpNip").value = `${t("bill.queue_nip")} ${billState.company.nip}`;
|
||||
|
||||
// reset do readonly
|
||||
document.getElementById("cmpName").readOnly = true;
|
||||
document.getElementById("cmpStreet").readOnly = true;
|
||||
document.getElementById("cmpZip").readOnly = true;
|
||||
document.getElementById("cmpCity").readOnly = true;
|
||||
document.getElementById("btnEditCompany").textContent = "Popraw ręcznie";
|
||||
document.getElementById("btnEditCompany").textContent = t("bill.edit_company");
|
||||
|
||||
goToStep("stepVerify");
|
||||
} else {
|
||||
alert("Nie udało się pobrać danych z GUS dla podanego NIP-u.");
|
||||
alert(t("bill.gus_fail"));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Błąd pobierania danych z GUS:", error);
|
||||
alert("Błąd połączenia z API GUS.");
|
||||
alert(t("bill.gus_error"));
|
||||
} finally {
|
||||
btn.textContent = "Pobierz z GUS";
|
||||
btn.textContent = t("bill.gus");
|
||||
btn.disabled = false;
|
||||
}
|
||||
}
|
||||
@@ -302,13 +304,13 @@ export function editCompanyData() {
|
||||
z.readOnly = false;
|
||||
c.readOnly = false;
|
||||
n.focus();
|
||||
btn.textContent = "Zakończ edycję";
|
||||
btn.textContent = t("bill.edit_done");
|
||||
} else {
|
||||
n.readOnly = true;
|
||||
s.readOnly = true;
|
||||
z.readOnly = true;
|
||||
c.readOnly = true;
|
||||
btn.textContent = "Popraw ręcznie";
|
||||
btn.textContent = t("bill.edit_company");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +336,7 @@ export async function confirmInvoice() {
|
||||
if (queued.reason === "pending") {
|
||||
showToast(guestActionBlockedMessage("bill_request"));
|
||||
} else {
|
||||
showToast("Nie udało się wysłać prośby o rachunek. Spróbuj ponownie za chwilę.");
|
||||
showToast(t("bill.toast_fail"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -349,5 +351,5 @@ export async function confirmInvoice() {
|
||||
nip: billState.nip,
|
||||
company: billState.company,
|
||||
});
|
||||
showToast("Dziękujemy! Prośba o fakturę została wysłana.");
|
||||
showToast(t("bill.toast_invoice"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user