mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-12 15:48:40 +00:00
phpstan, phpcs, phpunit fixes
This commit is contained in:
parent
deec179a55
commit
1e21efa715
|
|
@ -36,7 +36,7 @@ export class NotificationMessage
|
||||||
/** @type {boolean} isSticky */
|
/** @type {boolean} isSticky */
|
||||||
this.isSticky = isSticky;
|
this.isSticky = isSticky;
|
||||||
|
|
||||||
this.primaryButton = null;
|
this.primaryButton = null;
|
||||||
this.secondaryButton = null;
|
this.secondaryButton = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export class Form
|
||||||
return this.forms[id];
|
return this.forms[id];
|
||||||
};
|
};
|
||||||
|
|
||||||
hasChanges()
|
hasChanges ()
|
||||||
{
|
{
|
||||||
const length = this.forms.length;
|
const length = this.forms.length;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { NotificationLevel } from '../Message/Notification/NotificationLevel.j
|
||||||
import { NotificationMessage } from '../Message/Notification/NotificationMessage.js';
|
import { NotificationMessage } from '../Message/Notification/NotificationMessage.js';
|
||||||
import { NotificationType } from '../Message/Notification/NotificationType.js';
|
import { NotificationType } from '../Message/Notification/NotificationType.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI manager for handling basic ui elements.
|
* UI manager for handling basic ui elements.
|
||||||
*
|
*
|
||||||
|
|
@ -117,13 +116,21 @@ export class GeneralUI
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
if (window.omsApp.state && window.omsApp.state.hasChanges) {
|
if (window.omsApp.state && window.omsApp.state.hasChanges) {
|
||||||
let message = new NotificationMessage(NotificationLevel.WARNING, 'Unsaved changes', 'Do you want to continue?', true, true);
|
const message = new NotificationMessage(
|
||||||
|
NotificationLevel.WARNING,
|
||||||
|
'Unsaved changes',
|
||||||
|
'Do you want to continue?',
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
message.primaryButton = {
|
message.primaryButton = {
|
||||||
text: 'Yes',
|
text: 'Yes',
|
||||||
style: 'ok',
|
style: 'ok',
|
||||||
callback: function () {
|
callback: function () {
|
||||||
document.documentElement.innerHTML = html;
|
document.documentElement.innerHTML = html;
|
||||||
window.omsApp.state.hasChanges = false;
|
window.omsApp.state.hasChanges = false;
|
||||||
|
|
||||||
this.parentNode.remove();
|
this.parentNode.remove();
|
||||||
history.pushState({}, null, UriFactory.build(uri));
|
history.pushState({}, null, UriFactory.build(uri));
|
||||||
/* This is not working as it reloads the page ?!
|
/* This is not working as it reloads the page ?!
|
||||||
|
|
@ -133,14 +140,15 @@ export class GeneralUI
|
||||||
*/
|
*/
|
||||||
// @todo: fix memory leak which most likely exists because of continous binding without removing binds
|
// @todo: fix memory leak which most likely exists because of continous binding without removing binds
|
||||||
window.omsApp.reInit();
|
window.omsApp.reInit();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
message.secondaryButton = {
|
message.secondaryButton = {
|
||||||
text: 'No',
|
text: 'No',
|
||||||
style: 'error',
|
style: 'error',
|
||||||
callback: function () {
|
callback: function () {
|
||||||
this.parentNode.remove();
|
this.parentNode.remove();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.omsApp.notifyManager.send(message, NotificationType.APP_NOTIFICATION);
|
window.omsApp.notifyManager.send(message, NotificationType.APP_NOTIFICATION);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user