Poprawka generatora QR i ukrycie imienia
This commit is contained in:
@@ -167,7 +167,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- NAME DIALOG -->
|
<!-- NAME DIALOG (Tymczasowo wyłączone)
|
||||||
<div class="modal-overlay" id="nameModal">
|
<div class="modal-overlay" id="nameModal">
|
||||||
<div class="modal-content" style="text-align: center;">
|
<div class="modal-content" style="text-align: center;">
|
||||||
<div style="font-size: 48px; margin-bottom: 15px;">👋</div>
|
<div style="font-size: 48px; margin-bottom: 15px;">👋</div>
|
||||||
@@ -186,6 +186,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- BILL DIALOG -->
|
<!-- BILL DIALOG -->
|
||||||
<div class="modal-overlay" id="billModal">
|
<div class="modal-overlay" id="billModal">
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const userProfileKey = "karczma_user_profile";
|
|||||||
const USER_PROFILE_EXPIRE_MS = 180 * 24 * 60 * 60 * 1000; // ~6 months
|
const USER_PROFILE_EXPIRE_MS = 180 * 24 * 60 * 60 * 1000; // ~6 months
|
||||||
|
|
||||||
function initUserProfile() {
|
function initUserProfile() {
|
||||||
|
return; // Funkcja tymczasowo wyłączona
|
||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(userProfileKey);
|
const raw = localStorage.getItem(userProfileKey);
|
||||||
let profile = null;
|
let profile = null;
|
||||||
@@ -146,7 +147,7 @@ const msgInterval = setInterval(() => {
|
|||||||
|
|
||||||
// Initial State
|
// Initial State
|
||||||
if (tableParam) {
|
if (tableParam) {
|
||||||
tableLabel.textContent = `Stolik ${tableParam}`;
|
tableLabel.textContent = tableParam.toUpperCase().startsWith("STOLIK") ? tableParam : `Stolik ${tableParam}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideLoader() {
|
function hideLoader() {
|
||||||
@@ -460,7 +461,7 @@ async function fetchOrders() {
|
|||||||
|
|
||||||
if (result.status === 'success') {
|
if (result.status === 'success') {
|
||||||
if (result.tableName && result.tableName !== '') {
|
if (result.tableName && result.tableName !== '') {
|
||||||
tableLabel.textContent = `Stolik ${result.tableName}`;
|
tableLabel.textContent = result.tableName.toUpperCase().startsWith("STOLIK") ? result.tableName : `Stolik ${result.tableName}`;
|
||||||
tableParam = result.tableName; // Aktualizacja do właściwej nazwy na poczet innych zapytań
|
tableParam = result.tableName; // Aktualizacja do właściwej nazwy na poczet innych zapytań
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +759,7 @@ window.selectDocument = function (docType) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.fetchGUS = function () {
|
window.fetchGUS = async function () {
|
||||||
const nip = document.getElementById("nipInput").value.replace(/[\s-]/g, '');
|
const nip = document.getElementById("nipInput").value.replace(/[\s-]/g, '');
|
||||||
if (nip.length < 10) {
|
if (nip.length < 10) {
|
||||||
alert("Wprowadź poprawny numer NIP.");
|
alert("Wprowadź poprawny numer NIP.");
|
||||||
@@ -768,34 +769,51 @@ window.fetchGUS = function () {
|
|||||||
btn.textContent = "Szukam...";
|
btn.textContent = "Szukam...";
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
|
|
||||||
// Symulacja pobrania z GUS
|
try {
|
||||||
setTimeout(() => {
|
const apiKey = "d8bdc252-e0f1-4863-97a1-826faddbc49c";
|
||||||
|
const response = await fetch(`https://api.magico.pro/v1/gus/${nip}?api_key=${apiKey}`);
|
||||||
|
const result = await response.json();
|
||||||
|
|
||||||
|
if (result.status && result.data) {
|
||||||
|
const data = result.data;
|
||||||
|
|
||||||
|
let fullStreet = data.street || '';
|
||||||
|
if (data.propertyNumber) fullStreet += ' ' + data.propertyNumber;
|
||||||
|
if (data.apartmentNumber) fullStreet += '/' + data.apartmentNumber;
|
||||||
|
|
||||||
|
billState.nip = nip;
|
||||||
|
billState.company = {
|
||||||
|
name: data.name,
|
||||||
|
street: fullStreet.trim(),
|
||||||
|
zip: data.zipCode,
|
||||||
|
city: data.city,
|
||||||
|
nip: data.nip
|
||||||
|
};
|
||||||
|
|
||||||
|
document.getElementById("cmpName").value = billState.company.name;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 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";
|
||||||
|
|
||||||
|
goToStep("stepVerify");
|
||||||
|
} else {
|
||||||
|
alert("Nie udało się pobrać danych z GUS dla podanego NIP-u.");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Błąd pobierania danych z GUS:", error);
|
||||||
|
alert("Błąd połączenia z API GUS.");
|
||||||
|
} finally {
|
||||||
btn.textContent = "Pobierz z GUS";
|
btn.textContent = "Pobierz z GUS";
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
billState.nip = nip;
|
}
|
||||||
billState.company = {
|
|
||||||
name: "Przykładowa Firma Sp. z o.o.",
|
|
||||||
street: "ul. Gastronomiczna 12/4",
|
|
||||||
zip: "00-120",
|
|
||||||
city: "Warszawa",
|
|
||||||
nip: nip
|
|
||||||
};
|
|
||||||
|
|
||||||
document.getElementById("cmpName").value = billState.company.name;
|
|
||||||
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;
|
|
||||||
|
|
||||||
// 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";
|
|
||||||
|
|
||||||
goToStep("stepVerify");
|
|
||||||
}, 1200);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- DYNAMIC MENU LOADING ---
|
// --- DYNAMIC MENU LOADING ---
|
||||||
@@ -945,7 +963,7 @@ window.initGeolocation = function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
geoMsg.innerHTML = "Pobieranie lokalizacji...";
|
geoMsg.innerHTML = "Sprawdzamy Twoją lokalizację...";
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(
|
navigator.geolocation.getCurrentPosition(
|
||||||
(position) => {
|
(position) => {
|
||||||
|
|||||||
@@ -19,7 +19,14 @@ echo "<!DOCTYPE html>
|
|||||||
th { background: #eee; }
|
th { background: #eee; }
|
||||||
a { color: #0066cc; text-decoration: none; }
|
a { color: #0066cc; text-decoration: none; }
|
||||||
a:hover { text-decoration: underline; }
|
a:hover { text-decoration: underline; }
|
||||||
|
.btn-qr { padding: 5px 10px; background: #3b82f6; color: #fff; border: none; border-radius: 4px; cursor: pointer; }
|
||||||
|
.btn-qr:hover { background: #2563eb; }
|
||||||
|
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); align-items: center; justify-content: center; }
|
||||||
|
.modal-content { background: #fff; padding: 20px; border-radius: 8px; text-align: center; max-width: 400px; width: 90%; }
|
||||||
|
.close { float: right; font-size: 24px; font-weight: bold; cursor: pointer; line-height: 20px; }
|
||||||
|
#qrcode { margin-top: 20px; display: flex; justify-content: center; }
|
||||||
</style>
|
</style>
|
||||||
|
<script src='https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js'></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Linki do aplikacji (Kody QR)</h1>
|
<h1>Linki do aplikacji (Kody QR)</h1>
|
||||||
@@ -29,6 +36,7 @@ echo "<!DOCTYPE html>
|
|||||||
<th>Nazwa stolika</th>
|
<th>Nazwa stolika</th>
|
||||||
<th>Hash (ID z bazy)</th>
|
<th>Hash (ID z bazy)</th>
|
||||||
<th>Bezpieczny Link (KOD QR)</th>
|
<th>Bezpieczny Link (KOD QR)</th>
|
||||||
|
<th>Akcje</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
@@ -39,10 +47,51 @@ while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
|||||||
<td><strong>$nazwa</strong></td>
|
<td><strong>$nazwa</strong></td>
|
||||||
<td style='font-size: 0.8em; color: #666;'>$id</td>
|
<td style='font-size: 0.8em; color: #666;'>$id</td>
|
||||||
<td><a href='$link' target='_blank'>$link</a></td>
|
<td><a href='$link' target='_blank'>$link</a></td>
|
||||||
|
<td><button class='btn-qr' onclick='openQR(\"$link\", \"$nazwa\")'>Pokaż QR</button></td>
|
||||||
</tr>";
|
</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " </table>
|
echo " </table>
|
||||||
|
|
||||||
|
<div id='qrModal' class='modal'>
|
||||||
|
<div class='modal-content'>
|
||||||
|
<span class='close' onclick='closeQR()'>×</span>
|
||||||
|
<h2 id='qrTitle'>Kod QR</h2>
|
||||||
|
<div id='qrcode'></div>
|
||||||
|
<p style='margin-top:20px;'><a id='qrLink' href='' target='_blank' style='color: #3b82f6;'>Otwórz link w nowym oknie</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function openQR(link, nazwa) {
|
||||||
|
document.getElementById('qrModal').style.display = 'flex';
|
||||||
|
document.getElementById('qrTitle').innerText = 'Stolik: ' + nazwa;
|
||||||
|
document.getElementById('qrLink').href = link;
|
||||||
|
|
||||||
|
var qrContainer = document.getElementById('qrcode');
|
||||||
|
qrContainer.innerHTML = ''; // Wyczyść poprzedni kod
|
||||||
|
|
||||||
|
new QRCode(qrContainer, {
|
||||||
|
text: link,
|
||||||
|
width: 250,
|
||||||
|
height: 250,
|
||||||
|
colorDark : '#000000',
|
||||||
|
colorLight : '#ffffff',
|
||||||
|
correctLevel : QRCode.CorrectLevel.H
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeQR() {
|
||||||
|
document.getElementById('qrModal').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onclick = function(event) {
|
||||||
|
var modal = document.getElementById('qrModal');
|
||||||
|
if (event.target == modal) {
|
||||||
|
closeQR();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>";
|
</html>";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user