mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-15 08:48:42 +00:00
change from fa-times to close and add omsApp.state
This commit is contained in:
parent
25db82cdf9
commit
3689d94a97
|
|
@ -126,7 +126,7 @@ export class AdvancedInput
|
||||||
|
|
||||||
observer.observe(this.tagElement, { childList: true, attributes: false, subtree: false });
|
observer.observe(this.tagElement, { childList: true, attributes: false, subtree: false });
|
||||||
eventManager.attach(this.id + '-tags-childList', function (data) {
|
eventManager.attach(this.id + '-tags-childList', function (data) {
|
||||||
const removes = data.target.querySelectorAll('.fa-times');
|
const removes = data.target.querySelectorAll('.close');
|
||||||
const removesLength = removes === null ? 0 : removes.length;
|
const removesLength = removes === null ? 0 : removes.length;
|
||||||
|
|
||||||
if (removesLength < 1) {
|
if (removesLength < 1) {
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,9 @@ export class Form
|
||||||
|
|
||||||
if (!this.forms[id].isOnChange()) {
|
if (!this.forms[id].isOnChange()) {
|
||||||
toBind[i].addEventListener('change', function (evnt) {
|
toBind[i].addEventListener('change', function (evnt) {
|
||||||
window.omsApp.state.hasChanges = true;
|
if (window.omsApp.state) {
|
||||||
|
window.omsApp.state.hasChanges = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +175,9 @@ export class Form
|
||||||
onChangeContainer.addEventListener('change', function (event)
|
onChangeContainer.addEventListener('change', function (event)
|
||||||
{
|
{
|
||||||
jsOMS.preventAll(event);
|
jsOMS.preventAll(event);
|
||||||
window.omsApp.state.hasChanges = true;
|
if (window.omsApp.state) {
|
||||||
|
window.omsApp.state.hasChanges = true;
|
||||||
|
}
|
||||||
|
|
||||||
const target = event.target.tagName.toLowerCase();
|
const target = event.target.tagName.toLowerCase();
|
||||||
|
|
||||||
|
|
@ -1073,7 +1077,10 @@ export class Form
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.omsApp.state.hasChanges = false;
|
if (window.omsApp.state) {
|
||||||
|
window.omsApp.state.hasChanges = false;
|
||||||
|
}
|
||||||
|
|
||||||
request.send();
|
request.send();
|
||||||
|
|
||||||
if (form.getFinally() !== null) {
|
if (form.getFinally() !== null) {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export class Input
|
||||||
|
|
||||||
const type = input.type;
|
const type = input.type;
|
||||||
|
|
||||||
const removeContentButton = input.parentNode.querySelector('.fa-times');
|
const removeContentButton = input.parentNode.querySelector('.close');
|
||||||
if (removeContentButton !== null
|
if (removeContentButton !== null
|
||||||
&& type !== 'submit' && type !== 'button') {
|
&& type !== 'submit' && type !== 'button') {
|
||||||
removeContentButton.addEventListener('click', function () {
|
removeContentButton.addEventListener('click', function () {
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ export class GeneralUI
|
||||||
if (this.getAttribute('target') === '_blank'
|
if (this.getAttribute('target') === '_blank'
|
||||||
|| this.getAttribute(['data-target']) === '_blank'
|
|| this.getAttribute(['data-target']) === '_blank'
|
||||||
|| event.button === 1
|
|| event.button === 1
|
||||||
|
|| uri.startsWith('https://')
|
||||||
) {
|
) {
|
||||||
window.open(UriFactory.build(uri), '_blank');
|
window.open(UriFactory.build(uri), '_blank');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -115,7 +116,7 @@ export class GeneralUI
|
||||||
fetch(UriFactory.build(uri))
|
fetch(UriFactory.build(uri))
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
if (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);
|
let message = new NotificationMessage(NotificationLevel.WARNING, 'Unsaved changes', 'Do you want to continue?', true, true);
|
||||||
message.primaryButton = {
|
message.primaryButton = {
|
||||||
text: 'Yes',
|
text: 'Yes',
|
||||||
|
|
@ -145,7 +146,11 @@ export class GeneralUI
|
||||||
window.omsApp.notifyManager.send(message, NotificationType.APP_NOTIFICATION);
|
window.omsApp.notifyManager.send(message, NotificationType.APP_NOTIFICATION);
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.innerHTML = html;
|
document.documentElement.innerHTML = html;
|
||||||
window.omsApp.state.hasChanges = false;
|
|
||||||
|
if (window.omsApp.state) {
|
||||||
|
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 ?!
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user