67 lines
4.4 KiB
PHP
67 lines
4.4 KiB
PHP
<?php require __DIR__ . '/settings_nav.php'; ?>
|
|
<div class="mb-3">
|
|
<h2 class="mb-1"><?= h(t('notification.title')) ?></h2>
|
|
<div class="text-muted"><?= h(t('notification.intro')) ?></div>
|
|
</div>
|
|
<?php if ($saved): ?><div class="alert alert-success">✅ <?= h(t('notification.saved')) ?></div><?php endif; ?>
|
|
<?php if ($sent === 'sent'): ?><div class="alert alert-success">✅ <?= h(t('notification.sent')) ?></div>
|
|
<?php elseif ($sent === 'mail_failed'): ?><div class="alert alert-danger">⚠️ <?= h(t('notification.mail_failed')) ?>
|
|
</div><?php elseif ($sent === 'recipient' || $sent === 'invalid'): ?><div class="alert alert-danger">⚠️
|
|
<?= h(t('notification.invalid_recipient')) ?></div><?php endif; ?>
|
|
<div class="row g-3">
|
|
<div class="col-lg-7">
|
|
<form method="post" action="/settings/notifications/save"><input type="hidden" name="csrf"
|
|
value="<?= h(Auth::csrf()) ?>">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3 class="card-title"><?= h(t('notification.email_digest')) ?></h3>
|
|
</div>
|
|
<div class="card-body"><label class="form-check form-switch mb-3"><input class="form-check-input"
|
|
type="checkbox" name="notification_email_enabled"
|
|
<?= $settings['notification_email_enabled'] === '1' ? 'checked' : '' ?>><span
|
|
class="form-check-label"><?= h(t('notification.enable_email')) ?></span></label>
|
|
<div class="row g-3">
|
|
<div class="col-md-7"><label
|
|
class="form-label"><?= h(t('notification.recipient')) ?></label><input
|
|
class="form-control" type="email" name="notification_email_recipient"
|
|
value="<?= h($settings['notification_email_recipient']) ?>"
|
|
placeholder="<?= h($settings['association_email']) ?>">
|
|
<div class="form-hint"><?= h(t('notification.recipient_help')) ?></div>
|
|
</div>
|
|
<div class="col-md-5"><label
|
|
class="form-label"><?= h(t('notification.frequency')) ?></label><select
|
|
class="form-select" name="notification_email_frequency">
|
|
<option value="daily"
|
|
<?= $settings['notification_email_frequency'] === 'daily' ? 'selected' : '' ?>>
|
|
<?= h(t('notification.daily')) ?></option>
|
|
<option value="weekly"
|
|
<?= $settings['notification_email_frequency'] === 'weekly' ? 'selected' : '' ?>>
|
|
<?= h(t('notification.weekly')) ?></option>
|
|
</select></div>
|
|
</div>
|
|
<div class="text-end mt-4"><button class="btn btn-primary"><?= h(t('settings.save')) ?></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="col-lg-5">
|
|
<div class="card mb-3">
|
|
<div class="card-header">
|
|
<h3 class="card-title"><?= h(t('notification.current_alerts')) ?></h3>
|
|
</div>
|
|
<div class="list-group list-group-flush"><?php $alerts = NotificationService::alerts();
|
|
if (!$alerts): ?><div class="list-group-item text-muted"><?= h(t('notification.no_alert')) ?></div>
|
|
<?php else: foreach ($alerts as $alert): ?><a
|
|
class="list-group-item list-group-item-action d-flex justify-content-between"
|
|
href="<?= h($alert['url']) ?>"><span><?= h($alert['label']) ?></span><span
|
|
class="badge bg-<?= $alert['severity'] === 'danger' ? 'red' : 'yellow' ?>-lt"><?= (int)$alert['count'] ?></span></a><?php endforeach;endif; ?>
|
|
</div>
|
|
</div>
|
|
<form method="post" action="/settings/notifications/send"><input type="hidden" name="csrf"
|
|
value="<?= h(Auth::csrf()) ?>"><button class="btn btn-outline-primary w-100"
|
|
type="submit"><?= h(t('notification.send_test')) ?></button></form>
|
|
<div class="text-muted small mt-2"><?= h(t('notification.cron_help')) ?> <code>php
|
|
scripts/send-notifications.php</code></div>
|
|
</div>
|
|
</div>
|