diff --git a/resources/js/src/database/events.ts b/resources/js/src/database/events.ts index 8123e937c4..50598aee52 100644 --- a/resources/js/src/database/events.ts +++ b/resources/js/src/database/events.ts @@ -15,11 +15,6 @@ AJAX.registerTeardown('database/events.js', function () { }); const DatabaseEvents = { - /** - * @var $ajaxDialog Query object containing the reference to the - * dialog that contains the editor - */ - $ajaxDialog: null, /** * @var syntaxHiglighter Reference to the codemirror editor */ @@ -176,24 +171,10 @@ const DatabaseEvents = { // We have successfully fetched the editor form ajaxRemoveMessage($msg); - /** - * @var buttonOptions Object containing options - * for jQueryUI dialog buttons - */ - var buttonOptions = { - [window.Messages.strGo]: { - text: window.Messages.strGo, - class: 'btn btn-primary', - }, - [window.Messages.strClose]: { - text: window.Messages.strClose, - class: 'btn btn-secondary', - }, - }; - // Now define the function that is called when - // the user presses the "Go" button - // @ts-ignore - buttonOptions[window.Messages.strGo].click = function () { + + let isEditMode = false; + + function eventsEditorModalSaveEventHandler () { // Move the data from the codemirror editor back to the // textarea, where it can be used in the form submission. if (typeof window.CodeMirror !== 'undefined') { @@ -221,10 +202,10 @@ const DatabaseEvents = { // Item created successfully ajaxRemoveMessage($msg); slidingMessage(data.message); - that.$ajaxDialog.dialog('close'); + window.bootstrap.Modal.getOrCreateInstance('#eventsEditorModal').hide(); // If we are in 'edit' mode, we must // remove the reference to the old row. - if (mode === 'edit' && $editRow !== null) { + if (isEditMode && $editRow !== null) { $editRow.remove(); } @@ -317,75 +298,61 @@ const DatabaseEvents = { } Navigation.reload(); - }); // end $.post() - } // end "if (that.validate())" - }; // end of function that handles the submission of the Editor - - // @ts-ignore - buttonOptions[window.Messages.strClose].click = function () { - $(this).dialog('close'); - }; - - /** - * Display the dialog to the user - */ - that.$ajaxDialog = $('