feat: Admin-Setup zeigt PWA-Link + QR-Code + REST-API-Übersicht
All checks were successful
Deploy bericht / deploy (push) Successful in 1s
All checks were successful
Deploy bericht / deploy (push) Successful in 1s
Im Bericht-Modul-Admin oben prominent: - Großer 'PWA öffnen'-Button mit Direktlink auf /custom/baustelle/ - 'QR-Code anzeigen'-Button mit qrcodejs (Inline-Render auf Klick) - Code-Block mit der vollen URL zum Kopieren - Sektion 'REST-API Status' listet alle Endpoints für die Doku Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> [deploy]
This commit is contained in:
parent
bed611cd8b
commit
43ac766af2
1 changed files with 53 additions and 0 deletions
|
|
@ -84,6 +84,35 @@ print load_fiche_titre($langs->trans("BerichtSetup"), $linkback, 'title_setup');
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("BerichtSetupDescription").'</span><br><br>';
|
print '<span class="opacitymedium">'.$langs->trans("BerichtSetupDescription").'</span><br><br>';
|
||||||
|
|
||||||
|
// --- PWA-Link prominent oben ---
|
||||||
|
$pwa_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].'/custom/baustelle/';
|
||||||
|
print '<div class="bericht-setup-section" style="background:linear-gradient(135deg,#1e3a5f,#2a5080);border:1px solid #4080c0;">';
|
||||||
|
print '<h3 style="color:#fff;">📱 Baustelle PWA</h3>';
|
||||||
|
print '<p style="color:#e0e8f0;">Mobile Progressive Web App für die Baustelle. Installierbar auf Handy oder Tablet, funktioniert offline.</p>';
|
||||||
|
print '<p style="color:#e0e8f0;font-size:13px;"><strong>Funktionen:</strong> Auftragsliste, Foto-Aufnahme direkt aus der Kamera, automatische Synchronisierung bei Verbindung, Multi-User-Filter pro angemeldetem User</p>';
|
||||||
|
print '<div style="display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:12px;">';
|
||||||
|
print ' <a href="'.dol_escape_htmltag($pwa_url).'" target="_blank" class="butAction" style="background:#5cb85c;color:#fff;border:none;padding:10px 20px;border-radius:6px;text-decoration:none;font-weight:600;">🚀 PWA öffnen</a>';
|
||||||
|
print ' <button type="button" id="btn-show-pwa-qr" class="butAction" style="background:#fff;color:#2a5080;border:none;padding:10px 20px;border-radius:6px;font-weight:600;cursor:pointer;">📱 QR-Code anzeigen</button>';
|
||||||
|
print ' <code style="background:rgba(0,0,0,0.3);padding:8px 12px;border-radius:4px;color:#e0e8f0;font-size:12px;">'.dol_escape_htmltag($pwa_url).'</code>';
|
||||||
|
print '</div>';
|
||||||
|
print '<div id="pwa-qr-area" style="display:none;text-align:center;margin-top:16px;background:#fff;padding:16px;border-radius:8px;"><div id="pwa-qr"></div><p style="color:#222;font-size:12px;margin:8px 0 0;">Mit dem Handy scannen → "Zum Home-Screen hinzufügen"</p></div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// API-Status
|
||||||
|
print '<div class="bericht-setup-section">';
|
||||||
|
print '<h3>🔌 REST-API Status</h3>';
|
||||||
|
$api_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].'/custom/bericht/api';
|
||||||
|
print '<p>Endpoint: <code>'.dol_escape_htmltag($api_url).'</code></p>';
|
||||||
|
print '<table class="noborder">';
|
||||||
|
print '<tr><td><code>POST '.dol_escape_htmltag($api_url).'/auth.php</code></td><td>Login → JWT</td></tr>';
|
||||||
|
print '<tr><td><code>GET '.dol_escape_htmltag($api_url).'/orders.php</code></td><td>Aufträge des Users</td></tr>';
|
||||||
|
print '<tr><td><code>GET '.dol_escape_htmltag($api_url).'/orders.php?id=X</code></td><td>Auftrags-Detail</td></tr>';
|
||||||
|
print '<tr><td><code>POST '.dol_escape_htmltag($api_url).'/orders.php?id=X&action=upload_photo</code></td><td>Foto hochladen</td></tr>';
|
||||||
|
print '<tr><td><code>GET '.dol_escape_htmltag($api_url).'/reports.php?id=X</code></td><td>Bericht-Detail</td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '<p class="opacitymedium small">JWT-Token sind 7 Tage gültig. Multi-User über fk_user_author/valid/modif gefiltert.</p>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// --- Templates ---
|
// --- Templates ---
|
||||||
print '<div class="bericht-setup-section">';
|
print '<div class="bericht-setup-section">';
|
||||||
print '<h3>'.$langs->trans("BerichtSetupTemplates").'</h3>';
|
print '<h3>'.$langs->trans("BerichtSetupTemplates").'</h3>';
|
||||||
|
|
@ -178,5 +207,29 @@ print '<br><button type="submit" class="butAction">'.$langs->trans("Save").'</bu
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// QR-Code-Lib + kleines Init-Script für PWA-QR
|
||||||
|
print '<script src="'.dol_buildpath('/bericht/js/lib/qrcode.min.js', 1).'"></script>';
|
||||||
|
print '<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
var btn = document.getElementById("btn-show-pwa-qr");
|
||||||
|
if (!btn) return;
|
||||||
|
var area = document.getElementById("pwa-qr-area");
|
||||||
|
var container = document.getElementById("pwa-qr");
|
||||||
|
var url = '.json_encode($pwa_url).';
|
||||||
|
var rendered = false;
|
||||||
|
btn.addEventListener("click", function () {
|
||||||
|
if (area.style.display === "none") {
|
||||||
|
area.style.display = "";
|
||||||
|
if (!rendered && typeof QRCode !== "undefined") {
|
||||||
|
new QRCode(container, { text: url, width: 220, height: 220, correctLevel: QRCode.CorrectLevel.M });
|
||||||
|
rendered = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
area.style.display = "none";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue