diff --git a/Wonky.Client/Components/OfficeReportListComponent.razor b/Wonky.Client/Components/OfficeReportListComponent.razor
index d40b9027..6ada16cd 100644
--- a/Wonky.Client/Components/OfficeReportListComponent.razor
+++ b/Wonky.Client/Components/OfficeReportListComponent.razor
@@ -40,7 +40,7 @@
{
@foreach (var report in ReportList)
{
-
+
}
}
else
diff --git a/Wonky.Client/Components/OfficeReportListComponent.razor.cs b/Wonky.Client/Components/OfficeReportListComponent.razor.cs
index 463369d9..6a600719 100644
--- a/Wonky.Client/Components/OfficeReportListComponent.razor.cs
+++ b/Wonky.Client/Components/OfficeReportListComponent.razor.cs
@@ -20,10 +20,20 @@ namespace Wonky.Client.Components;
public partial class OfficeReportListComponent
{
+ // ##################################################################
[Parameter] public List ReportList { get; set; } = new();
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "";
[Parameter] public EventCallback OnShowReport { get; set; }
+
+
+ protected override void OnParametersSet()
+ {
+ if (ReportList.Any())
+ ReportList = ReportList.OrderByDescending(x => x.ReportDate).ToList();
+ }
+
+
private void ShowThisReport(string reportDate)
{
OnShowReport.InvokeAsync(reportDate);
diff --git a/Wonky.Client/Components/ProcessStateComponent.razor.cs b/Wonky.Client/Components/ProcessStateComponent.razor.cs
index 72225438..984e8061 100644
--- a/Wonky.Client/Components/ProcessStateComponent.razor.cs
+++ b/Wonky.Client/Components/ProcessStateComponent.razor.cs
@@ -30,7 +30,7 @@ public partial class ProcessStateComponent
"the-bad" => "file-earmark-check",
"the-ugly" => "box2-fill",
"the-dead" => "truck",
- "accepted" => "printer",
+ "printed" => "printer",
_ => "question-square"
};
}
diff --git a/Wonky.Client/Components/ReportActivityListComponent.razor b/Wonky.Client/Components/ReportActivityListComponent.razor
new file mode 100644
index 00000000..ed407702
--- /dev/null
+++ b/Wonky.Client/Components/ReportActivityListComponent.razor
@@ -0,0 +1,74 @@
+@* Copyright (C) 2022 FCS Frede's Computer Services.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+*@
+
+
+@using Wonky.Client.Helpers
+
+@if (ActivityList.Any())
+{
+
@if (Working)
{
-
+
}
-
+
\ No newline at end of file
diff --git a/Wonky.Client/Pages/AdvisorReportCreatePage.razor.cs b/Wonky.Client/Pages/AdvisorReportCreatePage.razor.cs
index a7515bf9..d7455de9 100644
--- a/Wonky.Client/Pages/AdvisorReportCreatePage.razor.cs
+++ b/Wonky.Client/Pages/AdvisorReportCreatePage.razor.cs
@@ -31,6 +31,7 @@ namespace Wonky.Client.Pages;
public partial class AdvisorReportCreatePage : IDisposable
{
+ // ##########################################################################
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
@@ -38,6 +39,10 @@ public partial class AdvisorReportCreatePage : IDisposable
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger Logger { get; set; }
[Inject] public IToastService Toaster { get; set; }
+ [Inject] public IUserInfoService UserInfo { get; set; }
+
+
+ // ##########################################################################
private EditContext ReportContext { get; set; }
private ReportDto Report { get; set; } = new();
private List Activities { get; set; } = new();
@@ -56,6 +61,8 @@ public partial class AdvisorReportCreatePage : IDisposable
private string WorkDate { get; set; } = "";
private int CurrKmMonth { get; set; }
private int CurrKmPrivate { get; set; }
+ private bool IsSupervisor { get; set; }
+
///
/// OnInitialized
@@ -64,6 +71,8 @@ public partial class AdvisorReportCreatePage : IDisposable
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
+
+ IsSupervisor = await UserInfo.IsSupervisor();
ReportContext = new EditContext(Report);
ReportContext.OnFieldChanged += HandleFieldChanged;
diff --git a/Wonky.Client/Pages/Index.razor b/Wonky.Client/Pages/Index.razor
index d1402259..bb293e45 100644
--- a/Wonky.Client/Pages/Index.razor
+++ b/Wonky.Client/Pages/Index.razor
@@ -16,7 +16,7 @@
@using Wonky.Client.Components;
@using Microsoft.AspNetCore.Authorization
-@attribute [Authorize(Roles = "Admin,Advisor,Office,Supervisor,Warehouse")]
+@attribute [Authorize(Roles = "Admin,Advisor,Management,Office,Supervisor,Warehouse")]
@page "/"
@page "/index"
@page "/home"
@@ -25,7 +25,7 @@
-
+
diff --git a/Wonky.Client/Pages/OfficeUserAdvisorListPage.razor b/Wonky.Client/Pages/OfficeAdvisorListPage.razor
similarity index 100%
rename from Wonky.Client/Pages/OfficeUserAdvisorListPage.razor
rename to Wonky.Client/Pages/OfficeAdvisorListPage.razor
diff --git a/Wonky.Client/Pages/OfficeUserAdvisorListPage.razor.cs b/Wonky.Client/Pages/OfficeAdvisorListPage.razor.cs
similarity index 97%
rename from Wonky.Client/Pages/OfficeUserAdvisorListPage.razor.cs
rename to Wonky.Client/Pages/OfficeAdvisorListPage.razor.cs
index 01874e90..1cecfd56 100644
--- a/Wonky.Client/Pages/OfficeUserAdvisorListPage.razor.cs
+++ b/Wonky.Client/Pages/OfficeAdvisorListPage.razor.cs
@@ -24,7 +24,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
-public partial class OfficeUserAdvisorListPage :IDisposable
+public partial class OfficeAdvisorListPage :IDisposable
{
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; }
diff --git a/Wonky.Client/Pages/OfficeUserAdvisorReportListPage.razor b/Wonky.Client/Pages/OfficeAdvisorReportListPage.razor
similarity index 100%
rename from Wonky.Client/Pages/OfficeUserAdvisorReportListPage.razor
rename to Wonky.Client/Pages/OfficeAdvisorReportListPage.razor
diff --git a/Wonky.Client/Pages/OfficeUserAdvisorReportListPage.razor.cs b/Wonky.Client/Pages/OfficeAdvisorReportListPage.razor.cs
similarity index 97%
rename from Wonky.Client/Pages/OfficeUserAdvisorReportListPage.razor.cs
rename to Wonky.Client/Pages/OfficeAdvisorReportListPage.razor.cs
index a0c6d8f5..68d33841 100644
--- a/Wonky.Client/Pages/OfficeUserAdvisorReportListPage.razor.cs
+++ b/Wonky.Client/Pages/OfficeAdvisorReportListPage.razor.cs
@@ -23,11 +23,11 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
-public partial class OfficeUserAdvisorReportListPage : IDisposable
+public partial class OfficeAdvisorReportListPage : IDisposable
{
// #############################################################
- [Inject] public ICountryReportRepository ReportRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
+ [Inject] public ICountryReportRepository ReportRepo { get; set; }
[Inject] public IOfficeUserInfoRepository UserRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
diff --git a/Wonky.Client/Pages/SupervisorAdvisorReportViewPage.razor b/Wonky.Client/Pages/SupervisorAdvisorReportViewPage.razor
new file mode 100644
index 00000000..e9e97500
--- /dev/null
+++ b/Wonky.Client/Pages/SupervisorAdvisorReportViewPage.razor
@@ -0,0 +1,47 @@
+@* Copyright (C) 2022 FCS Frede's Computer Services.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+*@
+
+@using Wonky.Client.Components
+@using Microsoft.AspNetCore.Authorization
+@attribute [Authorize(Roles = "Admin,Management,Supervisor")]
+@page "/supervisor/advisors/{UserId}/reports/{ReportDate}"
+
+
diff --git a/Wonky.Client/Pages/SupervisorAdvisorReportViewPage.razor.cs b/Wonky.Client/Pages/SupervisorAdvisorReportViewPage.razor.cs
new file mode 100644
index 00000000..ac27c00f
--- /dev/null
+++ b/Wonky.Client/Pages/SupervisorAdvisorReportViewPage.razor.cs
@@ -0,0 +1,188 @@
+// Copyright (C) 2022 FCS Frede's Computer Services.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+
+using System.Text.Json;
+using Blazored.LocalStorage;
+using Blazored.Toast.Services;
+using Microsoft.AspNetCore.Components;
+using Microsoft.JSInterop;
+using Wonky.Client.Helpers;
+using Wonky.Client.HttpInterceptors;
+using Wonky.Client.HttpRepository;
+using Wonky.Client.Local.Services;
+using Wonky.Client.Models;
+using Wonky.Entity.DTO;
+using Wonky.Entity.Views;
+#pragma warning disable CS8618
+
+namespace Wonky.Client.Pages;
+
+public partial class SupervisorAdvisorReportViewPage : IDisposable
+{
+ // #############################################################
+ [Inject] public HttpInterceptorService Interceptor { get; set; }
+ [Inject] public ICountryReportRepository ReportRepo { get; set; }
+ [Inject] public NavigationManager Navigator { get; set; }
+ [Inject] public ILogger Logger { get; set; }
+ [Inject] public ILocalStorageService Storage { get; set; }
+ [Inject] public UserPreferenceService PreferenceService { get; set; }
+ [Inject] public IJSRuntime JsRuntime { get; set; }
+ [Inject] public IToastService Toaster { get; set; }
+ [Inject] public IOrderProcessRepository ProcessRepo { get; set; }
+
+
+ // #############################################################
+ [Parameter] public string CountryCode { get; set; } = "";
+ [Parameter] public string UserId { get; set; } = "";
+ [Parameter] public string ReportDate { get; set; } = "";
+
+
+ // #############################################################
+ private IJSObjectReference JsModule { get; set; }
+ private ReportView Report { get; set; } = new();
+ private List Activities { get; set; } = new();
+ private bool Working { get; set; } = true;
+ private UserPreference Profile { get; set; } = new();
+ private string _returnUrl = "";
+
+
+ protected override async Task OnParametersSetAsync()
+ {
+ Interceptor.RegisterEvent();
+ Interceptor.RegisterBeforeSendEvent();
+
+ PreferenceService.OnChange += ProfileServiceOnOnChange;
+
+ await PreferenceService.SetWorkDate(DateTime.Parse(ReportDate));
+
+ await FetchUserReport(ReportDate);
+ }
+
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ if (firstRender)
+ {
+ JsModule = await JsRuntime
+ .InvokeAsync("import", "/scripts/print-invoke.js");
+ }
+ }
+
+
+ // private void Print(PrintTarget target)
+ // {
+ // _returnUrl = new Uri(Navigator.Uri).AbsolutePath;
+ // switch (target)
+ // {
+ // case PrintTarget.OrderPage:
+ // Navigator.NavigateTo($"/report/print/orders/{CountryCode}/{UserId}/{ReportDate}?returnUrl={_returnUrl}");
+ // break;
+ // case PrintTarget.FrontPage:
+ // Navigator.NavigateTo($"/report/print/summary/{CountryCode}/{UserId}/{ReportDate}?returnUrl={_returnUrl}");
+ // break;
+ // case PrintTarget.None:
+ // break;
+ // case PrintTarget.All:
+ // break;
+ // default:
+ // throw new ArgumentOutOfRangeException(nameof(target), target, null);
+ // }
+ // }
+ //
+ //
+ // private async Task Print()
+ // {
+ // var current = 0;
+ // var orders = Report.ReportItems
+ // .Where(x => x is { StatusTypeEnum: "Order", ProcessStatusEnum: "None" } );
+ // var count = orders.Count();
+ // foreach (var item in orders)
+ // {
+ // Toaster.ShowInfo($"Behandler {current++} af {count} ordrer. Vent venligst");
+ // await ProcessRepo.UpdateWarehouseOrderStatus(new OrderProcessState
+ // {
+ // OrderId = item.ActivityId,
+ // ProcessStatusEnum = Utils.EnumToString(ProcessStatus.Printed)
+ // });
+ // }
+ // Toaster.ClearAll();
+ // await JsModule.InvokeVoidAsync("printInvoke");
+ // }
+
+ ///
+ /// Work date component event handler
+ ///
+ ///
+ private async Task FetchUserReport(string workDate)
+ {
+ // remove busy signal if report is empty
+ if (string.IsNullOrWhiteSpace(Report.ReportData.ReportDate))
+ {
+ Working = false;
+ }
+
+ ReportDate = workDate;
+
+ // ensure the browser address bar contains the correct link
+ Navigator.NavigateTo($"/supervisor/advisors/{UserId}/reports/{workDate}", false, true);
+
+ // return if we are already at it
+ if (Working)
+ {
+ return;
+ }
+
+ // reset variables
+ Report = new ReportView();
+ Activities = new List();
+
+ // set busy signal
+ Working = true;
+
+ Logger.LogDebug("UserId => {}", UserId);
+ // fetch report
+ Report = await ReportRepo.GetCountryReport(UserId, workDate);
+ Logger.LogDebug("Report => {}", JsonSerializer.Serialize(Report, new JsonSerializerOptions(JsonSerializerDefaults.Web)));
+
+ // extract activities
+ Activities = Report.ReportItems.Where(x => x.Lines.Any()).ToList();
+
+ // store locally
+ if (!string.IsNullOrWhiteSpace(Report.ReportData.ReportDate))
+ {
+ await Storage.SetItemAsync($"{UserId}-{workDate}", Report);
+ }
+
+ // remove busy signal
+ Working = false;
+ }
+
+ private void ProfileServiceOnOnChange(UserPreference userPreference)
+ {
+ Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange");
+ Profile = userPreference;
+ Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange => Prefs.WorkDate <= {}", Profile.WorkDate);
+ ReportDate = Profile.WorkDate;
+
+ StateHasChanged();
+ }
+
+ public void Dispose()
+ {
+ Interceptor.DisposeEvent();
+ PreferenceService.OnChange -= ProfileServiceOnOnChange;
+ }
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/SupervisorAdvisorViewPage.razor b/Wonky.Client/Pages/SupervisorAdvisorViewPage.razor
new file mode 100644
index 00000000..cfba7bd7
--- /dev/null
+++ b/Wonky.Client/Pages/SupervisorAdvisorViewPage.razor
@@ -0,0 +1,34 @@
+@* Copyright (C) 2022 FCS Frede's Computer Services.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+*@
+
+@using Microsoft.AspNetCore.Authorization
+@using Wonky.Client.Components
+@attribute [Authorize(Roles = "Admin,Management,Supervisor")]
+@page "/supervisor/advisors/{UserId}"
+
+Rapport Arkiv @AdvisorInfo.FirstName @AdvisorInfo.LastName
+
+
+
+ Rapport Arkiv - @AdvisorInfo.FirstName @AdvisorInfo.LastName
+
+
+@code {
+
+ private bool collapseNavMenu = true;
+
+ private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
+
+ private void ToggleNavMenu()
+ {
+ collapseNavMenu = !collapseNavMenu;
+ }
+
+
+}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/NavMenu-backup.razor.css b/Wonky.Client/Shared/NavMenu-backup.razor.css
new file mode 100644
index 00000000..dfecd000
--- /dev/null
+++ b/Wonky.Client/Shared/NavMenu-backup.razor.css
@@ -0,0 +1,81 @@
+/* Copyright (C) 2022 FCS Frede's Computer Services.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+*/
+.navbar-toggler {
+ background-color: rgba(255, 255, 255, 0.1);
+}
+
+.top-row {
+ height: 3.5rem;
+ background-color: rgba(0,0,0,0.4);
+}
+
+.navbar-brand {
+ font-size: 1.1rem;
+}
+
+.oi {
+ width: 2rem;
+ font-size: 1.1rem;
+ vertical-align: text-top;
+ top: -2px;
+}
+
+.nav-item {
+ font-size: 0.9rem;
+ padding-bottom: 0.5rem;
+}
+
+ .nav-item:first-of-type {
+ padding-top: 1rem;
+ }
+
+ .nav-item:last-of-type {
+ padding-bottom: 1rem;
+ }
+
+ .nav-item ::deep a {
+ color: #d7d7d7;
+ border-radius: 4px;
+ height: 3rem;
+ display: flex;
+ align-items: center;
+ line-height: 3rem;
+ }
+
+.nav-item ::deep a.active {
+ background-color: rgba(255,255,255,0.25);
+ color: white;
+}
+
+.nav-item ::deep a:hover {
+ background-color: rgba(255,255,255,0.1);
+ color: white;
+}
+
+.list-group.panel > .list-group-item {
+ border-bottom-right-radius: 4px;
+ border-bottom-left-radius: 4px;
+}
+
+@media (min-width: 1025px) {
+ .navbar-toggler {
+ display: none;
+ }
+
+ .collapse {
+ /* Never collapse the sidebar for wide screens */
+ display: block;
+ }
+}
diff --git a/Wonky.Client/Shared/NavMenu.razor b/Wonky.Client/Shared/NavMenu.razor
index 4770cef0..04da225b 100644
--- a/Wonky.Client/Shared/NavMenu.razor
+++ b/Wonky.Client/Shared/NavMenu.razor
@@ -72,6 +72,15 @@