FIX: report print button

FIX: user edit button
This commit is contained in:
Frede Hundewadt 2023-05-11 09:35:25 +02:00
parent b81b2c8e75
commit 436867d86f
2 changed files with 15 additions and 10 deletions

View file

@ -57,6 +57,7 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
private UserPreference Profile { get; set; } = new(); private UserPreference Profile { get; set; } = new();
private string _returnUrl = ""; private string _returnUrl = "";
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
@ -69,6 +70,7 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
await FetchUserReport(ReportDate); await FetchUserReport(ReportDate);
} }
protected override async Task OnAfterRenderAsync(bool firstRender) protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
if (firstRender) if (firstRender)
@ -77,6 +79,8 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
.InvokeAsync<IJSObjectReference>("import", "/scripts/print-invoke.js"); .InvokeAsync<IJSObjectReference>("import", "/scripts/print-invoke.js");
} }
} }
private void Print(PrintTarget target) private void Print(PrintTarget target)
{ {
_returnUrl = new Uri(Navigator.Uri).AbsolutePath; _returnUrl = new Uri(Navigator.Uri).AbsolutePath;
@ -98,6 +102,7 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
} }
} }
private async Task PrintAll() private async Task PrintAll()
{ {
var current = 0; var current = 0;
@ -106,6 +111,7 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
var count = orders.Count(); var count = orders.Count();
foreach (var item in orders) foreach (var item in orders)
{ {
Toaster.ClearInfoToasts();
Toaster.ShowInfo($"Behandler {current++} af {count} ordrer. Vent venligst"); Toaster.ShowInfo($"Behandler {current++} af {count} ordrer. Vent venligst");
await ProcessRepo.UpdateWarehouseOrderStatus(new OrderProcessState await ProcessRepo.UpdateWarehouseOrderStatus(new OrderProcessState
{ {
@ -117,10 +123,7 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
await JsModule.InvokeVoidAsync("printInvoke"); await JsModule.InvokeVoidAsync("printInvoke");
} }
/// <summary>
/// Work date component event handler
/// </summary>
/// <param name="workDate"></param>
private async Task FetchUserReport(string workDate) private async Task FetchUserReport(string workDate)
{ {
// remove busy signal if report is empty // remove busy signal if report is empty
@ -147,10 +150,10 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
// set busy signal // set busy signal
Working = true; Working = true;
Logger.LogDebug("UserId => {}", UserId); // Logger.LogDebug("UserId => {}", UserId);
// fetch report // fetch report
Report = await ReportRepo.GetCountryReport(UserId, workDate); Report = await ReportRepo.GetCountryReport(UserId, workDate);
Logger.LogDebug("Report => {}", JsonSerializer.Serialize(Report, new JsonSerializerOptions(JsonSerializerDefaults.Web))); // Logger.LogDebug("Report => {}", JsonSerializer.Serialize(Report, new JsonSerializerOptions(JsonSerializerDefaults.Web)));
// extract activities // extract activities
Activities = Report.ReportItems.Where(x => x.Lines.Any()).ToList(); Activities = Report.ReportItems.Where(x => x.Lines.Any()).ToList();
@ -165,16 +168,18 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
Working = false; Working = false;
} }
private void ProfileServiceOnOnChange(UserPreference userPreference) private void ProfileServiceOnOnChange(UserPreference userPreference)
{ {
Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange"); // Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange");
Profile = userPreference; Profile = userPreference;
Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange => Prefs.WorkDate <= {}", Profile.WorkDate); // Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange => Prefs.WorkDate <= {}", Profile.WorkDate);
ReportDate = Profile.WorkDate; ReportDate = Profile.WorkDate;
StateHasChanged(); StateHasChanged();
} }
public void Dispose() public void Dispose()
{ {
Interceptor.DisposeEvent(); Interceptor.DisposeEvent();

View file

@ -152,7 +152,7 @@
<button type="button" class="btn btn-danger" disabled="@ReadOnly" onclick="@SendDeleteRequest">SLET</button> <button type="button" class="btn btn-danger" disabled="@ReadOnly" onclick="@SendDeleteRequest">SLET</button>
</div> </div>
<div class="col"> <div class="col">
<button type="button" class="btn btn-warning" onclick="@(() => ReadOnly = !ReadOnly)">Rediger</button> <button type="button" class="btn btn-warning" @onclick="@(() => ReadOnly = !ReadOnly)">Rediger</button>
</div> </div>
<div class="col"> <div class="col">
<button type="submit" class="btn btn-primary" disabled="@ReadOnly">Gem</button> <button type="submit" class="btn btn-primary" disabled="@ReadOnly">Gem</button>