diff --git a/odex25_base/system_dashboard_classic/static/src/js/system_dashboard_self_service.js b/odex25_base/system_dashboard_classic/static/src/js/system_dashboard_self_service.js index 5f0e8118a..a951dff28 100644 --- a/odex25_base/system_dashboard_classic/static/src/js/system_dashboard_self_service.js +++ b/odex25_base/system_dashboard_classic/static/src/js/system_dashboard_self_service.js @@ -675,14 +675,44 @@ odoo.define('system_dashboard_classic.dashboard_self_services', function(require // Initial build of approval cards (pass full result object) buildApprovalCards(result); - // ============================================================ // ============================================================ // TAB CLICK REFRESH - Refresh data when clicking approval tabs - // Fetches fresh data while PRESERVING saved card order + // Only refreshes when coming FROM Self Services TO approval tabs + // Switching between To Approve ↔ To Track doesn't refresh (same data) // ============================================================ + var isRefreshing = false; // Prevent double refresh + + // Detect initial active tab section + var lastActiveTab = 'self_services'; // Default + if ($('a[href="#to_approve"]').parent().hasClass('active') || + $('a[href="#to_track"]').parent().hasClass('active')) { + lastActiveTab = 'approval'; + } + + // Track when user clicks Self Services tab + $('a[href="#self_services"]').on('click', function() { + lastActiveTab = 'self_services'; + }); + // Bind to approval tab clicks for data refresh $('a[href="#to_approve"], a[href="#to_track"]').off('click.refresh').on('click.refresh', function(e) { + // Only refresh when coming from Self Services tab + // Not when switching between To Approve ↔ To Track + if (lastActiveTab === 'approval') { + console.log('[Dashboard] Already in approval section, no refresh needed'); + lastActiveTab = 'approval'; // Keep it as approval + return; + } + + // Prevent double refresh + if (isRefreshing) { + console.log('[Dashboard] Refresh already in progress, skipping'); + return; + } + isRefreshing = true; + lastActiveTab = 'approval'; // Mark as in approval section + var $tab = $(this); // Show loading indicator (optional visual feedback) @@ -797,8 +827,12 @@ odoo.define('system_dashboard_classic.dashboard_self_services', function(require } console.log('[Dashboard] Approval cards refreshed on tab click'); + + // Reset flag after a short delay to allow for any animation + setTimeout(function() { isRefreshing = false; }, 500); }).catch(function(e) { console.error('[Dashboard] Error refreshing approval data:', e); + isRefreshing = false; // Reset on error too }); }); } @@ -849,6 +883,10 @@ odoo.define('system_dashboard_classic.dashboard_self_services', function(require '' + '' ); + // Add RTL class to toast if user is using Arabic + if (isRtl) { + $errorToast.find('.attendance-error-toast').addClass('rtl-toast'); + } $('body').append($errorToast); setTimeout(function() { $errorToast.addClass('show'); }, 50); @@ -932,6 +970,11 @@ odoo.define('system_dashboard_classic.dashboard_self_services', function(require '' ); + // Add RTL class to notification if user is using Arabic + if (isRtl) { + $notification.find('.attendance-notification').addClass('rtl-notification'); + } + $('body').append($notification); $('.attendance-img-section').addClass('attendance-success-pulse'); setTimeout(function() { diff --git a/odex25_base/system_dashboard_classic/static/src/scss/genius-enhancements.scss b/odex25_base/system_dashboard_classic/static/src/scss/genius-enhancements.scss index e0b4ccb18..d02e2ba8f 100644 --- a/odex25_base/system_dashboard_classic/static/src/scss/genius-enhancements.scss +++ b/odex25_base/system_dashboard_classic/static/src/scss/genius-enhancements.scss @@ -3095,11 +3095,18 @@ p.fn-section.clickable-profile:hover { } } -/* RTL Support - Notification */ -.o_rtl .attendance-notification { +/* RTL Support - Notification (Odoo Standard: .o_rtl on body) */ +.o_rtl .attendance-notification, +.attendance-notification.rtl-notification { + direction: rtl; + .notification-content { + direction: rtl; + + .notification-title, .notification-subtitle { - direction: rtl; /*rtl:ignore*/ + direction: rtl; + text-align: center; /* Keep centered but with RTL direction */ } } } @@ -3197,10 +3204,15 @@ p.fn-section.clickable-profile:hover { 80% { transform: translateX(4px); } } -/* RTL Support for Error Toast */ -.o_rtl .attendance-error-toast { +/* RTL Support for Error Toast (Odoo Standard: .o_rtl on body) */ +.o_rtl .attendance-error-toast, +.attendance-error-toast.rtl-toast { + direction: rtl; + .error-message { - direction: rtl; /*rtl:ignore*/ + direction: rtl; + text-align: center; /* Keep centered but with RTL direction */ + unicode-bidi: plaintext; /* Ensures proper Unicode bidirectional handling */ } } diff --git a/odex25_base/system_dashboard_classic/static/src/scss/rtl-cards.scss b/odex25_base/system_dashboard_classic/static/src/scss/rtl-cards.scss deleted file mode 100644 index 3fc5b0f49..000000000 --- a/odex25_base/system_dashboard_classic/static/src/scss/rtl-cards.scss +++ /dev/null @@ -1,164 +0,0 @@ -/* ============================================================ - System Dashboard Classic - RTL Styles - ============================================================ - - This file contains RTL (Right-to-Left) overrides for Arabic/Hebrew - language support. Uses .o_rtl class added by Odoo. - - IMPORTANT: This file must load AFTER all LTR styles. - ============================================================ */ - -.o_rtl { - /* === Profile Section RTL === */ - .profile-container { - .pp-info-section { - border: none; - border-right: 1px solid #9f9f9f; - padding: 10px; - } - - /* Green status dot - flip to left side */ - .pp-image-section::after { - right: auto !important; - left: 8px !important; - } - } - - /* === Module Box / Statistics RTL === */ - .module-box { - .module-box-container { - .module-body { - padding: 10px 15px 10px 10px; - - a { - background-color: transparent; - - &:hover { - text-decoration: none; - } - - h3 { - margin: 0; - transition: all .3s ease-in-out; - color: #8a8a8a; - font-size: 16px; - text-align: center; - padding-top: 5px; - } - } - - h2 { - text-align: center; - font-size: 26px; - color: #06211a; - margin-top: 5px; - } - - .module-icon { - text-align: center; - height: 80px; - width: 80px; - line-height: 80px; - border-radius: 50%; - position: absolute; - top: -40px; - right: -20px; - box-shadow: 0 3px 5px -1px rgba(0, 0, 0, .2), - 0 6px 10px 0 rgba(0, 0, 0, .14), - 0 1px 18px 0 rgba(0, 0, 0, .12) !important; - - i { - font-size: 45px; - color: #ffffff; - } - } - - .module-icon.red { background: #ee451f; } - .module-icon.green { background: #14bf1f; } - .module-icon.yellow { background: #f9d700; } - } - - /* Stat labels - reverse flex direction */ - p span { - flex-direction: row-reverse !important; - } - } - } - - /* === Card2 (Approval Cards) RTL === */ - .card2 { - padding-left: inherit; - padding-right: 0; - - .card-container .card-header { - flex-direction: row-reverse !important; - - img { - margin-right: 0 !important; - margin-left: 12px !important; - } - - h4 { - text-align: right !important; - } - } - - .card-container .card-body table tr td { - text-align: right; - - &:last-child { - text-align: left; - - div { - float: left; - } - } - } - } - - /* === Card3 (Service Cards) RTL === */ - .card3 .card-body .box-2 { - flex-direction: row-reverse !important; - - i { - margin-left: 0 !important; - margin-right: 8px !important; - } - } - - /* === Tab Navigation RTL === */ - // .dashboard-nav-buttons { - // flex-direction: row-reverse !important; - - // .nav-tabs { - // flex-direction: row-reverse !important; - // } - // } - - /* === Search Container RTL === */ - // .genius-search-container { - // margin-left: 0 !important; - // margin-right: auto !important; - // } - - .genius-search-icon { - left: auto !important; - right: 14px !important; - } - - .genius-search-input { - padding: 10px 38px 10px 40px !important; - // text-align: right !important; - } - - .genius-search-clear { - right: auto !important; - left: 14px !important; - } - - /* === Attendance Section RTL === */ - .dashboard-attendance-section { - border-left: none !important; - border-right: 1px solid rgba(255, 255, 255, 0.1) !important; - } -} diff --git a/odex25_base/system_dashboard_classic/static/src/scss/rtl-core.scss b/odex25_base/system_dashboard_classic/static/src/scss/rtl-core.scss deleted file mode 100644 index 73a957fe5..000000000 --- a/odex25_base/system_dashboard_classic/static/src/scss/rtl-core.scss +++ /dev/null @@ -1,65 +0,0 @@ -$color_1: #8a8a8a; -$color_2: #06211a; -$color_3: #ffffff; -$background-color_1: transparent; - -.o_rtl { - .profile-container { - .pp-info-section { - border: none; - border-right: 1px solid #9f9f9f; - padding: 10px; - } - } - .module-box { - .module-box-container { - .module-body { - padding: 10px 15px 10px 10px; - a { - background-color: $background-color_1; - &:hover { - text-decoration: none; - } - h3 { - margin: 0; - transition: all .3s ease-in-out; - color: $color_1; - font-size: 16px; - text-align: center; - padding-top: 5px; - } - } - h2 { - text-align: center; - font-size: 26px; - color: $color_2; - margin-top: 5px; - } - .module-icon { - text-align: center; - height: 80px; - width: 80px; - line-height: 80px; - border-radius: 50%; - position: absolute; - top: -40px; - right: -20px; - box-shadow: 0 3px 5px -1px rgba(0, 0, 0, .2), 0 6px 10px 0 rgba(0, 0, 0, .14), 0 1px 18px 0 rgba(0, 0, 0, .12) !important; - i { - font-size: 45px; - color: $color_3; - } - } - .module-icon.red { - background: #ee451f; - } - .module-icon.green { - background: #14bf1f; - } - .module-icon.yellow { - background: #f9d700; - } - } - } - } -}