Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion timesheetweek_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1572,14 +1572,18 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
echo '<div class="div-table-responsive grille-saisie-temps-wrapper">';
// EN: Scope the vertical and horizontal centering helper to the specific cells that need alignment (days/zones/baskets/hours/totals).
echo '<style>';
echo ':root { --tw-grid-top-gap: 0px; }';
echo ':root { --tw-grid-top-gap: 0px; --tw-project-task-bg: #f5f5f5; }';
echo '.grille-saisie-temps-wrapper { max-height: 70vh; overflow-y: auto; overflow-x: auto; position: relative; }';
echo '.grille-saisie-temps-wrapper.sticky-active { max-height: calc(100vh - var(--tw-grid-top-gap, 0px)); position: sticky; top: var(--tw-grid-top-gap, 0px); z-index: 4; }';
echo '.grille-saisie-temps .cellule-jour,';
echo '.grille-saisie-temps .cellule-zone-panier,';
echo '.grille-saisie-temps .cellule-temps,';
echo '.grille-saisie-temps .cellule-total { vertical-align: middle; text-align: center; }';
echo '.grille-saisie-temps .col-project-task { position: sticky; left: 0; z-index: 20; }';
echo '.grille-saisie-temps .col-project-task,';
echo '.grille-saisie-temps .col-summary-sticky,';
echo '.grille-saisie-temps .col-project-task-filler,';
echo '.grille-saisie-temps .trforbreak { background-color: var(--tw-project-task-bg); }';
echo '.grille-saisie-temps .col-summary-sticky { position: sticky; left: 0; z-index: 8; }';
echo '.grille-saisie-temps .liste_titre .col-project-task { z-index: 21; }';
echo '.grille-saisie-temps .liste_titre .col-summary-sticky { z-index: 9; }';
Expand All @@ -1594,6 +1598,24 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
echo '(function($){';
echo '$(function(){';
echo "\tvar \$wrapper = $('.grille-saisie-temps-wrapper');";
echo "\tvar projectTaskBgCache = null;";
echo "\tfunction applyProjectTaskBackground() {";
echo "\t\tvar bgColor = '';";
echo "\t\tvar \$localTitle = $('.grille-saisie-temps .liste_titre').first();";
echo "\t\tif (\$localTitle.length) {";
echo "\t\t\tbgColor = window.getComputedStyle(\$localTitle[0]).backgroundColor;";
echo "\t\t}";
echo "\t\tif (!bgColor || bgColor === 'rgba(0, 0, 0, 0)' || bgColor === 'transparent') {";
echo "\t\t\tvar \$globalTitle = $('.liste_titre').first();";
echo "\t\t\tif (\$globalTitle.length) {";
echo "\t\t\t\tbgColor = window.getComputedStyle(\$globalTitle[0]).backgroundColor;";
echo "\t\t\t}";
echo "\t\t}";
echo "\t\tif (bgColor && bgColor !== 'rgba(0, 0, 0, 0)' && bgColor !== 'transparent' && bgColor !== projectTaskBgCache) {";
echo "\t\t\tprojectTaskBgCache = bgColor;";
echo "\t\t\tdocument.documentElement.style.setProperty('--tw-project-task-bg', bgColor);";
echo "\t\t}";
echo "\t}";
echo "\tif (!\$wrapper.length) { return; }";
echo "\tvar currentTopGap = 0;";
echo "\tfunction updateGridTopGap() {";
Expand Down Expand Up @@ -1625,12 +1647,26 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
echo "\t\tvar bottomVisible = rect.bottom <= window.innerHeight;";
echo "\t\ttoggleStickyState(!bottomVisible);";
echo "\t}";
echo "\tvar htmlTarget = document.documentElement;";
echo "\tvar bodyTarget = document.body;";
echo "\tupdateGridTopGap();";
echo "\tapplyProjectTaskBackground();";
echo "\tupdateStickyPosition();";
echo "\t$(window).on('resize scroll', function(){";
echo "\t\tupdateGridTopGap();";
echo "\t\tapplyProjectTaskBackground();";
echo "\t\tupdateStickyPosition();";
echo "\t});";
echo "\tvar observerConfig = { attributes: true, attributeFilter: ['class'] };";
echo "\tvar themeObserver = new MutationObserver(function(){";
echo "\t\tapplyProjectTaskBackground();";
echo "\t});";
echo "\tif (htmlTarget) {";
echo "\t\tthemeObserver.observe(htmlTarget, observerConfig);";
echo "\t}";
echo "\tif (bodyTarget) {";
echo "\t\tthemeObserver.observe(bodyTarget, observerConfig);";
echo "\t}";
echo '});';
echo '})(jQuery);';
echo '</script>';
Expand Down