-
-
-
+
Login ID: = esc((string) ($user->username ?? '')) ?>
@@ -97,9 +91,10 @@
$.post($(form).attr('action'), $(form).serialize())
.done(function(html) {
$('#maindiv').html(html);
+ showPageNotifications(document.getElementById('maindiv'));
})
- .fail(function() {
- alert('Request failed. Please try again.');
+ .fail(function(xhr) {
+ notify('error', 'Reset Password', (xhr.responseJSON && xhr.responseJSON.error_text) || 'Request failed. Please try again.');
});
});
})();
diff --git a/app/Views/Setting/Admin/UserManagement/sessions.php b/app/Views/Setting/Admin/UserManagement/sessions.php
index 1f4fcd5..9b6f07e 100644
--- a/app/Views/Setting/Admin/UserManagement/sessions.php
+++ b/app/Views/Setting/Admin/UserManagement/sessions.php
@@ -18,7 +18,6 @@
= count($sessions) ?> user= count($sessions) === 1 ? '' : 's' ?> currently online. A user can have only one active HMS session.
-
@@ -88,14 +87,15 @@
'= csrf_token() ?>': $('input[name="= csrf_token() ?>"]').first().val() || '= csrf_hash() ?>'
}, function(data) {
if (!data || parseInt(data.update || '0', 10) !== 1) {
- $('#user_session_notice').html('' + $('
').text((data && data.error_text) || 'Unable to end session.').html() + '
');
+ notify('error', 'Force Logout', (data && data.error_text) || 'Unable to end session.');
button.disabled = false;
return;
}
+ notify('success', 'Force Logout', data.error_text || 'User session ended.');
load_form_div(listUrl, 'maindiv', 'Active Sessions');
}, 'json').fail(function(xhr) {
var message = (xhr.responseJSON && xhr.responseJSON.error_text) || 'Unable to end session.';
- $('#user_session_notice').html('
' + $('
').text(message).html() + '
');
+ notify('error', 'Force Logout', message);
button.disabled = false;
});
});
diff --git a/app/Views/welcome_message.php b/app/Views/welcome_message.php
index a7acfff..9a79ee6 100644
--- a/app/Views/welcome_message.php
+++ b/app/Views/welcome_message.php
@@ -339,6 +339,9 @@
mainEl.innerHTML = html;
}
executeInjectedScripts('main');
+ if (typeof window.showPageNotifications === 'function') {
+ window.showPageNotifications(mainEl);
+ }
if (typeof initfunc === 'function') {
initfunc();
}
@@ -388,6 +391,9 @@
targetEl.innerHTML = html;
}
executeInjectedScripts(xdiv);
+ if (typeof window.showPageNotifications === 'function') {
+ window.showPageNotifications(targetEl);
+ }
if (typeof initfunc === 'function') {
initfunc();
}
@@ -479,6 +485,18 @@
}
};
}
+
+ window.showPageNotifications = function(root) {
+ var scope = root && root.querySelectorAll ? root : document;
+ scope.querySelectorAll('[data-page-notification]:not([data-notification-shown])').forEach(function(item) {
+ item.setAttribute('data-notification-shown', '1');
+ window.notify(
+ item.getAttribute('data-notification-type') || 'error',
+ item.getAttribute('data-notification-title') || 'Notification',
+ item.getAttribute('data-notification-message') || ''
+ );
+ });
+ };