feat: enhance Excel export functionality with improved styling and download handling
All checks were successful
Publish Container / publish (push) Successful in 5m39s
All checks were successful
Publish Container / publish (push) Successful in 5m39s
This commit is contained in:
parent
bf333c4a00
commit
8438a63bd8
3 changed files with 128 additions and 57 deletions
|
|
@ -16,7 +16,7 @@
|
|||
<button class="btn btn-outline-secondary btn-sm" @onclick="PreviousMonth">« Prev</button>
|
||||
<h2 class="h5 mb-0">@currentMonth.ToString("MMMM yyyy")</h2>
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="NextMonth">Next »</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()}";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue