diff --git a/public/staff/generator.php b/public/staff/generator.php index b2bc217..cf1cefe 100644 --- a/public/staff/generator.php +++ b/public/staff/generator.php @@ -2,22 +2,30 @@ require_once __DIR__ . '/auth.php'; requireAdminAuth(true); require_once __DIR__ . '/../../config/database.php'; +require_once __DIR__ . '/generator_helpers.php'; $tsql = "SELECT ID, Nazwa FROM dbo.NGastroStolik ORDER BY Nazwa"; $stmt = sqlsrv_query($conn, $tsql); -$host = $_SERVER['HTTP_HOST'] ?? 'localhost'; -$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; -$scriptDir = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'] ?? '/public/staff')); -$publicDir = str_replace('\\', '/', dirname($scriptDir)); -$basePath = rtrim($publicDir, '/') . '/app.html?h='; -$baseUrl = "{$scheme}://{$host}{$basePath}"; +[$baseUrl] = buildGuestAppBaseUrl(); $previewQuery = 'preview=staff'; -function appendPreviewParam(string $link, string $previewQuery): string -{ - return str_contains($link, '?') ? $link . '&' . $previewQuery : $link . '?' . $previewQuery; +$tables = []; +while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { + $id = strtoupper((string) $row['ID']); + $nazwa = trim((string) $row['Nazwa']); + $link = $baseUrl . $id; + + $tables[] = [ + 'id' => $id, + 'nazwa' => $nazwa, + 'link' => $link, + 'previewLink' => appendPreviewParam($link, $previewQuery), + ]; } + +$tables = buildUniqueQrFileNames($tables); +$tablesJson = json_encode($tables, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?> @@ -29,6 +37,11 @@ function appendPreviewParam(string $link, string $previewQuery): string body { font-family: Inter, Arial, sans-serif; padding: 20px; background: #0f172a; color: #e2e8f0; } h1 { margin: 0 0 10px; } p { color: #94a3b8; } + .toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 20px; } + .btn-zip { padding: 10px 16px; background: #22c55e; color: #0f172a; border: none; border-radius: 8px; cursor: pointer; font-weight: 700; } + .btn-zip:hover:not(:disabled) { background: #16a34a; color: #fff; } + .btn-zip:disabled { opacity: 0.65; cursor: wait; } + .zip-status { font-size: 0.9rem; color: #cbd5e1; min-height: 1.2em; } table { border-collapse: collapse; width: 100%; max-width: 1100px; background: #111827; border: 1px solid #334155; } th, td { border: 1px solid #334155; padding: 10px; text-align: left; } th { background: #0b1220; } @@ -40,42 +53,61 @@ function appendPreviewParam(string $link, string $previewQuery): string .btn-preview:hover { background: #1e293b; border-color: #64748b; color: #e2e8f0; text-decoration: none; } .actions-cell { white-space: nowrap; } .btn-nav { display:inline-block; margin-right:8px; margin-bottom:14px; color:#cbd5e1; text-decoration:none; border:1px solid #334155; padding:8px 12px; border-radius:10px; } + .file-name { font-size: 0.82rem; color: #94a3b8; margin-top: 4px; } .modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); align-items: center; justify-content: center; } .modal-content { background: #111827; border:1px solid #334155; padding: 20px; border-radius: 8px; text-align: center; max-width: 420px; width: 90%; } .close { float: right; font-size: 24px; font-weight: bold; cursor: pointer; line-height: 20px; color:#cbd5e1; } #qrcode { margin-top: 20px; display: flex; justify-content: center; } + Wróć do panelu admina Wyloguj

Linki do aplikacji (kody QR)

Skopiuj poniższe linki lub wygeneruj z nich kody QR do umieszczenia na stolikach. Podgląd admina nie trafia do analityki.

+ +
+ + +
+ + - + + + + + + + - + - +
Nazwa stolikaPlik w ZIP Hash (ID z bazy) Bezpieczny link Akcje
Brak stolików w bazie.
- - Podgląd admina + + Podgląd admina