Files
deskhub/DeskHub-Webseite/staff/apps.php
T
2026-10-16 19:12:18 +00:00

74 lines
4.1 KiB
PHP

<?php
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/_ui.php';
$staff = require_staff_login();
$isAdmin = ($staff['role'] ?? '') === 'admin';
if ($isAdmin) app_downloads_prepare_dir(); // Ordner anlegen und Direktzugriff sperren
$apps = [];
foreach (array_keys(app_platforms()) as $key) $apps[$key] = app_download_info($key);
$serverUrl = base_url();
$pageTitle = 'Apps';
$activePage = 'apps';
require __DIR__ . '/_header.php';
?>
<h1 style="margin-top:0">Apps für Mitarbeiter</h1>
<p class="muted">Mit den Apps bearbeitet ihr Tickets am PC oder unterwegs. Beide haben ein helles und dunkles Design.</p>
<div class="card" style="margin-bottom:20px">
<strong>Serveradresse für die Anmeldung</strong>
<div style="display:flex;gap:8px;align-items:center;margin-top:6px;flex-wrap:wrap">
<input type="text" id="server-url" value="<?= e($serverUrl) ?>" readonly style="max-width:420px;margin:0">
<button type="button" class="btn secondary" onclick="navigator.clipboard.writeText(document.getElementById('server-url').value); this.textContent='Kopiert'">Kopieren</button>
</div>
<div class="muted" style="font-size:.82rem;margin-top:6px">Diese Adresse gebt ihr beim ersten Start der App ein, danach meldet ihr euch mit eurem Mitarbeiter-Konto an.</div>
</div>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:20px">
<?php foreach (app_platforms() as $key => $p): $a = $apps[$key]; ?>
<div class="card" style="margin:0">
<div style="font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:8px"><?= e($p['label']) ?></div>
<?php if ($a): ?>
<div style="font-size:1.3rem;font-weight:800"><?= e($p['label']) ?>-App</div>
<div class="muted" style="font-size:.82rem;margin:4px 0 12px">
<?= e(app_format_size($a['size'])) ?> · Stand <?= e(ui_date($a['modified_at'])) ?>
</div>
<a class="btn" href="/staff/app_download.php?platform=<?= e($key) ?>">⬇ <?= e($p['label']) ?>-App herunterladen</a>
<div class="muted" style="font-size:.72rem;margin-top:10px;word-break:break-all">SHA-256: <?= e($a['sha256']) ?></div>
<?php else: ?>
<div class="muted">Hier ist noch keine <?= e($p['label']) ?>-App hinterlegt.<?= $isAdmin ? '' : ' Bitte einen Administrator fragen.' ?></div>
<?php if ($isAdmin): ?>
<div style="font-size:.85rem;margin-top:8px">Datei per FTP in den Ordner <code>app_downloads/</code> legen und genau so benennen: <code><?= e($p['stored']) ?></code></div>
<?php endif; ?>
<?php endif; ?>
<div style="margin-top:14px;font-size:.85rem;border-top:1px solid var(--border);padding-top:12px">
<strong>Installation</strong>
<?php if ($key === 'windows'): ?>
<ol style="padding-left:18px;margin:6px 0 0;line-height:1.7">
<li>Datei herunterladen und starten.</li>
<li>Falls Windows warnt („Der Computer wurde geschützt“): <em>Weitere Informationen → Trotzdem ausführen</em>.</li>
<li>App öffnen, Serveradresse eingeben und anmelden.</li>
</ol>
<?php else: ?>
<ol style="padding-left:18px;margin:6px 0 0;line-height:1.7">
<li>Datei auf dem Handy herunterladen und öffnen.</li>
<li>Android fragt einmalig, ob der Browser Apps installieren darf. Das bitte erlauben.</li>
<li>App öffnen, Serveradresse eingeben und anmelden.</li>
<li>Updates: neue Datei laden und darüber installieren. Eure Anmeldung bleibt erhalten.</li>
</ol>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php if ($isAdmin): ?>
<p class="muted" style="font-size:.82rem;margin-top:18px">
Hinweis für Administratoren: Zum Aktualisieren einer App die neue Datei per FTP in <code>app_downloads/</code> hochladen und die alte ersetzen (Namen: <code>DeskHub-Setup.exe</code> und <code>DeskHub.apk</code>). Die Seite zeigt automatisch Größe, Datum und Prüfsumme der neuen Datei. Die Dateien sind nur für angemeldete Mitarbeiter abrufbar.
</p>
<?php endif; ?>
<?php require __DIR__ . '/_footer.php'; ?>