From 13470a1cb3c19799c90dcfc5747b4f8d12e15a0e Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Thu, 12 Feb 2026 21:06:43 +0300 Subject: [PATCH] =?utf8?q?[ERP-39]=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?utf8?q?=D0=B8=D0=B5=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= =?utf8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?utf8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=D1=83=D1=80=D1=8C=D0=B5=D1=80?= =?utf8?q?=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/web/js/shift-reminder.js | 95 +++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 31 deletions(-) diff --git a/erp24/web/js/shift-reminder.js b/erp24/web/js/shift-reminder.js index d6f708f6..5267b9a9 100644 --- a/erp24/web/js/shift-reminder.js +++ b/erp24/web/js/shift-reminder.js @@ -62,6 +62,16 @@ // Initialize Web Audio API (lazy loading to respect autoplay policies) initAudioContext(); + // Setup event delegation for confirm button (works for both server-rendered and dynamic modals) + $(document).on('click', '#shift-reminder-confirm-btn, #shift-reminder-confirm-btn-dynamic', function() { + const reminderKey = $('#shift-reminder-key').val() || $(this).data('reminder-key'); + if (reminderKey) { + confirmReminder(reminderKey); + } else { + console.error('ShiftReminder: reminder_key not found'); + } + }); + // First check on load — response will schedule the next one via next_check_at checkReminder(); } @@ -224,31 +234,44 @@ state.isModalVisible = true; - // Create modal HTML - // Create modal structure without user data (XSS protection) - const $modal = $('
').attr('id', 'shift-reminder-modal').addClass('shift-reminder-overlay'); - const $content = $('
').addClass('shift-reminder-content'); - const $icon = $('
').addClass('shift-reminder-icon').html(''); - const $title = $('

').addClass('shift-reminder-title').text('Напоминание о смене'); - const $message = $('

').addClass('shift-reminder-message'); - const $button = $('