2022-01-24 15:13:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Cake\Routing\Router;
|
|
|
|
|
|
|
|
$seed = 's-' . mt_rand();
|
|
|
|
$variant = empty($notification['variant']) ? 'primary' : $notification['variant'];
|
|
|
|
?>
|
|
|
|
<a
|
2022-02-09 09:51:21 +01:00
|
|
|
class="notification-item dropdown-item px-2 btn"
|
2022-01-25 09:32:16 +01:00
|
|
|
<?php if (empty($notification['_useModal'])): ?>
|
|
|
|
href="<?= Router::url($notification['router']) ?>"
|
|
|
|
<?php else: ?>
|
|
|
|
onclick="UI.submissionModal('<?= Router::url($notification['router']) ?>', {closeOnSuccess: false})"
|
|
|
|
<?php endif; ?>
|
2022-01-24 15:13:28 +01:00
|
|
|
title="<?= sprintf('%s:
 %s', $this->ValueGetter->get($notification['text']), $this->ValueGetter->get($notification['details'])) ?>"
|
|
|
|
>
|
|
|
|
<div class="d-flex align-items-center">
|
|
|
|
<?php if (!empty($notification['icon'])) : ?>
|
2022-02-09 09:51:21 +01:00
|
|
|
<span class="notification-icon rounded-circle <?= "btn-{$variant} me-2" ?> position-relative">
|
2022-01-24 15:13:28 +01:00
|
|
|
<?= $this->Bootstrap->icon($notification['icon'], ['class' => ['fa-fw', 'position-absolute top-50 start-50 translate-middle']]) ?>
|
|
|
|
</span>
|
|
|
|
<?php endif; ?>
|
2022-02-09 09:51:21 +01:00
|
|
|
<span class="notification-text-container">
|
2022-10-28 11:09:42 +02:00
|
|
|
<div class="d-flex justify-content-between align-items-center gap-2">
|
2022-02-09 09:51:21 +01:00
|
|
|
<span class="notification-title text-truncate"><?= $this->ValueGetter->get($notification['text']) ?></span>
|
2022-01-24 15:13:28 +01:00
|
|
|
<?php if (!empty($notification['datetime'])) : ?>
|
2022-02-09 09:51:21 +01:00
|
|
|
<small id="<?= $seed ?>" class="notification-date text-muted fw-light"><?= h($notification['datetime']->format('Y-m-d\TH:i:s')) ?></small>
|
2022-01-24 15:13:28 +01:00
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
<?php if (!empty($notification['details'])) : ?>
|
2022-02-09 09:51:21 +01:00
|
|
|
<small class="notification-details text-muted text-wrap lh-1 text-truncate">
|
2022-01-24 15:13:28 +01:00
|
|
|
<?= $this->ValueGetter->get($notification['details']) ?>
|
|
|
|
</small>
|
|
|
|
<?php endif; ?>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
<script>
|
|
|
|
document.getElementById('<?= $seed ?>').innerHTML = moment(document.getElementById('<?= $seed ?>').innerHTML).fromNow();
|
|
|
|
</script>
|