From 02c60942c69ec21db247b0dbe00f760a7a7ff752 Mon Sep 17 00:00:00 2001 From: Haris Macic Date: Fri, 20 Feb 2026 16:54:41 +0100 Subject: [PATCH 1/3] [#5976] Add another jquery call to work around the existing edittimemodal --- .../Timesheets/Js/timesheetsController.js | 85 +++++++++++++------ .../Timesheets/Templates/editTime.tpl.php | 11 ++- 2 files changed, 68 insertions(+), 28 deletions(-) diff --git a/app/Domain/Timesheets/Js/timesheetsController.js b/app/Domain/Timesheets/Js/timesheetsController.js index d4e4a16682..5c8d2085cc 100644 --- a/app/Domain/Timesheets/Js/timesheetsController.js +++ b/app/Domain/Timesheets/Js/timesheetsController.js @@ -105,37 +105,68 @@ leantime.timesheetsController = (function () { }); }; - var initEditTimeModal = function () { - var canvasoptions = { - sizes: { - minW: 700, - maxW: 1000, - minH: 1000, - }, - resizable: false, - autoSizable: false, - callbacks: { - beforeShowCont: function () { - jQuery(".showDialogOnLoad").show(); - - if (closeModal === true) { - closeModal = false; - location.reload(); - } - }, - beforeClose: function () { +var isReady = false; +var pendingClick = null; + +document.addEventListener('click', function(e) { + var target = e.target.closest('.editTimeModal'); + if (target && !isReady) { + e.preventDefault(); + e.stopPropagation(); + + target.style.opacity = '0.5'; + target.style.cursor = 'wait'; + + pendingClick = target; + } +}, true); + +function initWhenReady() { + initEditTimeModal(); + isReady = true; + + if (pendingClick) { + var $pending = jQuery(pendingClick); + pendingClick.style.opacity = ''; + pendingClick.style.cursor = ''; + $pending.trigger('click'); + pendingClick = null; + } +} + +var initEditTimeModal = function () { + var canvasoptions = { + sizes: { + minW: 700, + maxW: 1000, + minH: 1000, + }, + resizable: false, + autoSizable: false, + callbacks: { + beforeShowCont: function () { + jQuery(".showDialogOnLoad").show(); + + if (closeModal === true) { + closeModal = false; location.reload(); } }, - titleFromIframe: true - }; - - jQuery(document).on('click', '.editTimeModal', function (e) { - e.preventDefault(); - jQuery(this).nyroModal(canvasoptions); - }); + beforeClose: function () { + location.reload(); + } + }, + titleFromIframe: true }; + jQuery(document).on('click', 'a.editTimeModal', function (e) { + if (!isReady) return; + e.preventDefault(); + jQuery(this).nyroModal(canvasoptions); + }); +}; + +initWhenReady(); var formatHours = function (hours) { var hoursFormat = jQuery('.timesheetTable').data('hours-format') || @@ -196,4 +227,4 @@ leantime.timesheetsController = (function () { initEditTimeModal: initEditTimeModal, formatHours: formatHours, }; -})(); +})(); \ No newline at end of file diff --git a/app/Domain/Timesheets/Templates/editTime.tpl.php b/app/Domain/Timesheets/Templates/editTime.tpl.php index dcc61059d4..0baaeb8613 100644 --- a/app/Domain/Timesheets/Templates/editTime.tpl.php +++ b/app/Domain/Timesheets/Templates/editTime.tpl.php @@ -50,12 +50,21 @@ weekHeader: leantime.i18n.__("language.weekHeader"), }); }); + jQuery("#editTimeForm").on("submit", function(e) { + e.preventDefault(); + jQuery.post(jQuery(this).attr("action"), jQuery(this).serialize(), function() { + if (window.parent && window.parent.jQuery) { + window.parent.location.reload(); + } + }); }); +}); + displayNotification() ?>

__('headlines.edit_todo'); ?>

-
+