From 097fe7f912b1b19a5cf674573797b2f17e800237 Mon Sep 17 00:00:00 2001 From: "Janus C. H. Knudsen" Date: Thu, 22 Jan 2026 00:19:19 +0100 Subject: [PATCH] Improves reports page with dynamic tab stats Reorganizes stats rows to be dynamically shown/hidden based on active tab Adds data attributes to enable tab-specific stats display Enhances tab switching logic to toggle stats rows visibility --- .../Features/Reports/Pages/Index.cshtml | 78 +++++++++---------- .../wwwroot/ts/modules/reports.ts | 6 ++ 2 files changed, 45 insertions(+), 39 deletions(-) diff --git a/PlanTempus.Application/Features/Reports/Pages/Index.cshtml b/PlanTempus.Application/Features/Reports/Pages/Index.cshtml index 1759269..74c5f36 100644 --- a/PlanTempus.Application/Features/Reports/Pages/Index.cshtml +++ b/PlanTempus.Application/Features/Reports/Pages/Index.cshtml @@ -19,26 +19,9 @@ - - - - - - Salgsrapport - - - - Timerapport - - - - - - - - - + + 12.450 kr Omsætning i dag @@ -57,6 +40,43 @@ + + + + 320 t + Planlagte timer + + + 24 t + Fravær total + + + 8 t + Overarbejde + + + 7.5% + Fraværsprocent + + + + + + + + + Salgsrapport + + + + Timerapport + + + + + + + @@ -393,26 +413,6 @@ - - - - 320 t - Planlagte timer - - - 24 t - Fravær total - - - 8 t - Overarbejde - - - 7.5% - Fraværsprocent - - - diff --git a/PlanTempus.Application/wwwroot/ts/modules/reports.ts b/PlanTempus.Application/wwwroot/ts/modules/reports.ts index 29aeff4..0f12a5b 100644 --- a/PlanTempus.Application/wwwroot/ts/modules/reports.ts +++ b/PlanTempus.Application/wwwroot/ts/modules/reports.ts @@ -318,6 +318,7 @@ export class ReportsController { private switchToTab(targetTab: string): void { const tabs = document.querySelectorAll('swp-tab[data-tab]'); const contents = document.querySelectorAll('swp-tab-content[data-tab]'); + const statsRows = document.querySelectorAll('swp-stats-row[data-for-tab]'); tabs.forEach(t => { t.classList.toggle('active', t.dataset.tab === targetTab); @@ -326,6 +327,11 @@ export class ReportsController { contents.forEach(content => { content.classList.toggle('active', content.dataset.tab === targetTab); }); + + // Toggle stats rows based on active tab + statsRows.forEach(stats => { + stats.classList.toggle('active', stats.dataset.forTab === targetTab); + }); } /**