mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 09:58:39 +00:00
Draft form feedback log
This commit is contained in:
parent
eba81f20c6
commit
b95e3c86f8
|
|
@ -37,6 +37,15 @@
|
|||
}
|
||||
|
||||
let output = document.importNode(tpl.content, true);
|
||||
output.querySelector('.log-msg').classList.add('log-msg-status-' + msg.status);
|
||||
output.querySelector('.log-msg-title').innerHTML = msg.title;
|
||||
output.querySelector('.log-msg-content').innerHTML = msg.message;
|
||||
|
||||
tpl.parentNode.appendChild(output);
|
||||
|
||||
setTimeout(function ()
|
||||
{
|
||||
document.getElementsByClassName('log-msg')[0].remove();
|
||||
}, 3000);
|
||||
};
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
19
Message/Notification/NotificationLevel.enum.js
Normal file
19
Message/Notification/NotificationLevel.enum.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Notification data enum.
|
||||
*
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
(function (jsOMS) {
|
||||
"use strict";
|
||||
|
||||
/** @namespace jsOMS.Message.Notification */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
|
||||
|
||||
jsOMS.Message.Notification.NotificationLevel = Object.freeze({
|
||||
OK: 'ok',
|
||||
ERROR: 'error'
|
||||
});
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
jsOMS.Message.Notification.NotificationMessage = function (status, title, message)
|
||||
{
|
||||
this.status = 0;
|
||||
this.status = status;
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -222,13 +222,17 @@
|
|||
let tempResponse = null,
|
||||
success = null;
|
||||
|
||||
self.app.notifyManager.send(
|
||||
new jsOMS.Message.Notification.NotificationMessage(
|
||||
jsOMS.Message.Notification.NotificationLevel,
|
||||
'Success',
|
||||
'Successfully created object'
|
||||
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
|
||||
);
|
||||
if (typeof document.getElementById(form.getId()).dataset.msg !== 'undefined') {
|
||||
let msg = JSON.parse(document.getElementById(form.getId()).dataset.msg);
|
||||
|
||||
self.app.notifyManager.send(
|
||||
new jsOMS.Message.Notification.NotificationMessage(
|
||||
jsOMS.Message.Notification.NotificationLevel.OK,
|
||||
msg.title,
|
||||
msg.message
|
||||
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
|
||||
);
|
||||
}
|
||||
|
||||
/* Handle responses (can be multiple response object) */
|
||||
for (let k = 0; k < responseLength; ++k) {
|
||||
|
|
@ -251,6 +255,17 @@
|
|||
}
|
||||
});
|
||||
|
||||
request.setResultCallback(0, function (xhr)
|
||||
{
|
||||
self.app.notifyManager.send(
|
||||
new jsOMS.Message.Notification.NotificationMessage(
|
||||
jsOMS.Message.Notification.NotificationLevel.ERROR,
|
||||
'Failure',
|
||||
'Some failure happend'
|
||||
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
|
||||
);
|
||||
});
|
||||
|
||||
request.send();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user