diff --git a/PlanTempus.Application/Features/Employees/Components/EmployeeDetailSalary/Default.cshtml b/PlanTempus.Application/Features/Employees/Components/EmployeeDetailSalary/Default.cshtml index ff5dbc8..6df2554 100644 --- a/PlanTempus.Application/Features/Employees/Components/EmployeeDetailSalary/Default.cshtml +++ b/PlanTempus.Application/Features/Employees/Components/EmployeeDetailSalary/Default.cshtml @@ -90,110 +90,73 @@ + + + + + + @Model.LabelSpecifications + + + @foreach (var spec in Model.Specifications) + { + + + + @spec.Period + @spec.Weeks.Sum(w => w.NormalHours + w.OvertimeHours)t + + + + @spec.GrossSalaryFormatted + @Model.LabelTotal + + + + + + + + + + + + @Model.LabelWeek + Timer + Overtid + I alt + + @foreach (var week in spec.Weeks) + { + + Uge @week.WeekNumber + @week.NormalHoursFormatted + @week.OvertimeHoursFormatted + @week.TotalPayFormatted + + } + + TOTAL + @(spec.Weeks.Sum(w => w.NormalHours))t + @(spec.Weeks.Sum(w => w.OvertimeHours))t + @(spec.Weeks.Sum(w => w.TotalPay).ToString("N2", System.Globalization.CultureInfo.GetCultureInfo("da-DK"))) kr + + + + + + + Se lønberegning + + + + + } + + + - - - - @Model.LabelSpecifications - - - @foreach (var spec in Model.Specifications) - { - - - - @spec.Period - @spec.Weeks.Sum(w => w.NormalHours + w.OvertimeHours)t - - - - @spec.GrossSalaryFormatted - @Model.LabelTotal - - - - - - - - - - - @Model.LabelNormalRate: - @spec.Config.HourlyRateFormatted - - - @Model.LabelWeeklyNorm: - @spec.Config.WeeklyHoursFormatted - - - @Model.LabelOvertimeMultiplier: - @spec.Config.OvertimeFormatted - - - @Model.LabelMinimum: - @spec.Config.MinimumFormatted - - - @Model.LabelProvision: - @spec.Config.CommissionFormatted - - - - - - - - @Model.LabelWeek - Timer - Overtid - Ferie - Services - Produkter - Minimum - Provision - I alt - - @foreach (var week in spec.Weeks) - { - - Uge @week.WeekNumber - @week.NormalHoursFormatted - @week.OvertimeHoursFormatted - @week.VacationDaysFormatted - @week.ServiceRevenueFormatted - @week.ProductRevenueFormatted - @week.MinimumThresholdFormatted - @week.CommissionFormatted - @week.TotalPayFormatted - - } - - TOTAL - @(spec.Weeks.Sum(w => w.NormalHours))t - @(spec.Weeks.Sum(w => w.OvertimeHours))t - @(spec.Weeks.Sum(w => w.VacationDays)) dg - @(spec.Weeks.Sum(w => w.ServiceRevenue).ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("da-DK"))) kr - @(spec.Weeks.Sum(w => w.ProductRevenue).ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("da-DK"))) kr - - - @(spec.Weeks.Sum(w => w.Commission).ToString("N2", System.Globalization.CultureInfo.GetCultureInfo("da-DK"))) kr - @(spec.Weeks.Sum(w => w.TotalPay).ToString("N2", System.Globalization.CultureInfo.GetCultureInfo("da-DK"))) kr - - - - - - - Se lønberegning - - - - - } - - -
diff --git a/PlanTempus.Application/wwwroot/css/employees.css b/PlanTempus.Application/wwwroot/css/employees.css index d13aa53..905d38e 100644 --- a/PlanTempus.Application/wwwroot/css/employees.css +++ b/PlanTempus.Application/wwwroot/css/employees.css @@ -960,16 +960,16 @@ swp-employee-display { Reuses: swp-accordion (accordion.css), swp-data-table (components.css) =========================================== */ swp-card.salary-specifications { - margin-top: var(--spacing-8); + /* No extra margin needed when inside column */ } swp-card.salary-specifications swp-accordion { padding: 0 var(--spacing-6) var(--spacing-6); } -/* Table columns for weeks data (9 columns) */ -swp-card.salary-specifications swp-data-table.specification-weeks { - grid-template-columns: 70px repeat(8, 1fr); +/* Table columns for weeks data (4 columns - compact view) */ +swp-card.salary-specifications swp-data-table.specification-weeks-compact { + grid-template-columns: 70px 1fr 1fr 1fr; } /* Cell styling */ diff --git a/PlanTempus.Application/wwwroot/ts/modules/employees.ts b/PlanTempus.Application/wwwroot/ts/modules/employees.ts index 62642bb..d7a22fa 100644 --- a/PlanTempus.Application/wwwroot/ts/modules/employees.ts +++ b/PlanTempus.Application/wwwroot/ts/modules/employees.ts @@ -1,5 +1,5 @@ import { createChart } from '@sevenweirdpeople/swp-charting'; -import { Accordion, initAccordions } from './accordion'; +import { Accordion } from './accordion'; /** * Employees Controller @@ -93,14 +93,30 @@ export class EmployeesController { this.ratesSync = new RatesSyncController(); this.scheduleController = new ScheduleController(); this.statsController = new EmployeeStatsController(); - this.initSalaryAccordions(); + this.setupSalaryTabListener(); } /** - * Initialize salary accordions when they exist + * Listen for salary tab activation to initialize accordions + */ + private setupSalaryTabListener(): void { + document.addEventListener('click', (e: Event) => { + const target = e.target as HTMLElement; + const tab = target.closest('swp-tab[data-tab="salary"]'); + + if (tab) { + // Small delay to ensure tab content is visible + setTimeout(() => this.initSalaryAccordions(), 50); + } + }); + } + + /** + * Initialize salary tab accordions */ private initSalaryAccordions(): void { - // Initialize all accordions in the salary tab + if (this.salaryAccordions.length > 0) return; + const salaryTab = document.querySelector('swp-tab-content[data-tab="salary"]'); if (salaryTab) { salaryTab.querySelectorAll('swp-accordion').forEach(accordion => {