PDFs erzeugen
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
@inject IUserNotificationService UserNotificationService
|
||||
@inject HttpClient Http
|
||||
@inject IDialogService DialogService
|
||||
@inject NavigationManager NavigationManager
|
||||
@implements IDisposable
|
||||
|
||||
<PageTitle>Benutzerverwaltung – Timetracker</PageTitle>
|
||||
@@ -131,6 +132,12 @@ else
|
||||
Size="Size.Small"
|
||||
OnClick="@(() => OpenResetPasswordDialog(context))" />
|
||||
</MudTooltip>
|
||||
<MudTooltip Text="Stundenzettel (PDF) herunterladen">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.PictureAsPdf"
|
||||
Color="Color.Info"
|
||||
Size="Size.Small"
|
||||
OnClick="@(() => DownloadUserPdf(context))" />
|
||||
</MudTooltip>
|
||||
@if (context.Username != "marc")
|
||||
{
|
||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline"
|
||||
@@ -297,4 +304,19 @@ else
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DownloadUserPdf(User user)
|
||||
{
|
||||
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall, FullWidth = true };
|
||||
var dialog = await DialogService.ShowAsync<MonthSelectorDialog>($"Stundenzettel für {user.Username}", options);
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (result != null && !result.Canceled && result.Data is MonthSelectorDialog.MonthSelectorResult data)
|
||||
{
|
||||
int year = data.Year;
|
||||
int month = data.Month;
|
||||
|
||||
NavigationManager.NavigateTo($"api/tracker/export/month/pdf?userId={user.Id}&year={year}&month={month}", forceLoad: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user