66 lines
2.3 KiB
PHP
66 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* @var stNotification $notification
|
|
*/
|
|
use_helper('stNotification', 'stDate');
|
|
?>
|
|
|
|
<?php if ($notification->hasUnreadNotifications()): ?>
|
|
<a href="#">
|
|
<span class="<?php if ($notification->getUnreadNotifications()[0]->getType() != stNotification::TYPE_INFO): ?>shake-top<?php endif ?> bs-d-block position-relative">
|
|
<?php echo st_backend_get_icon('notification-unread', array(
|
|
'size' => 24,
|
|
'color' => 'white'
|
|
)) ?>
|
|
<?php echo st_notification_get_color($notification->getUnreadNotifications()[0]) ?>
|
|
</span>
|
|
</a>
|
|
<?php else : ?>
|
|
<a href="#">
|
|
<span class="bs-d-block position-relative">
|
|
<?php echo st_backend_get_icon('notification', array(
|
|
'size' => 24,
|
|
'color' => 'white'
|
|
)) ?>
|
|
</span>
|
|
</a>
|
|
<?php endif ?>
|
|
|
|
<ul>
|
|
<?php foreach ($notification->getUnreadNotifications() as $current): ?>
|
|
<li>
|
|
<a href="<?php echo st_url_for('@stNotificationBackend?action=process&id=' . $current->getId()) ?>" class="bs-d-flex notification-message">
|
|
<span class="position-relative notification-icon"><?php echo st_notification_get_icon($current, array('size' => 26)) ?></span>
|
|
<span class="bs-ms-2" style="max-width: none">
|
|
<?php echo $current->getMessage() ?>
|
|
<span class="notification-date"><?php echo st_format_date($current->getCreatedAt()) ?></span>
|
|
</span>
|
|
</a>
|
|
</li>
|
|
<?php endforeach ?>
|
|
<li><a href="<?php echo st_url_for('@stNotificationBackend?action=list') ?>" class="text-center"><?php echo __("Pokaż wszystkie") ?></a></li>
|
|
</ul>
|
|
|
|
|
|
<script>
|
|
jQuery(function($) {
|
|
let container = $('#notification');
|
|
|
|
container.on('click', '.notification-message', function() {
|
|
let link = $(this);
|
|
|
|
$.preloader.show();
|
|
|
|
$.post(link.prop('href'), function(response) {
|
|
if (typeof response === 'object' && response.action) {
|
|
window.location = response.action;
|
|
} else {
|
|
container.html(response);
|
|
$.preloader.hide();
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|