feat: enhance Excel export functionality with improved styling and download handling
All checks were successful
Publish Container / publish (push) Successful in 5m39s

This commit is contained in:
Marco 2026-05-20 11:34:54 +02:00
commit 8438a63bd8
3 changed files with 128 additions and 57 deletions

View file

@ -16,7 +16,7 @@
<button class="btn btn-outline-secondary btn-sm" @onclick="PreviousMonth">&laquo; Prev</button>
<h2 class="h5 mb-0">@currentMonth.ToString("MMMM yyyy")</h2>
<button class="btn btn-outline-secondary btn-sm" @onclick="NextMonth">Next &raquo;</button>
<a class="btn btn-success btn-sm ms-auto" href="@GetExcelDownloadUrl()">Download Excel</a>
<button type="button" class="btn btn-success btn-sm ms-auto" @onclick="DownloadExcelAsync">Download Excel</button>
<a class="btn btn-outline-primary btn-sm ms-auto" href="yearly-summary/@currentMonth.Year">Yearly Summary</a>
</div>
@ -278,6 +278,20 @@ else if (viewMode == SummaryViewMode.Timesheet && timesheet is not null)
viewMode = mode;
}
private async Task DownloadExcelAsync()
{
try
{
await JS.InvokeVoidAsync("workTrackerDownloads.downloadFromUrl", GetExcelDownloadUrl());
}
catch (JSDisconnectedException)
{
}
catch (TaskCanceledException)
{
}
}
private string GetExcelDownloadUrl()
{
return $"/api/monthly-timesheet/{currentMonth.Year}/{currentMonth.Month}/excel?includePreview={includePreview.ToString().ToLowerInvariant()}";