wip - supervisor

This commit is contained in:
Frede Hundewadt 2023-03-19 13:45:57 +01:00
parent bc22649172
commit 730ccedc56
45 changed files with 277 additions and 212 deletions

View file

@ -22,20 +22,21 @@
</div> </div>
@code { @code {
#pragma warning disable CS8618
[Inject] public UserProfileService ProfileService { get; set; }
[Inject] public UserPreferenceService PreferenceService { get; set; }
private int KmMorning { get; set; } private int KmMorning { get; set; }
private UserProfile Profiles { get; set; } = new(); private UserPreference Preferences { get; set; } = new();
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Profiles = await ProfileService.GetProfile(); Preferences = await PreferenceService.GetProfile();
KmMorning = Profiles.KmMorning; KmMorning = Preferences.KmMorning;
} }
private async Task OnKmChanged() private async Task OnKmChanged()
{ {
await ProfileService.SetKmMorning(KmMorning); await PreferenceService.SetKmMorning(KmMorning);
} }
} }

View file

@ -30,7 +30,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components; namespace Wonky.Client.Components;
public partial class AdvisorLandingComponent public partial class AdvisorLandingComponent
{ {
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
private readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions private readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions
{ {
@ -38,12 +38,12 @@ public partial class AdvisorLandingComponent
PropertyNamingPolicy = JsonNamingPolicy.CamelCase PropertyNamingPolicy = JsonNamingPolicy.CamelCase
}; };
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
private DateTime SelectedDate { get; set; } private DateTime SelectedDate { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
SelectedDate = string.IsNullOrWhiteSpace(Profiles.WorkDate) ? DateTime.Now : DateTime.Parse(Profiles.WorkDate); SelectedDate = string.IsNullOrWhiteSpace(Profiles.WorkDate) ? DateTime.Now : DateTime.Parse(Profiles.WorkDate);
} }

View file

@ -23,10 +23,10 @@ namespace Wonky.Client.Components;
public partial class CatalogGroupComponent public partial class CatalogGroupComponent
{ {
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Parameter] public EventCallback<string> OnChanged { get; set; } [Parameter] public EventCallback<string> OnChanged { get; set; }
private Dictionary<string, string> Items { get; set; } = new(); private Dictionary<string, string> Items { get; set; } = new();
private UserProfile _profiles = new(); private UserPreference _profiles = new();
private string? GroupCol { get; set; } private string? GroupCol { get; set; }

View file

@ -24,7 +24,7 @@ public partial class CatalogSearchComponent : IDisposable
/// <summary> /// <summary>
/// User preference service /// User preference service
/// </summary> /// </summary>
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
/// <summary> /// <summary>
/// OnChanged event callback /// OnChanged event callback
@ -34,7 +34,7 @@ public partial class CatalogSearchComponent : IDisposable
/// <summary> /// <summary>
/// User preferences /// User preferences
/// </summary> /// </summary>
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
/// <summary> /// <summary>
/// Selected item /// Selected item
@ -46,8 +46,8 @@ public partial class CatalogSearchComponent : IDisposable
/// </summary> /// </summary>
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
SearchCol = Profiles.ItemSearch; SearchCol = Profiles.ItemSearch;
await OnChanged.InvokeAsync(SearchCol); await OnChanged.InvokeAsync(SearchCol);
} }
@ -61,16 +61,16 @@ public partial class CatalogSearchComponent : IDisposable
var val = e.Value.ToString(); var val = e.Value.ToString();
if (val == "-1") return; if (val == "-1") return;
await OnChanged.InvokeAsync(val); await OnChanged.InvokeAsync(val);
await ProfileService.SetItemSearch(val); await PreferenceService.SetItemSearch(val);
} }
/// <summary> /// <summary>
/// Preference update from profile service /// Preference update from profile service
/// </summary> /// </summary>
/// <param name="newUserProfile"></param> /// <param name="newUserPreference"></param>
private void ProfileServiceOnOnChange(UserProfile newUserProfile) private void ProfileServiceOnOnChange(UserPreference newUserPreference)
{ {
Profiles = newUserProfile; Profiles = newUserPreference;
StateHasChanged(); StateHasChanged();
} }
@ -79,6 +79,6 @@ public partial class CatalogSearchComponent : IDisposable
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -24,7 +24,7 @@ public partial class CatalogSortComponent : IDisposable
/// <summary> /// <summary>
/// User preference service /// User preference service
/// </summary> /// </summary>
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
/// <summary> /// <summary>
/// OnChanged callback function /// OnChanged callback function
@ -34,7 +34,7 @@ public partial class CatalogSortComponent : IDisposable
/// <summary> /// <summary>
/// User's preferences /// User's preferences
/// </summary> /// </summary>
private UserProfile _profiles = new(); private UserPreference _profiles = new();
/// <summary> /// <summary>
/// Item selected by user /// Item selected by user
@ -46,8 +46,8 @@ public partial class CatalogSortComponent : IDisposable
/// </summary> /// </summary>
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
_profiles = await ProfileService.GetProfile(); _profiles = await PreferenceService.GetProfile();
SortCol = _profiles.ItemSort; SortCol = _profiles.ItemSort;
} }
@ -60,16 +60,16 @@ public partial class CatalogSortComponent : IDisposable
var val = e.Value.ToString(); var val = e.Value.ToString();
if (val == "-1") return; if (val == "-1") return;
await OnChanged.InvokeAsync(val); await OnChanged.InvokeAsync(val);
await ProfileService.SetItemSort(val); await PreferenceService.SetItemSort(val);
} }
/// <summary> /// <summary>
/// Get updated settings from preference service /// Get updated settings from preference service
/// </summary> /// </summary>
/// <param name="newUserProfile"></param> /// <param name="newUserPreference"></param>
private void ProfileServiceOnOnChange(UserProfile newUserProfile) private void ProfileServiceOnOnChange(UserPreference newUserPreference)
{ {
_profiles = newUserProfile; _profiles = newUserPreference;
StateHasChanged(); StateHasChanged();
} }
@ -78,6 +78,6 @@ public partial class CatalogSortComponent : IDisposable
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -24,15 +24,15 @@ namespace Wonky.Client.Components;
public partial class CustomerSearchColumnComponent : IDisposable public partial class CustomerSearchColumnComponent : IDisposable
{ {
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Parameter] public EventCallback<string> OnChanged { get; set; } [Parameter] public EventCallback<string> OnChanged { get; set; }
private Dictionary<string, string> Items { get; set; } = new(); private Dictionary<string, string> Items { get; set; } = new();
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
private string SearchCol { get; set; } = "name"; private string SearchCol { get; set; } = "name";
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
SearchCol = Profiles.CompanySearch; SearchCol = Profiles.CompanySearch;
} }
private async Task OnSelectionChanged(ChangeEventArgs e) private async Task OnSelectionChanged(ChangeEventArgs e)
@ -40,15 +40,15 @@ public partial class CustomerSearchColumnComponent : IDisposable
var val = e.Value.ToString(); var val = e.Value.ToString();
if (val == "-1") return; if (val == "-1") return;
await OnChanged.InvokeAsync(val); await OnChanged.InvokeAsync(val);
await ProfileService.SetCompanySearch(val); await PreferenceService.SetCompanySearch(val);
} }
private void ProfileServiceOnOnChange(UserProfile newUserProfile) private void ProfileServiceOnOnChange(UserPreference newUserPreference)
{ {
Profiles = newUserProfile; Profiles = newUserPreference;
StateHasChanged(); StateHasChanged();
} }
public void Dispose() public void Dispose()
{ {
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -25,13 +25,13 @@ public partial class CustomerSearchPhraseComponent
{ {
private Timer InputTimer { get; set; } = new(); private Timer InputTimer { get; set; } = new();
private string SearchTerm { get; set; } = ""; private string SearchTerm { get; set; } = "";
private UserProfile Profiles { get; set; } = new (); private UserPreference Profiles { get; set; } = new ();
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Parameter] public EventCallback<string> OnChanged { get; set; } [Parameter] public EventCallback<string> OnChanged { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
SearchTerm = string.IsNullOrWhiteSpace(Profiles.CompanyFilterPhrase) ? "" : Profiles.CompanyFilterPhrase.Trim(); SearchTerm = string.IsNullOrWhiteSpace(Profiles.CompanyFilterPhrase) ? "" : Profiles.CompanyFilterPhrase.Trim();
if(!string.IsNullOrWhiteSpace(SearchTerm)) if(!string.IsNullOrWhiteSpace(SearchTerm))
@ -42,13 +42,13 @@ public partial class CustomerSearchPhraseComponent
{ {
InputTimer.Dispose(); InputTimer.Dispose();
SearchTerm = ""; SearchTerm = "";
await ProfileService.SetCompanyFilterPhrase(SearchTerm.Trim()); await PreferenceService.SetCompanyFilterPhrase(SearchTerm.Trim());
await OnChanged.InvokeAsync(SearchTerm); await OnChanged.InvokeAsync(SearchTerm);
} }
private async Task OnSearchChanged() private async Task OnSearchChanged()
{ {
await ProfileService.SetCompanyFilterPhrase(SearchTerm.Trim()); await PreferenceService.SetCompanyFilterPhrase(SearchTerm.Trim());
InputTimer.Dispose(); InputTimer.Dispose();
InputTimer = new Timer(500); InputTimer = new Timer(500);
InputTimer.AutoReset = false; InputTimer.AutoReset = false;

View file

@ -24,15 +24,15 @@ namespace Wonky.Client.Components;
public partial class CustomerSortComponent : IDisposable public partial class CustomerSortComponent : IDisposable
{ {
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Parameter] public EventCallback<string> OnChanged { get; set; } [Parameter] public EventCallback<string> OnChanged { get; set; }
private Dictionary<string, string> Items { get; set; } = new(); private Dictionary<string, string> Items { get; set; } = new();
private UserProfile _profiles = new(); private UserPreference _profiles = new();
private string SortCol { get; set; } = "name"; private string SortCol { get; set; } = "name";
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
_profiles = await ProfileService.GetProfile(); _profiles = await PreferenceService.GetProfile();
SortCol = _profiles.CompanySort; SortCol = _profiles.CompanySort;
} }
private async Task OnSelectionChanged(ChangeEventArgs e) private async Task OnSelectionChanged(ChangeEventArgs e)
@ -40,15 +40,15 @@ public partial class CustomerSortComponent : IDisposable
var val = e.Value.ToString(); var val = e.Value.ToString();
if (val == "-1") return; if (val == "-1") return;
await OnChanged.InvokeAsync(val); await OnChanged.InvokeAsync(val);
await ProfileService.SetCompanySort(val); await PreferenceService.SetCompanySort(val);
} }
private void ProfileServiceOnOnChange(UserProfile newUserProfile) private void ProfileServiceOnOnChange(UserPreference newUserPreference)
{ {
_profiles = newUserProfile; _profiles = newUserPreference;
StateHasChanged(); StateHasChanged();
} }
public void Dispose() public void Dispose()
{ {
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -13,28 +13,36 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
*@ *@
<div class="list-group list-group-flush"> <table class="table table-striped">
<tbody>
@if (UserList.Any()) @if (UserList.Any())
{ {
foreach (var user in UserList) @foreach (var user in UserList)
{ {
<div class="list-group-item list-group-item-action" style="cursor: pointer;"> <tr class="align-middle">
<div class="row align-items-center"> <td>
<div class="col-sm-1">@user.CountryCode @user.SalesRep</div> @user.FullName
<div class="col-sm-3">@user.FullName</div> </td>
<div class="col-sm-2">@user.PhoneNumber</div> <td>
<div class="col-sm-2"> @user.PhoneNumber
<a class="btn btn-warning d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/reports">Rapporter</a> </td>
</div> <td>
<div class="col-sm-2"> @user.SalesRep
<a class="btn btn-success d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/customers">Kunder</a> </td>
</div> <td>
</div> <a class="btn btn-warning d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/reports">Rapport Oversigt</a>
</div> </td>
<td>
<a class="btn btn-success d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/customers">Kunde Liste</a>
</td>
</tr>
} }
} }
else else
{ {
<div>Ingen data</div> <tr>
<td>Ingen data</td>
</tr>
} }
</div> </tbody>
</table>

View file

@ -32,7 +32,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components; namespace Wonky.Client.Components;
public partial class OfficeLandingComponent public partial class OfficeLandingComponent
{ {
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
private readonly JsonSerializerOptions _options = new JsonSerializerOptions private readonly JsonSerializerOptions _options = new JsonSerializerOptions
{ {
@ -40,21 +40,21 @@ public partial class OfficeLandingComponent
PropertyNamingPolicy = JsonNamingPolicy.CamelCase PropertyNamingPolicy = JsonNamingPolicy.CamelCase
}; };
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
private string WorkDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}"; private string WorkDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
private string Today { get; set; } = $"{DateTime.Now:yyyy-MM-dd}"; private string Today { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ProfileService.OnChange += ProfileChanged; PreferenceService.OnChange += ProfileChanged;
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
if (string.IsNullOrWhiteSpace(Profiles.WorkDate)) if (string.IsNullOrWhiteSpace(Profiles.WorkDate))
{ {
await ProfileService.SetWorkDate(DateTime.Now); await PreferenceService.SetWorkDate(DateTime.Now);
} }
} }
private void ProfileChanged(UserProfile newProfiles) private void ProfileChanged(UserPreference newProfiles)
{ {
Profiles = newProfiles; Profiles = newProfiles;
WorkDate = Profiles.WorkDate; WorkDate = Profiles.WorkDate;

View file

@ -23,18 +23,18 @@ namespace Wonky.Client.Components;
public partial class PageSizeComponent : IDisposable public partial class PageSizeComponent : IDisposable
{ {
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Parameter] public EventCallback<string> OnChanged { get; set; } [Parameter] public EventCallback<string> OnChanged { get; set; }
private Dictionary<string, string> Items { get; set; } = new(); private Dictionary<string, string> Items { get; set; } = new();
private UserProfile Profile { get; set; } = new(); private UserPreference Profile { get; set; } = new();
private string PageSize { get; set; } private string PageSize { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
Profile = await ProfileService.GetProfile(); Profile = await PreferenceService.GetProfile();
PageSize = Profile.PageSize; PageSize = Profile.PageSize;
await OnChanged.InvokeAsync(PageSize); await OnChanged.InvokeAsync(PageSize);
} }
@ -46,18 +46,18 @@ public partial class PageSizeComponent : IDisposable
var cVal = Convert.ToInt32(val); var cVal = Convert.ToInt32(val);
if (cVal > 50) val = "50"; // mitigate variable manipulation if (cVal > 50) val = "50"; // mitigate variable manipulation
await OnChanged.InvokeAsync(val); await OnChanged.InvokeAsync(val);
await ProfileService.SetPageSize(val); await PreferenceService.SetPageSize(val);
} }
private void ProfileServiceOnOnChange(UserProfile newUserProfile) private void ProfileServiceOnOnChange(UserPreference newUserPreference)
{ {
Profile = newUserProfile; Profile = newUserPreference;
PageSize = Profile.PageSize; PageSize = Profile.PageSize;
StateHasChanged(); StateHasChanged();
} }
public void Dispose() public void Dispose()
{ {
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -29,7 +29,7 @@ public partial class WorkDateComponent : IDisposable
/// <summary> /// <summary>
/// User preference service /// User preference service
/// </summary> /// </summary>
[Inject] public UserProfileService UserProfile { get; set; } [Inject] public UserPreferenceService UserPreference { get; set; }
/// <summary> /// <summary>
/// OnChanged callback function /// OnChanged callback function
@ -49,7 +49,7 @@ public partial class WorkDateComponent : IDisposable
/// <summary> /// <summary>
/// user preferences /// user preferences
/// </summary> /// </summary>
private UserProfile Profile { get; set; } = new(); private UserPreference Profile { get; set; } = new();
/// <summary> /// <summary>
/// Component Initialization /// Component Initialization
@ -57,8 +57,8 @@ public partial class WorkDateComponent : IDisposable
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
WorkDateContext = new EditContext(SelectedDate); WorkDateContext = new EditContext(SelectedDate);
UserProfile.OnChange += ProfileServiceOnOnChange; UserPreference.OnChange += ProfileServiceOnOnChange;
Profile = await UserProfile.GetProfile(); Profile = await UserPreference.GetProfile();
SelectedDate = string.IsNullOrWhiteSpace(Profile.WorkDate) SelectedDate = string.IsNullOrWhiteSpace(Profile.WorkDate)
? DateTime.Now ? DateTime.Now
: DateTime.Parse(Profile.WorkDate); : DateTime.Parse(Profile.WorkDate);
@ -73,7 +73,7 @@ public partial class WorkDateComponent : IDisposable
if (DateTime.TryParse(e.Value.ToString(), out var setDate)) if (DateTime.TryParse(e.Value.ToString(), out var setDate))
{ {
await UserProfile.SetWorkDate(setDate); await UserPreference.SetWorkDate(setDate);
await OnChangedCallback.InvokeAsync($"{setDate:yyyy-MM-dd}"); await OnChangedCallback.InvokeAsync($"{setDate:yyyy-MM-dd}");
} }
} }
@ -81,10 +81,10 @@ public partial class WorkDateComponent : IDisposable
/// <summary> /// <summary>
/// ProfileService /// ProfileService
/// </summary> /// </summary>
/// <param name="newUserProfile"></param> /// <param name="newUserPreference"></param>
private void ProfileServiceOnOnChange(UserProfile newUserProfile) private void ProfileServiceOnOnChange(UserPreference newUserPreference)
{ {
Profile = newUserProfile; Profile = newUserPreference;
StateHasChanged(); StateHasChanged();
} }
@ -93,6 +93,6 @@ public partial class WorkDateComponent : IDisposable
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
UserProfile.OnChange -= ProfileServiceOnOnChange; UserPreference.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -32,7 +32,7 @@ public partial class CatalogPagedOverlay : IDisposable
// injections // injections
[Inject] public ICountryCatalogRepository CatalogRepo { get; set; } [Inject] public ICountryCatalogRepository CatalogRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public ILogger<CatalogPagedOverlay> Logger { get; set; } [Inject] public ILogger<CatalogPagedOverlay> Logger { get; set; }
// parameters // parameters
@ -45,7 +45,7 @@ public partial class CatalogPagedOverlay : IDisposable
private List<SalesItemView> Items { get; set; } = new(); private List<SalesItemView> Items { get; set; } = new();
private MetaData? PageData { get; set; } = new(); private MetaData? PageData { get; set; } = new();
private CatalogPager _pager = new(); private CatalogPager _pager = new();
private UserProfile _userProfile = new(); private UserPreference _userPreference = new();
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
@ -56,10 +56,10 @@ public partial class CatalogPagedOverlay : IDisposable
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
_userProfile = await ProfileService.GetProfile(); _userPreference = await PreferenceService.GetProfile();
_pager.OrderBy = _userProfile.ItemSort; _pager.OrderBy = _userPreference.ItemSort;
_pager.SearchColumn = _userProfile.ItemSearch; _pager.SearchColumn = _userPreference.ItemSearch;
_pager.PageSize = Convert.ToInt32(_userProfile.PageSize); _pager.PageSize = Convert.ToInt32(_userPreference.PageSize);
} }
private async Task GetSalesItems() private async Task GetSalesItems()

View file

@ -41,7 +41,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
// Injected services // Injected services
[Inject] public ILogger<AdvisorActivityCreatePage> Logger { get; set; } [Inject] public ILogger<AdvisorActivityCreatePage> Logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
@ -50,8 +50,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
[Inject] public IAdvisorActivityRepository ActivityRepo { get; set; } [Inject] public IAdvisorActivityRepository ActivityRepo { get; set; }
[Inject] public IAdvisorReportRepository ReportRepo { get; set; } [Inject] public IAdvisorReportRepository ReportRepo { get; set; }
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; } [Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public IUserInfoService UserInfo { get; set; }
[Inject] public IUserInfoService UserService { get; set; }
// ************************************************************* // *************************************************************
// Parameters // Parameters
@ -63,7 +62,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
// Variables // Variables
private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true }; private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true };
private SalesItemView SelectedItem { get; set; } = new(); private SalesItemView SelectedItem { get; set; } = new();
private UserProfile UserProfile { get; set; } = new(); private UserPreference UserPreference { get; set; } = new();
private ActivityDto Activity { get; set; } = new(); private ActivityDto Activity { get; set; } = new();
private CompanyDto Company { get; set; } = new(); private CompanyDto Company { get; set; } = new();
private EditContext? ActivityContext { get; set; } private EditContext? ActivityContext { get; set; }
@ -117,9 +116,9 @@ public partial class AdvisorActivityCreatePage : IDisposable
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
// User Preferences // User Preferences
UserProfile = await ProfileService.GetProfile(); UserPreference = await PreferenceService.GetProfile();
// User Info // User Info
SalesRep = await UserService.GetUserInfo(); SalesRep = await UserInfo.GetUserInfo();
// Fetch Customer from http // Fetch Customer from http
Company = await CompanyRepo.GetCompanyById(CompanyId); Company = await CompanyRepo.GetCompanyById(CompanyId);
if (Company.HasFolded == 1) if (Company.HasFolded == 1)
@ -159,15 +158,15 @@ public partial class AdvisorActivityCreatePage : IDisposable
Activity.DlvZipCode = Company.ZipCode; Activity.DlvZipCode = Company.ZipCode;
Activity.DlvCity = Company.City; Activity.DlvCity = Company.City;
// Initialize date variable // Initialize date variable
Logger.LogDebug("AdvisorActivityCreatePage => DateTime parser => {}", UserProfile.WorkDate); Logger.LogDebug("AdvisorActivityCreatePage => DateTime parser => {}", UserPreference.WorkDate);
SelectedDate = string.IsNullOrWhiteSpace(UserProfile.WorkDate) SelectedDate = string.IsNullOrWhiteSpace(UserPreference.WorkDate)
? DateTime.Now ? DateTime.Now
: DateTime.Parse(UserProfile.WorkDate); : DateTime.Parse(UserPreference.WorkDate);
// raise flag if report is closed // raise flag if report is closed
ReportClosed = await ReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}"); ReportClosed = await ReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}");
// Ask for confirmation of date // Ask for confirmation of date
Logger.LogDebug("Preferences.DateConfirmed => {}", UserProfile.DateConfirmed); Logger.LogDebug("Preferences.DateConfirmed => {}", UserPreference.DateConfirmed);
if (!UserProfile.DateConfirmed) if (!UserPreference.DateConfirmed)
{ {
PromptDateConfirm = $"Aktiviteter oprettes med dato {SelectedDate.ToShortDateString()}. Er dette OK?"; PromptDateConfirm = $"Aktiviteter oprettes med dato {SelectedDate.ToShortDateString()}. Er dette OK?";
ConfirmWorkDate.Show(); ConfirmWorkDate.Show();
@ -338,7 +337,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
private async Task WorkDateConfirmCallback() private async Task WorkDateConfirmCallback()
{ {
await ProfileService.SetDateConfirmed(true); await PreferenceService.SetDateConfirmed(true);
Activity.ActivityDate = $"{SelectedDate:yyyy-MM-dd}"; Activity.ActivityDate = $"{SelectedDate:yyyy-MM-dd}";
ConfirmWorkDate.Hide(); ConfirmWorkDate.Hide();
StateHasChanged(); StateHasChanged();

View file

@ -29,7 +29,7 @@ namespace Wonky.Client.Pages;
public partial class AdvisorActivityTodayListPage : IDisposable public partial class AdvisorActivityTodayListPage : IDisposable
{ {
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public ILogger<AdvisorActivityTodayListPage> Logger { get; set; } [Inject] public ILogger<AdvisorActivityTodayListPage> Logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
@ -37,7 +37,7 @@ public partial class AdvisorActivityTodayListPage : IDisposable
[Inject] public IAdvisorReportRepository ReportRepo { get; set; } [Inject] public IAdvisorReportRepository ReportRepo { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
private ReportStatusView ReportStatusView { get; set; } = new(); private ReportStatusView ReportStatusView { get; set; } = new();
private UserProfile UserProfile { get; set; } = new(); private UserPreference UserPreference { get; set; } = new();
private DateTime SelectedDate { get; set; } private DateTime SelectedDate { get; set; }
private bool ReportExist { get; set; } private bool ReportExist { get; set; }
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
@ -46,10 +46,10 @@ public partial class AdvisorActivityTodayListPage : IDisposable
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
UserProfile = await ProfileService.GetProfile(); UserPreference = await PreferenceService.GetProfile();
SelectedDate = string.IsNullOrWhiteSpace(UserProfile.WorkDate) SelectedDate = string.IsNullOrWhiteSpace(UserPreference.WorkDate)
? DateTime.Now ? DateTime.Now
: DateTime.Parse(UserProfile.WorkDate); : DateTime.Parse(UserPreference.WorkDate);
ReportExist = await ReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}"); ReportExist = await ReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}");
await GetActivities($"{SelectedDate:yyyy-MM-dd}"); await GetActivities($"{SelectedDate:yyyy-MM-dd}");
Working = false; Working = false;

View file

@ -29,14 +29,14 @@ namespace Wonky.Client.Pages;
public partial class AdvisorCustomerPagedListPage : IDisposable public partial class AdvisorCustomerPagedListPage : IDisposable
{ {
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; } [Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; } [Inject] public IUserInfoService UserInfoService { get; set; }
private List<CompanyDto> CompanyList { get; set; } = new(); private List<CompanyDto> CompanyList { get; set; } = new();
private UserProfile Profile { get; set; } = new(); private UserPreference Profile { get; set; } = new();
private UserManagerEditView UserInfo { get; set; } = new(); private UserManagerEditView UserInfo { get; set; } = new();
private string SavedSearch { get; set; } = ""; private string SavedSearch { get; set; } = "";
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
@ -56,7 +56,7 @@ public partial class AdvisorCustomerPagedListPage : IDisposable
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
// set preferences // set preferences
Profile = await ProfileService.GetProfile(); Profile = await PreferenceService.GetProfile();
UserInfo = await UserInfoService.GetUserInfo(); UserInfo = await UserInfoService.GetUserInfo();
Paging.OrderBy = Profile.CompanySort; Paging.OrderBy = Profile.CompanySort;
Paging.SearchColumn = Profile.CompanySearch; Paging.SearchColumn = Profile.CompanySearch;

View file

@ -32,7 +32,7 @@ namespace Wonky.Client.Pages;
public partial class AdvisorReportCreatePage : IDisposable public partial class AdvisorReportCreatePage : IDisposable
{ {
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; } [Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
[Inject] public IAdvisorReportRepository AdvisorReportRepo { get; set; } [Inject] public IAdvisorReportRepository AdvisorReportRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
@ -42,7 +42,7 @@ public partial class AdvisorReportCreatePage : IDisposable
private ReportDto Report { get; set; } = new(); private ReportDto Report { get; set; } = new();
private List<ReportItemView> Activities { get; set; } = new(); private List<ReportItemView> Activities { get; set; } = new();
private ReportFiguresDto InitialValues { get; set; } = new(); private ReportFiguresDto InitialValues { get; set; } = new();
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
private bool FormInvalid { get; set; } = true; private bool FormInvalid { get; set; } = true;
private bool NoFigures { get; set; } = true; private bool NoFigures { get; set; } = true;
private bool Working { get; set; } private bool Working { get; set; }
@ -69,8 +69,8 @@ public partial class AdvisorReportCreatePage : IDisposable
ReportContext.OnFieldChanged += HandleFieldChanged; ReportContext.OnFieldChanged += HandleFieldChanged;
ReportContext.OnValidationStateChanged += ValidationChanged; ReportContext.OnValidationStateChanged += ValidationChanged;
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
Logger.LogDebug("{}", JsonSerializer.Serialize(Profiles)); Logger.LogDebug("{}", JsonSerializer.Serialize(Profiles));
WorkDate = Profiles.WorkDate; WorkDate = Profiles.WorkDate;
@ -78,7 +78,7 @@ public partial class AdvisorReportCreatePage : IDisposable
{ {
ThisWorkDate = DateTime.Now; ThisWorkDate = DateTime.Now;
WorkDate = $"{ThisWorkDate:yyyy-MM-dd}"; WorkDate = $"{ThisWorkDate:yyyy-MM-dd}";
await ProfileService.SetWorkDate(ThisWorkDate); await PreferenceService.SetWorkDate(ThisWorkDate);
} }
else else
{ {
@ -104,9 +104,9 @@ public partial class AdvisorReportCreatePage : IDisposable
Logger.LogDebug("OnInitializedAsync => GetKeyFigures <= {}", JsonSerializer.Serialize(Report)); Logger.LogDebug("OnInitializedAsync => GetKeyFigures <= {}", JsonSerializer.Serialize(Report));
} }
private void ProfileServiceOnOnChange(UserProfile userProfile) private void ProfileServiceOnOnChange(UserPreference userPreference)
{ {
Profiles = userProfile; Profiles = userPreference;
WorkDate = Profiles.WorkDate; WorkDate = Profiles.WorkDate;
StateHasChanged(); StateHasChanged();
} }
@ -193,9 +193,9 @@ public partial class AdvisorReportCreatePage : IDisposable
Logger.LogDebug("CreateReport.result => {}", JsonSerializer.Serialize(result)); Logger.LogDebug("CreateReport.result => {}", JsonSerializer.Serialize(result));
// reset km and date confirmation // reset km and date confirmation
await ProfileService.SetKmMorning(0); await PreferenceService.SetKmMorning(0);
// reset date confirmed // reset date confirmed
await ProfileService.SetDateConfirmed(false); await PreferenceService.SetDateConfirmed(false);
Navigator.NavigateTo($"/advisor/reports/view/{ThisWorkDate:yyyy-MM-dd}"); Navigator.NavigateTo($"/advisor/reports/view/{ThisWorkDate:yyyy-MM-dd}");
} }
@ -306,6 +306,6 @@ public partial class AdvisorReportCreatePage : IDisposable
Interceptor.DisposeEvent(); Interceptor.DisposeEvent();
ReportContext.OnFieldChanged -= HandleFieldChanged; ReportContext.OnFieldChanged -= HandleFieldChanged;
ReportContext.OnValidationStateChanged -= ValidationChanged; ReportContext.OnValidationStateChanged -= ValidationChanged;
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -34,10 +34,10 @@ public partial class AdvisorReportViewPage : IDisposable
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ILogger<AdvisorReportViewPage> Logger { get; set; } [Inject] public ILogger<AdvisorReportViewPage> Logger { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; } [Inject] public IUserInfoService UserInfoService { get; set; }
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
private ReportView Report { get; set; } = new(); private ReportView Report { get; set; } = new();
private List<ReportItemView> Activities { get; set; } = new (); private List<ReportItemView> Activities { get; set; } = new ();
private bool Working { get; set; } private bool Working { get; set; }
@ -51,8 +51,8 @@ public partial class AdvisorReportViewPage : IDisposable
XUserInfo = await UserInfoService.GetUserInfo(); XUserInfo = await UserInfoService.GetUserInfo();
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
await ProfileService.SetWorkDate(DateTime.Parse(ReportDate)); await PreferenceService.SetWorkDate(DateTime.Parse(ReportDate));
if(!string.IsNullOrWhiteSpace(ReportDate)) if(!string.IsNullOrWhiteSpace(ReportDate))
await FetchReport(ReportDate); await FetchReport(ReportDate);
@ -120,16 +120,16 @@ public partial class AdvisorReportViewPage : IDisposable
Working = false; Working = false;
} }
private void ProfileServiceOnOnChange(UserProfile userProfile) private void ProfileServiceOnOnChange(UserPreference userPreference)
{ {
Profiles = userProfile; Profiles = userPreference;
ReportDate = Profiles.WorkDate; ReportDate = Profiles.WorkDate;
StateHasChanged(); StateHasChanged();
} }
public void Dispose() public void Dispose()
{ {
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
Interceptor.DisposeEvent(); Interceptor.DisposeEvent();
} }
} }

View file

@ -26,13 +26,13 @@ namespace Wonky.Client.Pages;
public partial class AdvisorTaskItemListCrmPage : IDisposable public partial class AdvisorTaskItemListCrmPage : IDisposable
{ {
[Inject] public UserProfileService UserProfileService { get; set; } [Inject] public UserPreferenceService UserPreferenceService { get; set; }
[Inject] public ILogger<AdvisorTaskItemListCrmPage> Logger { get; set; } [Inject] public ILogger<AdvisorTaskItemListCrmPage> Logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public IAdvisorTaskItemRepository TaskRepo { get; set; } [Inject] public IAdvisorTaskItemRepository TaskRepo { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
private UserProfile Profile { get; set; } = new(); private UserPreference Profile { get; set; } = new();
private string WorkDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}"; private string WorkDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
private List<TaskItemDto> TaskItems { get; set; } = new(); private List<TaskItemDto> TaskItems { get; set; } = new();
@ -40,7 +40,7 @@ public partial class AdvisorTaskItemListCrmPage : IDisposable
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Profile = await UserProfileService.GetProfile(); Profile = await UserPreferenceService.GetProfile();
if(!string.IsNullOrWhiteSpace(Profile.WorkDate)) if(!string.IsNullOrWhiteSpace(Profile.WorkDate))
WorkDate = Profile.WorkDate; WorkDate = Profile.WorkDate;

View file

@ -40,7 +40,10 @@
<div class="col-sm-2"> <div class="col-sm-2">
<PageSizeComponent OnChanged="SetPageSize"/> <PageSizeComponent OnChanged="SetPageSize"/>
</div> </div>
<div class="col-sm-10"> <div class="col-sm-3">
<h5 class="text-white">Prisliste @CountryName</h5>
</div>
<div class="col-sm-7">
<PagerPagesComponent MetaData="PageData" Spread="2" SelectedPage="SetSelectedPage"/> <PagerPagesComponent MetaData="PageData" Spread="2" SelectedPage="SetSelectedPage"/>
</div> </div>
<div class="col-sm-2 text-end"> <div class="col-sm-2 text-end">

View file

@ -32,7 +32,7 @@ public partial class CatalogCountryPagedListPage : IDisposable
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public ICountryCatalogRepository Catalog { get; set; } [Inject] public ICountryCatalogRepository Catalog { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public ILogger<CatalogCountryPagedListPage> Logger { get; set; } [Inject] public ILogger<CatalogCountryPagedListPage> Logger { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; } [Inject] public IUserInfoService UserInfoService { get; set; }
@ -42,14 +42,14 @@ public partial class CatalogCountryPagedListPage : IDisposable
private List<SalesItemView> Items { get; set; } = new(); private List<SalesItemView> Items { get; set; } = new();
private MetaData PageData { get; set; } = new(); private MetaData PageData { get; set; } = new();
private CatalogPager Paging { get; set; } = new(); private CatalogPager Paging { get; set; } = new();
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
private UserManagerEditView XUserInfo { get; set; } = new(); private UserManagerEditView XUserInfo { get; set; } = new();
private bool Working { get; set; } private bool Working { get; set; }
private string CountryName { get; set; } = ""; private string CountryName { get; set; } = "";
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
XUserInfo = await UserInfoService.GetUserInfo(); XUserInfo = await UserInfoService.GetUserInfo();
Paging.OrderBy = Profiles.ItemSort; Paging.OrderBy = Profiles.ItemSort;

View file

@ -25,20 +25,23 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class OfficeCustomerAdvisorPagedListPage : IDisposable public partial class OfficeAdvisorCustomerPagedListPage : IDisposable
{ {
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ICountryCustomerRepository CustomerRepo { get; set; } [Inject] public ICountryCustomerRepository CustomerRepo { get; set; }
[Inject] public UserProfileService UserProfileService { get; set; } [Inject] public UserPreferenceService UserPreferenceService { get; set; }
[Inject] public IOfficeUserInfoRepository UserRepo { get; set; } [Inject] public IOfficeUserInfoRepository UserRepo { get; set; }
// #############################################################
[Parameter] public string UserId { get; set; } = ""; [Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "dk"; [Parameter] public string CountryCode { get; set; } = "dk";
// #############################################################
private List<CompanyDto> CompanyList { get; set; } = new(); private List<CompanyDto> CompanyList { get; set; } = new();
private MetaData PageData { get; set; } = new(); private MetaData PageData { get; set; } = new();
private CustomerPaging Paging { get; set; } = new(); private CustomerPaging Paging { get; set; } = new();
private UserProfile UserProfile { get; set; } = new(); private UserPreference UserPreference { get; set; } = new();
private string SavedSearch { get; set; } = ""; private string SavedSearch { get; set; } = "";
private bool IncludeFolded { get; set; } private bool IncludeFolded { get; set; }
private bool ShowFolded { get; set; } private bool ShowFolded { get; set; }
@ -54,14 +57,14 @@ public partial class OfficeCustomerAdvisorPagedListPage : IDisposable
SalesRep = await UserRepo.GetUserInfo(UserId); SalesRep = await UserRepo.GetUserInfo(UserId);
// set preferences // set preferences
UserProfile = await UserProfileService.GetProfile(); UserPreference = await UserPreferenceService.GetProfile();
Paging.OrderBy = UserProfile.CompanySort; Paging.OrderBy = UserPreference.CompanySort;
Paging.SearchColumn = UserProfile.CompanySearch; Paging.SearchColumn = UserPreference.CompanySearch;
Paging.PageSize = Convert.ToInt32(UserProfile.PageSize); Paging.PageSize = Convert.ToInt32(UserPreference.PageSize);
Paging.HasFolded = IncludeFolded ? 1 : 0; Paging.HasFolded = IncludeFolded ? 1 : 0;
// load saved search // load saved search
SavedSearch = UserProfile.CompanyFilterPhrase; SavedSearch = UserPreference.CompanyFilterPhrase;
Paging.SearchTerm = SavedSearch; Paging.SearchTerm = SavedSearch;
await FetchCompanies(); await FetchCompanies();
@ -113,7 +116,7 @@ public partial class OfficeCustomerAdvisorPagedListPage : IDisposable
if (!string.IsNullOrWhiteSpace(searchTerm) && searchTerm.TrimEnd().Length > 2) if (!string.IsNullOrWhiteSpace(searchTerm) && searchTerm.TrimEnd().Length > 2)
{ {
SavedSearch = searchTerm; SavedSearch = searchTerm;
await UserProfileService.SetCompanyFilterPhrase(searchTerm.Trim()); await UserPreferenceService.SetCompanyFilterPhrase(searchTerm.Trim());
} }
} }

View file

@ -32,25 +32,28 @@ namespace Wonky.Client.Pages;
public partial class OfficeAdvisorReportViewPage : IDisposable public partial class OfficeAdvisorReportViewPage : IDisposable
{ {
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ICountryReportRepository ReportRepo { get; set; } [Inject] public ICountryReportRepository ReportRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<OfficeAdvisorReportViewPage> Logger { get; set; } [Inject] public ILogger<OfficeAdvisorReportViewPage> Logger { get; set; }
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IJSRuntime JsRuntime { get; set; } [Inject] public IJSRuntime JsRuntime { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
[Inject] public IOrderProcessRepository ProcessRepo { get; set; } [Inject] public IOrderProcessRepository ProcessRepo { get; set; }
// #############################################################
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";
[Parameter] public string UserId { get; set; } = ""; [Parameter] public string UserId { get; set; } = "";
[Parameter] public string ReportDate { get; set; } = ""; [Parameter] public string ReportDate { get; set; } = "";
// #############################################################
private IJSObjectReference JsModule { get; set; } private IJSObjectReference JsModule { get; set; }
private ReportView Report { get; set; } = new(); private ReportView Report { get; set; } = new();
private List<ReportItemView> Activities { get; set; } = new(); private List<ReportItemView> Activities { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
private UserProfile 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()
@ -58,9 +61,9 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
ProfileService.OnChange += ProfileServiceOnOnChange; PreferenceService.OnChange += ProfileServiceOnOnChange;
await ProfileService.SetWorkDate(DateTime.Parse(ReportDate)); await PreferenceService.SetWorkDate(DateTime.Parse(ReportDate));
await FetchUserReport(ReportDate); await FetchUserReport(ReportDate);
} }
@ -160,10 +163,10 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
Working = false; Working = false;
} }
private void ProfileServiceOnOnChange(UserProfile userProfile) private void ProfileServiceOnOnChange(UserPreference userPreference)
{ {
Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange"); Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange");
Profile = userProfile; Profile = userPreference;
Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange => Prefs.WorkDate <= {}", Profile.WorkDate); Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange => Prefs.WorkDate <= {}", Profile.WorkDate);
ReportDate = Profile.WorkDate; ReportDate = Profile.WorkDate;
@ -173,6 +176,6 @@ public partial class OfficeAdvisorReportViewPage : IDisposable
public void Dispose() public void Dispose()
{ {
Interceptor.DisposeEvent(); Interceptor.DisposeEvent();
ProfileService.OnChange -= ProfileServiceOnOnChange; PreferenceService.OnChange -= ProfileServiceOnOnChange;
} }
} }

View file

@ -28,16 +28,20 @@ namespace Wonky.Client.Pages;
public partial class OfficeCustomerCountryPagedListPage : IDisposable public partial class OfficeCustomerCountryPagedListPage : IDisposable
{ {
[Parameter] public string CountryCode { get; set; } = ""; // #############################################################
[Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserProfileService ProfileService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public ICountryCustomerRepository CustomerRepo { get; set; } [Inject] public ICountryCustomerRepository CustomerRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; } [Inject] public IUserInfoService UserInfoService { get; set; }
// #############################################################
[Parameter] public string CountryCode { get; set; } = "";
// #############################################################
private List<CompanyDto> Companies { get; set; } = new(); private List<CompanyDto> Companies { get; set; } = new();
private UserProfile Profiles { get; set; } = new(); private UserPreference Profiles { get; set; } = new();
private UserManagerEditView UserInfo { get; set; } = new(); private UserManagerEditView UserInfo { get; set; } = new();
private string SavedSearch { get; set; } = ""; private string SavedSearch { get; set; } = "";
private bool ShowFolded { get; set; } private bool ShowFolded { get; set; }
@ -54,7 +58,7 @@ public partial class OfficeCustomerCountryPagedListPage : IDisposable
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
// set preferences // set preferences
Profiles = await ProfileService.GetProfile(); Profiles = await PreferenceService.GetProfile();
UserInfo = await UserInfoService.GetUserInfo(); UserInfo = await UserInfoService.GetUserInfo();
Paging.OrderBy = Profiles.CompanySort; Paging.OrderBy = Profiles.CompanySort;
Paging.SearchColumn = Profiles.CompanySearch; Paging.SearchColumn = Profiles.CompanySearch;

View file

@ -26,14 +26,14 @@
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
<AuthorizeView Roles="Admin,Office"> <AuthorizeView Roles="Admin,Office">
<a class="list-group-item list-group-item-action list-group-item-warning" href="/office/users/advisors/dk"> <a class="list-group-item list-group-item-action list-group-item-warning" href="/office/users/advisors/dk">
<i class="bi-activity"></i> Sælgere <i class="bi-activity"></i> Sælger Liste
</a> </a>
</AuthorizeView> </AuthorizeView>
<a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/dk"> <a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/dk">
<i class="bi-phone"></i> Tlf.Ordre <i class="bi-phone"></i> Telefon Bestilling
</a> </a>
<a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/dk"> <a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/dk">
<i class="bi-file-spreadsheet"></i> Priser <i class="bi-file-spreadsheet"></i> Produkt Prisliste
</a> </a>
</div> </div>
</div> </div>
@ -47,14 +47,14 @@
<div class="list-group"> <div class="list-group">
<AuthorizeView Roles="Admin,Office"> <AuthorizeView Roles="Admin,Office">
<a class="list-group-item list-group-item-action list-group-item-warning" href="/office/users/advisors/no"> <a class="list-group-item list-group-item-action list-group-item-warning" href="/office/users/advisors/no">
<i class="bi-activity"></i> Sælgere <i class="bi-activity"></i> Sælger Liste
</a> </a>
</AuthorizeView> </AuthorizeView>
<a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/no"> <a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/no">
<i class="bi-phone"></i> Tlf.Ordre <i class="bi-phone"></i> Telefon Bestilling
</a> </a>
<a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/no"> <a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/no">
<i class="bi-file-spreadsheet"></i> Priser <i class="bi-file-spreadsheet"></i> Produkt Prisliste
</a> </a>
</div> </div>
</div> </div>
@ -68,14 +68,14 @@
<div class="list-group"> <div class="list-group">
<AuthorizeView Roles="Admin,Office"> <AuthorizeView Roles="Admin,Office">
<a class="list-group-item list-group-item-action list-group-item-warning" href="/office/users/advisors/se"> <a class="list-group-item list-group-item-action list-group-item-warning" href="/office/users/advisors/se">
<i class="bi-activity"></i> Sælgere <i class="bi-activity"></i> Sælger Liste
</a> </a>
</AuthorizeView> </AuthorizeView>
<a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/se"> <a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/se">
<i class="bi-phone"></i> Tlf.Ordre <i class="bi-phone"></i> Telefon Bestilling
</a> </a>
<a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/se"> <a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/se">
<i class="bi-file-spreadsheet"></i> Priser <i class="bi-file-spreadsheet"></i> Produkt Prisliste
</a> </a>
</div> </div>
</div> </div>

View file

@ -20,5 +20,6 @@ namespace Wonky.Client.Pages;
public partial class OfficeLandingPage public partial class OfficeLandingPage
{ {
// #############################################################
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";
} }

View file

@ -35,7 +35,7 @@ namespace Wonky.Client.Pages;
public partial class OfficeOrderCreatePage : IDisposable public partial class OfficeOrderCreatePage : IDisposable
{ {
// -------------------------------------------------------------------- // #############################################################
// injected services // injected services
[Inject] public ILogger<OfficeOrderCreatePage> Logger { get; set; } [Inject] public ILogger<OfficeOrderCreatePage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
@ -44,17 +44,17 @@ public partial class OfficeOrderCreatePage : IDisposable
[Inject] public ICountryCustomerRepository CustomerRepo { get; set; } [Inject] public ICountryCustomerRepository CustomerRepo { get; set; }
[Inject] public ICountryCustomerHistoryRepository HistoryRepo { get; set; } [Inject] public ICountryCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICountryActivityRepository ActivityRepo { get; set; } [Inject] public ICountryActivityRepository ActivityRepo { get; set; }
[Inject] public ISystemUserRepository UserRepo { get; set; } [Inject] public IOfficeUserInfoRepository UserRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; } [Inject] public IUserInfoService UserInfoService { get; set; }
// -------------------------------------------------------------------- // #############################################################
// parameters // parameters
[Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";
[CascadingParameter] public DraftStateProvider DraftProvider { get; set; } [CascadingParameter] public DraftStateProvider DraftProvider { get; set; }
// -------------------------------------------------------------------- // #############################################################
// private variables // private variables
private readonly JsonSerializerOptions _options = new() {PropertyNameCaseInsensitive = true}; private readonly JsonSerializerOptions _options = new() {PropertyNameCaseInsensitive = true};
// class objects // class objects
@ -62,7 +62,7 @@ public partial class OfficeOrderCreatePage : IDisposable
private UserManagerEditView UserInfo { get; set; } = new(); private UserManagerEditView UserInfo { get; set; } = new();
private SalesItemView SelectedItem { get; set; } = new(); private SalesItemView SelectedItem { get; set; } = new();
private ActivityDto Activity { get; set; } = new(); private ActivityDto Activity { get; set; } = new();
private UserManagerEditView SalesRep { get; set; } = new(); private UserAdvisorInfoView SalesRep { get; set; } = new();
// edit context // edit context
private EditContext ActivityContext { get; set; } private EditContext ActivityContext { get; set; }
// variables // variables
@ -75,14 +75,14 @@ public partial class OfficeOrderCreatePage : IDisposable
private bool PoFormInvalid { get; set; } = true; private bool PoFormInvalid { get; set; } = true;
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
// -------------------------------------------------------------------- // #############################################################
// overlays // overlays
private CatalogPagedOverlay CatalogOverlay { get; set; } = new(); private CatalogPagedOverlay CatalogOverlay { get; set; } = new();
private OfficeCustomerInvoiceListOverlay InvoiceListOverlay { get; set; } = new(); private OfficeCustomerInvoiceListOverlay InvoiceListOverlay { get; set; } = new();
private OfficeCustomerActivityListOverlay ActivityListOverlay { get; set; } = new(); private OfficeCustomerActivityListOverlay ActivityListOverlay { get; set; } = new();
private OfficeOrderInventoryListOverlay InventoryListOverlay { get; set; } = new(); private OfficeOrderInventoryListOverlay InventoryListOverlay { get; set; } = new();
// -------------------------------------------------------------------- // #############################################################
// lists // lists
private List<ProductInventoryView> CompanyInventory { get; set; } = new(); private List<ProductInventoryView> CompanyInventory { get; set; } = new();
private InvoiceListView CompanyInvoices { get; set; } = new(); private InvoiceListView CompanyInvoices { get; set; } = new();

View file

@ -30,8 +30,7 @@ namespace Wonky.Client.Pages;
public partial class OfficeOrderViewPage : IDisposable public partial class OfficeOrderViewPage : IDisposable
{ {
[Parameter] public string CompanyId { get; set; } = ""; // #############################################################
[Parameter] public string OrderId { get; set; } = "";
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; } [Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
[Inject] public ISystemSendMailService MailService { get; set; } [Inject] public ISystemSendMailService MailService { get; set; }
@ -40,7 +39,12 @@ public partial class OfficeOrderViewPage : IDisposable
[Inject] public ILogger<OfficeOrderViewPage> Logger { get; set; } [Inject] public ILogger<OfficeOrderViewPage> Logger { get; set; }
[Inject] public IToastService Toast { get; set; } [Inject] public IToastService Toast { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; } [Inject] public IUserInfoService UserInfoService { get; set; }
// #############################################################
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string OrderId { get; set; } = "";
// #############################################################
private ReportItemView ReportItem { get; set; } = new(); private ReportItemView ReportItem { get; set; } = new();
private bool IsNotified { get; set; } private bool IsNotified { get; set; }
private bool Working { get; set; } = true; private bool Working { get; set; } = true;

View file

@ -26,11 +26,14 @@ namespace Wonky.Client.Pages;
public partial class OfficeUserAdvisorListPage :IDisposable public partial class OfficeUserAdvisorListPage :IDisposable
{ {
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IOfficeUserInfoRepository UserRepo { get; set; } [Inject] public IOfficeUserInfoRepository UserRepo { get; set; }
// #############################################################
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";
// #############################################################
private List<UserInfoListView> SalesReps { get; set; } = new(); private List<UserInfoListView> SalesReps { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
private string CountryName { get; set; } = ""; private string CountryName { get; set; } = "";

View file

@ -25,12 +25,17 @@ namespace Wonky.Client.Pages;
public partial class OfficeUserAdvisorReportListPage : IDisposable public partial class OfficeUserAdvisorReportListPage : IDisposable
{ {
[Parameter] public string UserId { get; set; } = ""; // #############################################################
[Parameter] public string CountryCode { get; set; } = "";
[Inject] public ICountryReportRepository ReportRepo { get; set; } [Inject] public ICountryReportRepository ReportRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IOfficeUserInfoRepository UserRepo { get; set; } [Inject] public IOfficeUserInfoRepository UserRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
// #############################################################
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "";
// #############################################################
private List<SalesReportListView> ActivityReports { get; set; } = new(); private List<SalesReportListView> ActivityReports { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
private UserAdvisorInfoView AdvisorInfo { get; set; } = new(); private UserAdvisorInfoView AdvisorInfo { get; set; } = new();

View file

@ -10,11 +10,12 @@ namespace Wonky.Client.Pages;
public partial class SupervisorAdvisorListPage : IDisposable public partial class SupervisorAdvisorListPage : IDisposable
{ {
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IOfficeUserInfoRepository UserRepo { get; set; } [Inject] public IOfficeUserInfoRepository UserRepo { get; set; }
// #############################################################
private List<UserInfoListView> Users { get; set; } = new(); private List<UserInfoListView> Users { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()

View file

@ -11,12 +11,14 @@ namespace Wonky.Client.Pages;
#pragma warning disable CS8618 #pragma warning disable CS8618
public partial class SystemMaintenanceMessagePage : IDisposable public partial class SystemMaintenanceMessagePage : IDisposable
{ {
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ISystemUserRepository UserRepo { get; set; } [Inject] public ISystemUserRepository UserRepo { get; set; }
[Inject] public ISystemSendSmsService SmsService { get; set; } [Inject] public ISystemSendSmsService SmsService { get; set; }
[Inject] public ILogger<SystemMaintenanceMessagePage> Logger { get; set; } [Inject] public ILogger<SystemMaintenanceMessagePage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
// #############################################################
private List<UserInfoListView> Users { get; set; } = new(); private List<UserInfoListView> Users { get; set; } = new();
private ShortMessage Message { get; set; } = new(); private ShortMessage Message { get; set; } = new();
private List<Recipient> Recipients { get; set; } = new(); private List<Recipient> Recipients { get; set; } = new();

View file

@ -20,5 +20,6 @@ namespace Wonky.Client.Pages;
public partial class SystemManagerLandingPage public partial class SystemManagerLandingPage
{ {
// #############################################################
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";
} }

View file

@ -24,12 +24,15 @@ namespace Wonky.Client.Pages;
public partial class SystemSupervisorListPage : IDisposable public partial class SystemSupervisorListPage : IDisposable
{ {
// #############################################################
[Inject] public ISystemUserRepository UserRepo { get; set; } [Inject] public ISystemUserRepository UserRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
// #############################################################
private List<UserInfoListView> Users { get; set; } = new(); private List<UserInfoListView> Users { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();

View file

@ -26,15 +26,19 @@ namespace Wonky.Client.Pages;
public partial class SystemSupervisorViewEditPage : IDisposable public partial class SystemSupervisorViewEditPage : IDisposable
{ {
// #############################################################
[Inject] public ISystemUserRepository UserRepo { get; set; } [Inject] public ISystemUserRepository UserRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ILogger<SystemSupervisorViewEditPage> Logger { get; set; } [Inject] public ILogger<SystemSupervisorViewEditPage> Logger { get; set; }
// #############################################################
[Parameter] public string UserId { get; set; } = "";
// #############################################################
private readonly JsonSerializerOptions _options = new JsonSerializerOptions private readonly JsonSerializerOptions _options = new JsonSerializerOptions
{ {
PropertyNameCaseInsensitive = true PropertyNameCaseInsensitive = true
}; };
[Parameter] public string UserId { get; set; } = "";
private UserManagerEditView UserData { get; set; } = new(); private UserManagerEditView UserData { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
private EditContext UserAssignmentContext { get; set; } private EditContext UserAssignmentContext { get; set; }

View file

@ -30,10 +30,13 @@ namespace Wonky.Client.Pages;
public partial class SystemUserCreatePage : IDisposable public partial class SystemUserCreatePage : IDisposable
{ {
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ISystemUserRepository UserRepo { get; set; } [Inject] public ISystemUserRepository UserRepo { get; set; }
[Inject] public ILogger<SystemUserCreatePage> Logger { get; set; } [Inject] public ILogger<SystemUserCreatePage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
// #############################################################
private UserManagerCreate NewUserInfo { get; set; } = new(); private UserManagerCreate NewUserInfo { get; set; } = new();
private EditContext NewUserContext { get; set; } private EditContext NewUserContext { get; set; }
private bool ContextInvalid { get; set; } = true; private bool ContextInvalid { get; set; } = true;

View file

@ -25,12 +25,15 @@ namespace Wonky.Client.Pages;
public partial class SystemUserListPage : IDisposable public partial class SystemUserListPage : IDisposable
{ {
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ISystemUserRepository UserRepo { get; set; } [Inject] public ISystemUserRepository UserRepo { get; set; }
// #############################################################
private List<UserInfoListView> UserList { get; set; } = new(); private List<UserInfoListView> UserList { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();

View file

@ -29,12 +29,18 @@ namespace Wonky.Client.Pages;
public partial class SystemUserViewEditPage : IDisposable public partial class SystemUserViewEditPage : IDisposable
{ {
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = ""; // #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ISystemUserRepository UserRepo { get; set; } [Inject] public ISystemUserRepository UserRepo { get; set; }
[Inject] public ILogger<SystemUserViewEditPage> Logger { get; set; } [Inject] public ILogger<SystemUserViewEditPage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
// #############################################################
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "";
// #############################################################
private UserManagerEditView UserData { get; set; } = new(); private UserManagerEditView UserData { get; set; } = new();
private EditContext UserEditContext { get; set; } private EditContext UserEditContext { get; set; }
private ResetPasswordDto Passwords { get; set; } = new(); private ResetPasswordDto Passwords { get; set; } = new();

View file

@ -27,16 +27,21 @@ namespace Wonky.Client.Pages;
public partial class WarehouseOrderListPage : IDisposable public partial class WarehouseOrderListPage : IDisposable
{ {
[Parameter] public string Status { get; set; } = "none"; // #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IOrderProcessRepository OrderProcessRepo { get; set; } [Inject] public IOrderProcessRepository OrderProcessRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
// #############################################################
[Parameter] public string Status { get; set; } = "none";
// #############################################################
private List<WarehouseOrderView> OrderList { get; set; } = new(); private List<WarehouseOrderView> OrderList { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
private string Header { get; set; } = "Ubehandlet"; private string Header { get; set; } = "Ubehandlet";
private bool ReadyToShip { get; set; } private bool ReadyToShip { get; set; }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();

View file

@ -27,16 +27,21 @@ namespace Wonky.Client.Pages;
public partial class WarehouseOrderViewPage : IDisposable public partial class WarehouseOrderViewPage : IDisposable
{ {
[Parameter] public string OrderId { get; set; } = ""; // #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IOrderProcessRepository OrderProcessRepo { get; set; } [Inject] public IOrderProcessRepository OrderProcessRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; } [Inject] public NavigationManager Navigator { get; set; }
[Inject] public IToastService Toast { get; set; } [Inject] public IToastService Toast { get; set; }
[Inject] public ILogger<WarehouseOrderViewPage> Logger { get; set; } [Inject] public ILogger<WarehouseOrderViewPage> Logger { get; set; }
// #############################################################
[Parameter] public string OrderId { get; set; } = "";
// #############################################################
private WarehouseOrderView Order { get; set; } = new(); private WarehouseOrderView Order { get; set; } = new();
private bool Working { get; set; } = true; private bool Working { get; set; } = true;
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();

View file

@ -55,7 +55,7 @@ builder.Services.Configure<ApiConfig>(builder.Configuration.GetSection("ApiConfi
builder.Services.Configure<AppInfo>(builder.Configuration.GetSection("AppInfo")); builder.Services.Configure<AppInfo>(builder.Configuration.GetSection("AppInfo"));
// user // user
builder.Services.AddScoped<IUserInfoService, UserInfoService>(); builder.Services.AddScoped<IUserInfoService, UserInfoService>();
builder.Services.AddScoped<UserProfileService, UserProfileService>(); builder.Services.AddScoped<UserPreferenceService, UserPreferenceService>();
// crm repositories // crm repositories
builder.Services.AddScoped<IAdvisorActivityRepository, AdvisorActivityRepository>(); builder.Services.AddScoped<IAdvisorActivityRepository, AdvisorActivityRepository>();
builder.Services.AddScoped<IAdvisorCustomerRepository, AdvisorCustomerRepository>(); builder.Services.AddScoped<IAdvisorCustomerRepository, AdvisorCustomerRepository>();

View file

@ -33,7 +33,7 @@ public class AuthenticationService : IAuthenticationService
private readonly IOptions<ApiConfig> _apiConfig; private readonly IOptions<ApiConfig> _apiConfig;
private readonly ILogger<AuthenticationService> _logger; private readonly ILogger<AuthenticationService> _logger;
private readonly IUserInfoService _infoService; private readonly IUserInfoService _infoService;
private readonly UserProfileService _profile; private readonly UserPreferenceService _preference;
private readonly ILocalStorageService _localStorage; private readonly ILocalStorageService _localStorage;
public AuthenticationService( public AuthenticationService(
@ -42,7 +42,7 @@ public class AuthenticationService : IAuthenticationService
IOptions<ApiConfig> apiConfig, IOptions<ApiConfig> apiConfig,
ILogger<AuthenticationService> logger, ILogger<AuthenticationService> logger,
IUserInfoService infoService, IUserInfoService infoService,
UserProfileService profile, UserPreferenceService preference,
ILocalStorageService localStorage ILocalStorageService localStorage
) )
{ {
@ -51,7 +51,7 @@ public class AuthenticationService : IAuthenticationService
_apiConfig = apiConfig; _apiConfig = apiConfig;
_logger = logger; _logger = logger;
_infoService = infoService; _infoService = infoService;
_profile = profile; _preference = preference;
_localStorage = localStorage; _localStorage = localStorage;
} }
@ -124,11 +124,11 @@ public class AuthenticationService : IAuthenticationService
public async Task Logout() public async Task Logout()
{ {
var profileBackup = await _profile.GetProfile(); var profileBackup = await _preference.GetProfile();
Task.Delay(150); Task.Delay(150);
await _localStorage.ClearAsync(); await _localStorage.ClearAsync();
Task.Delay(150); Task.Delay(150);
await _profile.SetProfile(profileBackup); await _preference.SetProfile(profileBackup);
_client.DefaultRequestHeaders.Authorization = null; _client.DefaultRequestHeaders.Authorization = null;
((AuthStateProvider)_authStateProvider).NotifyUserLogout(); ((AuthStateProvider)_authStateProvider).NotifyUserLogout();
} }

View file

@ -17,7 +17,7 @@
using Blazored.LocalStorage; using Blazored.LocalStorage;
namespace Wonky.Client.Services; namespace Wonky.Client.Services;
public record UserProfile public record UserPreference
{ {
public string CompanyFilterPhrase { get; set; } = ""; public string CompanyFilterPhrase { get; set; } = "";
public string CompanySearch { get; set; } = "name"; public string CompanySearch { get; set; } = "name";
@ -30,13 +30,13 @@ public record UserProfile
public bool DateConfirmed { get; set; } public bool DateConfirmed { get; set; }
} }
public class UserProfileService public class UserPreferenceService
{ {
private readonly ILocalStorageService _localStorageService; private readonly ILocalStorageService _localStorageService;
private const string KeyName = "preferences"; private const string KeyName = "preferences";
public event Action<UserProfile>? OnChange; public event Action<UserPreference>? OnChange;
public UserProfileService(ILocalStorageService localStorageService) public UserPreferenceService(ILocalStorageService localStorageService)
{ {
_localStorageService = localStorageService; _localStorageService = localStorageService;
} }
@ -134,12 +134,12 @@ public class UserProfileService
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task<UserProfile> GetProfile() public async Task<UserPreference> GetProfile()
{ {
return await _localStorageService.GetItemAsync<UserProfile>(KeyName) ?? new UserProfile(); return await _localStorageService.GetItemAsync<UserPreference>(KeyName) ?? new UserPreference();
} }
public async Task SetProfile(UserProfile profile) public async Task SetProfile(UserPreference profile)
{ {
await _localStorageService.SetItemAsync(KeyName, profile); await _localStorageService.SetItemAsync(KeyName, profile);
} }

View file

@ -27,14 +27,12 @@ public class VatInfoLookupService
{ {
private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true }; private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true };
private readonly HttpClient _client; private readonly HttpClient _client;
private readonly IOptions<ApiConfig> _apiConfig; private readonly ApiConfig _api;
private readonly ApiConfig _config;
public VatInfoLookupService(HttpClient client, IOptions<ApiConfig> apiConfig) public VatInfoLookupService(HttpClient client, IOptions<ApiConfig> apiConfig)
{ {
_client = client; _client = client;
_apiConfig = apiConfig; _api = apiConfig.Value;
_config = _apiConfig.Value;
} }
public async Task<List<VirkRegInfo>> QueryVirkRegistry(VirkParams query) public async Task<List<VirkRegInfo>> QueryVirkRegistry(VirkParams query)
@ -52,7 +50,7 @@ public class VatInfoLookupService
["zipCode"] = $"{query.ZipCode}", ["zipCode"] = $"{query.ZipCode}",
["entityName"] = $"{query.EntityName}" ["entityName"] = $"{query.EntityName}"
}; };
var endpoint = QueryHelpers.AddQueryString(_config.ServicesVatDk, queryString); var endpoint = QueryHelpers.AddQueryString(_api.ServicesVatDk, queryString);
var response = await _client.GetAsync(endpoint); var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
@ -80,7 +78,7 @@ public class VatInfoLookupService
["vatNumber"] = $"{vatNumber}" ["vatNumber"] = $"{vatNumber}"
}; };
var endpoint = QueryHelpers.AddQueryString(_config.ServicesVatNo, queryString); var endpoint = QueryHelpers.AddQueryString(_api.ServicesVatNo, queryString);
var response = await _client.GetAsync(endpoint); var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
@ -102,7 +100,7 @@ public class VatInfoLookupService
{ {
["vatNumber"] = $"{vatNumber}" ["vatNumber"] = $"{vatNumber}"
}; };
var endpoint = QueryHelpers.AddQueryString(_config.ServicesVatEu, queryString); var endpoint = QueryHelpers.AddQueryString(_api.ServicesVatEu, queryString);
var response = await _client.GetAsync(endpoint); var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();