chg: [notifications] Support of modal when clicking on notification element

pull/93/head
Sami Mokaddem 2022-01-25 09:32:16 +01:00
parent 38caafb76e
commit 249892c3e0
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 9 additions and 3 deletions

View File

@ -102,14 +102,16 @@ class InboxTable extends AppTable
$details = $notification->title;
$router = [
'controller' => 'inbox',
'action' => 'index',
'action' => 'process',
'plugin' => null,
$notification->id
];
$allNotifications[] = (new Notification($title, $router, [
'icon' => 'envelope',
'details' => $details,
'datetime' => $notification->created,
'variant' => 'warning',
'_useModal' => true,
]))->get();
}
return $allNotifications;

View File

@ -7,8 +7,12 @@ $datetimeMW = 90;
$variant = empty($notification['variant']) ? 'primary' : $notification['variant'];
?>
<a
class="dropdown-item px-2"
href="<?= Router::url($notification['router']) ?>"
class="dropdown-item px-2 btn"
<?php if (empty($notification['_useModal'])): ?>
href="<?= Router::url($notification['router']) ?>"
<?php else: ?>
onclick="UI.submissionModal('<?= Router::url($notification['router']) ?>', {closeOnSuccess: false})"
<?php endif; ?>
style="max-height: 76px;"
title="<?= sprintf('%s:&#010; %s', $this->ValueGetter->get($notification['text']), $this->ValueGetter->get($notification['details'])) ?>"
>