Web-Push mit VAPID und Erinnerungs-Endpoint
This commit is contained in:
parent
67a1614081
commit
b50267e4f0
24 changed files with 1703 additions and 50 deletions
|
|
@ -1,6 +1,13 @@
|
|||
<?php
|
||||
/** @var array $errors */
|
||||
/** @var array|null $employee */
|
||||
/** @var bool $pushEnabled */
|
||||
/** @var bool $pushEligible */
|
||||
/** @var string|null $pushPublicKey */
|
||||
/** @var int $pushDeviceCount */
|
||||
/** @var string $pushSubscribeUrl */
|
||||
/** @var string $pushUnsubscribeUrl */
|
||||
/** @var string $pushTestUrl */
|
||||
$mustChange = (int) ($user['must_change_password'] ?? 0) === 1;
|
||||
?>
|
||||
<div class="page-head page-head--compact">
|
||||
|
|
@ -66,3 +73,58 @@ $mustChange = (int) ($user['must_change_password'] ?? 0) === 1;
|
|||
</form>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
<section class="card push-card"
|
||||
data-push
|
||||
data-vapid-key="<?= e($pushPublicKey ?? '') ?>"
|
||||
data-subscribe-url="<?= e($pushSubscribeUrl) ?>"
|
||||
data-unsubscribe-url="<?= e($pushUnsubscribeUrl) ?>"
|
||||
data-test-url="<?= e($pushTestUrl) ?>">
|
||||
<div class="card__head card__head--row">
|
||||
<div>
|
||||
<h2><svg class="ico ico--inline" aria-hidden="true"><use href="#i-bell"/></svg> App-Erinnerungen</h2>
|
||||
<p>Übergaben und Rücknahmen direkt aufs Smartphone – 8 Tage vor Mietbeginn, 1 Tag vor Mietbeginn und 1 Tag vor Mietende.</p>
|
||||
</div>
|
||||
<span class="pill <?= $pushDeviceCount > 0 ? 'pill--green' : 'pill--grey' ?>" data-push-count>
|
||||
<?= $pushDeviceCount > 0 ? $pushDeviceCount . ' Gerät' . ($pushDeviceCount === 1 ? '' : 'e') . ' aktiv' : 'nicht aktiviert' ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<?php if (!$pushEligible): ?>
|
||||
<div class="alert alert--warning">
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-alert"/></svg>
|
||||
<div><strong>Kein Mitarbeiterkonto verknüpft.</strong> Push-Erinnerungen werden über das zuständige Mitarbeiterkonto zugeordnet. Ein Administrator kann das in der Benutzerverwaltung nachholen.</div>
|
||||
</div>
|
||||
<?php elseif (!$pushEnabled): ?>
|
||||
<div class="alert alert--warning">
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-alert"/></svg>
|
||||
<div><strong>Push ist noch nicht eingerichtet.</strong> Der Administrator muss zuerst die VAPID-Schlüssel hinterlegen.</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="push-browser-hint" data-push-browser-hint>
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-download"/></svg>
|
||||
<div>
|
||||
<strong>Nur in der installierten App verfügbar.</strong>
|
||||
<p>Installiere Drink it cold über das Browser-Menü bzw. auf dem iPhone über „Zum Home-Bildschirm“. Danach kannst du hier Push-Erinnerungen für dieses Gerät aktivieren.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="push-controls" data-push-controls hidden>
|
||||
<label class="check check--boxed push-toggle">
|
||||
<input type="checkbox" data-push-toggle>
|
||||
<span>
|
||||
<strong>Erinnerungen auf diesem Gerät empfangen</strong>
|
||||
<small>Die Benachrichtigungs-Erlaubnis wird beim Aktivieren abgefragt.</small>
|
||||
</span>
|
||||
</label>
|
||||
<div class="push-status" data-push-status role="status" aria-live="polite"></div>
|
||||
<div class="push-actions">
|
||||
<button class="btn small" type="button" data-push-test hidden>
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-bell"/></svg> Test-Erinnerung senden
|
||||
</button>
|
||||
<span class="muted small">Die Zuordnung erfolgt über dein Mitarbeiterkonto.</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue